Author Topic: Creating a polyline in with lisp  (Read 2564 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Creating a polyline in with lisp
« 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



T.Willey

  • Needs a day job
  • Posts: 5251
Re: Creating a polyline in with lisp
« Reply #1 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.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Creating a polyline in with lisp
« Reply #2 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:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Shade

  • Guest
Re: Creating a polyline in with lisp
« Reply #3 on: March 08, 2006, 01:13:22 PM »
Thank you, works like a charm.
 :-D