Hello i want continue my polyline after an operation.
Like this:
(command "pline" pt1 pt2 )
;some other codes
;and here my previous pline will be continued....
Solved! Go to Solution.
Solved by dbroad. Go to Solution.
In general, the solution is to use a getxxxx function to obtain user point input in a loop.
(command "pline" p1 p2)
;;any other code that does not cancel the pline command.
(while (setq pn (getpoint "\nNext point: ")) ;;hitting enter ends loop
(command pn) ;;to pass point to command
)
(command "") ;;to exit
Other issues relate to whether you want to support the full features of the pline command during the loop. The above only allows for point input. Also the initget function can be used to qualify input or to add support for the command's keyword options.
....
(initget (+ bit1 ... bitn) keywords)
(setq pn (getpoint "\nNext point[keywords supported]<finish or other logical default>: "))
;logic to text the input command options
....
This quickly becomes overly complex for such powerful commands as pline.
So another approach is to test to see that the command is still active and then to allow the input to go directly to the command.
....
(command "pline" p1 p2)
;;any other code that does not cancel the pline command
(setq oce (getvar "cdmecho"))
(setvar "cmdecho" 1)
(while (= 1 (getvar "cmdactive"))
(command pause)
)
(setvar "cmdeco" oce)
;rest of program
This allows the command to be completed in the normal way but does not allow for local program control of command options. Cmdecho must be on in order for users to see the command prompting.
If you need to end the pline command and then continue later, you need to keep up with p2 and the ename of the resulting command and then start another pline command with p2 and use one of the loops described above.
....
(command "pline" p1 p2 "");;end first pline with empty string
(setq el (entlast))
;do other stuff
;;create second pline with loop
(setq el2 (entlast))
;;join the two polylines together
(command "pedit" el "j" el2 "") ;;join two polylines together.
Another approach is to properly terminate the initial Pline command, then:
save that entity name,
do the other steps,
create another Pline entity,
and finally joint the 2 plines.
Note that plines with arc complicate it somewhat.
Can't find what you're looking for? Ask the community or share your knowledge.