Dayananda Posted 18 hours ago Posted 18 hours ago I have following code to draw a line first and adjust the length of line using LENGTHEN command. Only after getting entity name I need to change its property etc. But the I cant stop the lengthen command and it repeating. Please explain me what is mistake in my command. (defun C:test1() (setq p1 (getpoint"\npick point1")) (setq p2 (getpoint"\npick point2")) (command "line""non"p1 "non"p2 ""); bottom bar (command "_lengthen" "DYnamic" "non"p2) (setq line1 (entlast)) (command "change" line1"""P""C""1"""); ) Quote
Steven P Posted 14 hours ago Posted 14 hours ago I don't think I have used lengthen in a LISP, not used the command for a while, but a quick look at your code "non"p2) - add a couple of spaces for readbility, but in that line you haven't specified the line to lengthen and you might need to end with "": (command "_lengthen" "DYnamic" "non" p2 (entlast) "") Quote
Nikon Posted 11 hours ago Posted 11 hours ago (edited) 9 hours ago, Dayananda said: But the I cant stop the lengthen command and it repeating. Maybe it is possible to change the order of commands, at first "_.change", then "_.lengthen" ? (defun C:LineChLenDY ( / p1 p2 line1) (setq p1 (getpoint "Specify the first point: ")) (setq p2 (getpoint "Specify the second point: ")) (command "line" "non" p1 "non" p2 "") (setq line1 (entlast)) (command "change" line1 "" "P" "C" "1" "") (command "lengthen" "DYnamic") (princ) ) Edited 9 hours ago by Nikon Quote
Tsuky Posted 11 hours ago Posted 11 hours ago (edited) Use (list (entlast) p2) at place of p2: (list (entlast) p2) <=> at return of (entsel) (defun C:test1 ( / p1 p2 line1) (initget 1) (setq p1 (getpoint "\npick point1")) (initget 1) (setq p2 (getpoint p1 "\npick point2")) (command "_.line""_non" p1 "_non" p2 "") (setq line1 (entlast)) (command "_.lengthen" "_DYnamic" (list line1 p2) pause "") (command "_.change" line1 "" "_Properties" "_Color" "1" "") (prin1) ) Edited 11 hours ago by Tsuky 1 Quote
BIGAL Posted 2 hours ago Posted 2 hours ago Another, could do a pop enter value in a dcl box etc, rather than command line. It works to specified length. (defun C:test2 ( / p1 p2 dist d) (initget 1) (setq p1 (getpoint "\npick point 1")) (initget 1) (setq p2 (getpoint p1 "\npick point 2")) (setq dist (distance p1 p2)) (setq d (getreal (strcat "\nLine length is " (rtos dist 2 2) " Enter new length "))) (if (= d nil) (princ) (setq dist d) ) (setq p2 (polar p1 (angle p1 p2) dist)) (command "_.line""_non" p1 "_non" p2 "") (princ) ) (c:test2) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.