Jump to content

Lisp to add polyline then select it to run more command


Recommended Posts

Posted

Hi,

I have a lisp taken from several forums and stiched it together, what it does is it would select a polyline, then offset it with multiple lines and deletes the selected polyline. Now, how do I make this to add the polyline first, then select it to run the offset command..thanks

 

(defun C:3off()

(setq off1 1.5)

(setq off2 6)

(setq off3 12)

(while (setq obj (car (entsel "\nSelect object:")))

(setq ps (getpoint "\nSide to offset:"))

(if ps

(progn

(command "-layer" "set" "0" "")

(command "_offset" "Layer" "Current" "" "")

(command "_offset" off1 obj ps "")

(command "-layer" "set" "RED_LAYER" "")

(command "_offset" off2 obj ps "")

(command "-layer" "set" "MAGENTA_LAYER" "")

(command "_offset" off3 obj ps "")

(command "-layer" "set" "0" "")

(command "erase" obj "")

)

)

)

(princ)

)

Posted

found the answer, I added the following command before the nselect line :

 

(command "pline"(while (> (getvar 'cmdactive) 0) (command pause)))

 

The lisp now makes me draw the pline, then select it and point what side the offset will be, it offsets 3 lines with different offset values and also changes the layer and then deletes the polyline I drew.... cool!

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...