#Pline create in ALISP??
2 messages in this thread
Hi all.
Is there anyway to use a
(command "pline")
in a LISP routine? I'm trying to write a routine that lets you
enclose an architectural floor plan area with a PLINE, and then brings up a
tag with the area (& other stuff). My idea was to create a PLINE until a
NIL was returned, then use PEDIT to close off the boundary and continue the
process, but I can't thing of a way to pause the routine. I know I could
simply gather points, ie: (setq pt2 (getpoint pt1 "/nNext point: ") but
this circumvents the ability to use the options of the PLINE command.
I can't even get this to work:
(setq pt1 (getpoint "\nEnter start: "); set up initial pt
pt2 (getpoint "\nNext point: "); set up 2nd pt
)
(command "pline" pt1 pt2 "") ;draw 1st PLINE
(setq PLN (entlast) pt1 pt2) ;memorize it, & make pt1=pt2
(while (setq pt2 (getpoint pt1 "\nNext point: "));get new pt2
(command "pline" pt1 pt2 "") ;draw next pline
(command "pedit" "L" "J" PLN "");edit it & join previous
(setq pt1 pt2 pln (entlast));memorize new pline & pt1=pt2
) ;do it again until a NIL
It will loop only once, then will crash under the PLINE command. PT1
& PT2 evaluate to nil, but I don't know why. (Found this out by trying the
!pt1 at the command line)
Any suggestions?
Dave –
Try something like this. (not tested, just typed out)
(setq pt (getpoint "\nFrom pt: ")) (command ".pline" pt)
;leave the pline command unfinished (while (= (type pt) 'list)
(setq pt (getpoint "\nTo pt: "))
(if (= (type pt) 'list)(command pt)) );while (command "cl") ;if you want
to close it
– Ted Schaefer