Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can i continue polyline after a command

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
ahmet471985
15408 Views, 5 Replies

how can i continue polyline after a command

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

 

5 REPLIES 5
Message 2 of 6
dbroad
in reply to: ahmet471985

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.

 

 

 

 

 

Architect, Registered NC, VA, SC, & GA.
Message 3 of 6
ahmet471985
in reply to: dbroad

thanks alot

Message 4 of 6
stevor
in reply to: ahmet471985

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.

 

S
Message 5 of 6
dbroad
in reply to: ahmet471985

You're welcome.

Architect, Registered NC, VA, SC, & GA.
Message 6 of 6
dbroad
in reply to: stevor

That was the last option I covered.

Architect, Registered NC, VA, SC, & GA.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost