Jump to content

Recommended Posts

Posted

Hello all,

 

I got a LISP that allows users to select a polyline, and that boundary is used to manipulate some entities.

Now, i got a question if it is possible to have an option to allow a user to draw a polyline during the LISP execution.

 

So, to make the INITGET function and such aint the problem, but.....

Is it possible to call the POLYLINE command, and 'pause' until the user closes that polyline, and then do something with that polyline?

 

So.. the PLINE command is executed, and when finished, use (setq ensel (entlast)), so i can do anything with the ensel symbol?

 

I manage to 'pause' the command to ask for use imput, but allow multiple points to be selected and 'close'... is next level.

Posted

Of course...

(prompt "\nCommand PLINE is activated and you can pick points - to finish - type \"C\" for closing it, or ENTER to leave LWPOLYLINE open...")
(command "_.pline")
(while (< 0 (getvar (quote cmdactive)))
  (command "\\")
)

Another variant, by using (vl-cmdf) function...

(prompt "\nCommand PLINE is activated and you can pick points - to finish - type \"C\" for closing it, or ENTER to leave LWPOLYLINE open...")
(vl-cmdf "_.pline")
(while (< 0 (getvar (quote cmdactive)))
  (vl-cmdf "\\")
)

Note that this snippet won't work with (command-s) function...

Posted

@marko_ribar

 

Thanks Marko, this works very well!

I never used the 'cmdactive' function before. 🙂

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