Jump to content

Recommended Posts

Posted

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""");
)

 

Posted

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) "")

 

Posted (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 by Nikon
Posted (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 by Tsuky
  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...