Jump to content

Help me, copy a frame by lisp!


Recommended Posts

Posted

Try using a layout with big picture then little layouts use zoom C to pick point inside little layout and set scale etc.

Posted

I would go with BIGAL's suggestion, but if you want to work in Model space, try this old routine.

(defun C:CUT (/ *error* e p1 p2 p3 ss echo osmode)
 
 (setq echo (getvar "cmdecho"))
 (setq osmode (getvar "OSMODE"))
 
 (defun *error* (msg)
   (if msg (princ msg))
   (command "_UNDO" "E")
   (setvar "OSMODE" osmode)
   (setvar "cmdecho" echo)
   (princ)
   )
 
 (setvar "OSMODE" 0)
 (setvar "cmdecho" 0)
 (if (and
       (setq p1 (getpoint "\nFirst corner: "))
       (setq p2 (getcorner p1 "\nSecond corner: "))
       (progn (if (not etrim) (load "extrim.lsp" "Extrim not found")) T)
       etrim
     )
   (progn
     (command "_RECTANGLE" p1 p2)
     (command "_UNDO" "BE")
     (setq e (entlast))
     (setq p3 (polar p1 (angle p2 p1) (* 0.5 (distance p1 p2))))
     (etrim e p3)
;;;      (entdel e )
     (setq ss (ssget "W" p1 p2))
     (command "_copybase" p2 ss "")
     (command "_UNDO" "B")
     (command "_pasteclip" pause)
     )
   )
 (command "_UNDO" "E")
 (setvar "OSMODE" osmode)
 (setvar "cmdecho" echo)
 (princ)
)

Posted
I would go with BIGAL's suggestion, but if you want to work in Model space, try this old routine.

(defun C:CUT (/ *error* e p1 p2 p3 ss echo osmode)
 
 (setq echo (getvar "cmdecho"))
 (setq osmode (getvar "OSMODE"))
 
 (defun *error* (msg)
   (if msg (princ msg))
   (command "_UNDO" "E")
   (setvar "OSMODE" osmode)
   (setvar "cmdecho" echo)
   (princ)
   )
 
 (setvar "OSMODE" 0)
 (setvar "cmdecho" 0)
 (if (and
       (setq p1 (getpoint "\nFirst corner: "))
       (setq p2 (getcorner p1 "\nSecond corner: "))
       (progn (if (not etrim) (load "extrim.lsp" "Extrim not found")) T)
       etrim
     )
   (progn
     (command "_RECTANGLE" p1 p2)
     (command "_UNDO" "BE")
     (setq e (entlast))
     (setq p3 (polar p1 (angle p2 p1) (* 0.5 (distance p1 p2))))
     (etrim e p3)
;;;      (entdel e )
     (setq ss (ssget "W" p1 p2))
     (command "_copybase" p2 ss "")
     (command "_UNDO" "B")
     (command "_pasteclip" pause)
     )
   )
 (command "_UNDO" "E")
 (setvar "OSMODE" osmode)
 (setvar "cmdecho" echo)
 (princ)
)

Dear, Stefan BMR!

I like your way because it is my habit (working on the model)! However, if I start on 2 corner points of the rectangular frame is available autolisp work does not seem exactly like the frame to cut autolisp draw. So you can edit autolisp by selecting frame (rectangle)? Please, help me! If so, great. Thanks and best regards!

P / S:

Because, when i load your lisp is Snap (Osnap) Clear all instead select my routine (Endpoint, Midpoint, Nearest)

Thank Stefan BMR very much!

Posted (edited)
minhphuong_humg said:
Dear, Stefan BMR!

I like your way because it is my habit (working on the model)! However, if I start on 2 corner points of the rectangular frame is available autolisp work does not seem exactly like the frame to cut autolisp draw. So you can edit autolisp by selecting frame (rectangle)? Please, help me! If so, great. Thanks and best regards!

P / S:

Because, when i load your lisp is Snap (Osnap) Clear all instead select my routine (Endpoint, Midpoint, Nearest)

Thank Stefan BMR very much!

Try this one. You can't select an object, but Osnap setting is available.

(defun C:CUT (/ *error* e p1 p2 p3 ss echo undo)
 (setq echo (getvar "cmdecho"))

 (defun *error* (msg)
   (if msg (princ msg))
   (setvar "cmdecho" echo)
   (princ)
   )

 (if
    (and
       (setq p1 (getpoint "\nFirst corner: "))
       (setq p2 (getcorner p1 "\nSecond corner: "))
       (not (equal p1 p2 1e-5))
       (progn (if (not etrim) (load "extrim.lsp" "Extrim not found")) T)
       etrim
     )
   (progn
     (setvar "cmdecho" 0)
     (setq undo (getvar 'undoctl))
     (if (= 0 (logand 1 undo)) (command "_UNDO" "_ALL"))
     (command "_RECTANGLE" "_non" p1 "_non" p2)
     (command "_UNDO" "_M")
     (setq e (entlast))
     (etrim e (getvar 'vsmin))
     (command "_zoom" "_o" e "")
     (setq ss (ssget "W" p1 p2))
     (command "_copybase" p2 ss "")
     (command "_UNDO" "_B")
     (command "_pasteclip" pause)
     (if (= 0 (logand 1 undo)) (command "_UNDO" "_C" "_NONE"))
     (setvar "cmdecho" echo)
     )
   )
 (*error* nil)
 (princ)
)
 
Edited by Stefan BMR
Posted
Try this one. You can't select an object, but Osnap setting is available.

(defun C:CUT (/ *error* e p1 p2 p3 ss echo undo)
 (setq echo (getvar "cmdecho"))

 (defun *error* (msg)
   (if msg (princ msg))
   (setvar "cmdecho" echo)
   (princ)
   )

 (if
    (and
       (setq p1 (getpoint "\nFirst corner: "))
       (setq p2 (getcorner p1 "\nSecond corner: "))
       (not (equal p1 p2 1e-5))
       (progn (if (not etrim) (load "extrim.lsp" "Extrim not found")) T)
       etrim
     )
   (progn
     (setvar "cmdecho" 0)
     (setq undo (getvar 'undoctl))
     (if (= 0 (logand 1 undo)) (command "_UNDO" "_ALL"))
     (command "_RECTANGLE" "_non" p1 "_non" p2)
     (command "_UNDO" "_M")
     (setq e (entlast))
     (etrim e (getvar 'vsmin))
     (setq ss (ssget "W" p1 p2))
     (command "_copybase" p2 ss "")
     (command "_UNDO" "_B")
     (command "_pasteclip" pause)
     (if (= 0 (logand 1 undo)) (command "_UNDO" "_C" "_NONE"))
     (setvar "cmdecho" echo)
     )
   )
 (*error* nil)
 (princ)
)

Dear Stefan BMR!

It seems that you have not checked out my drawings sent. I downloaded your lisp and try again on my drawings are not working lisp (selected corners of the rectangular frame).

Please try directly on my drawing (attached).

File attach:

http://www.mediafire.com/download/v7qn32qcaq2ighf/Help_Copy_Frame.dwg

Sincerely BMR.

File video demo your lisp:

Thank you very much!

Posted

Add the red line

..........
(etrim e (getvar 'vsmin))
[color=red](command "_zoom" "_o" e "")[/color]
(setq ss (ssget "W" p1 p2))
..............

  • 2 weeks later...
Posted
Add the red line

..........
(etrim e (getvar 'vsmin))
[color=red](command "_zoom" "_o" e "")[/color]
(setq ss (ssget "W" p1 p2))
..............

 

Thank Stefan BMR very much!

  • 2 weeks later...
Posted
Dear Stefan BMR!

It seems that you have not checked out my drawings sent. I downloaded your lisp and try again on my drawings are not working lisp (selected corners of the rectangular frame).

Please try directly on my drawing (attached).

File attach:

http://www.mediafire.com/download/v7qn32qcaq2ighf/Help_Copy_Frame.dwg

Sincerely BMR.

File video demo your lisp:

Thank you very much!

 

Dear Stefan BMR!

After a time using your lisp. I found that the only option was lisp squares that look the other shapes (polygons) .You please revise your lisp help me so that I can select different shapes?

I am very grateful to you!

Sincerely thank Stefan BMR!

File attachment image.

[shape color magenta]

Capture.JPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...