TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Shade on March 08, 2006, 11:53:43 AM

Title: Creating a polyline in with lisp
Post by: Shade on March 08, 2006, 11:53:43 AM
I am trying to get input from a user by generating a polyline, and then getting the area from that polyline which will then be placed at the end of a leader.
The following is a bit of the code i am currently using;

(setq PWDT (getvar "PLINEWID"))
(setvar "PLINEWID" 1.25)
(command "_.Pline" pause)
(setq ENT (entlast))
(command "_.Area" ENT)

The problem is autocad try’s to find the area before the polyine command is executed, so therefore no object is stored in the ENT variable, thereby giving my no area.

I would like the program to draw the polyline and keep it but also give me the area when done.
I have fiddle with the idea of collecting points, but that still doesn't graphically show my end user the polyline outline as he is drawing it. Which is what I wish to accomplish.

Any ideas on how I may accomplish my task.
Thanks in advance
 :-D


Title: Re: Creating a polyline in with lisp
Post by: T.Willey on March 08, 2006, 11:56:46 AM
Code: [Select]
(command "_.pline")
(while (> (getvar "cmdactive") 0)
 (command pause)
)
(command "")

This should draw a pline as long as you want.
Title: Re: Creating a polyline in with lisp
Post by: T.Willey on March 08, 2006, 11:58:15 AM
You might now need the last
(command "")
I think you would need that if you are processing points from a list, but you can test it and see if you need it or not.  If it repeats the pline command, then you don't.  :angel:
Title: Re: Creating a polyline in with lisp
Post by: Shade on March 08, 2006, 01:13:22 PM
Thank you, works like a charm.
 :-D