Change command in lisp not working

Change command in lisp not working

jsaayman
Advocate Advocate
2,079 Views
2 Replies
Message 1 of 3

Change command in lisp not working

jsaayman
Advocate
Advocate

I have created a lisp to change the elevation of a selected point, but I can't seem to pass the variable to the change command in my lisp

 

Please help

 

(defun c:chpt ( / newel s  )
  (if (setq s (entsel "\Select point to change"))
    	(setq newel (getreal "\nEnter new elevation: "))
	(COMMAND "CHANGE" s "" "P" "E" newel "")
     )
   (princ)
  )
0 Likes
Accepted solutions (1)
2,080 Views
2 Replies
Replies (2)
Message 2 of 3

dbhunia
Advisor
Advisor
Accepted solution

It should be something like this.....

 

(defun c:chpt ( / newel s  )
  (if (setq s (car(entsel "\Select point to change")))
	(progn
    	(setq newel (getreal "\nEnter new elevation: "))
	(COMMAND "CHANGE" s "" "P" "E" newel "")
	)
  )
(princ)
)

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 3

ВeekeeCZ
Consultant
Consultant

This way it allows you pre-selection one or more points.

 

(defun c:chpt ( / s e)
  (if (and (or (setq s (ssget "_I"))
               (setq s (car (entsel "\nSelect point to set elevation: "))))
           (setq e (getreal "\nNew elevation: "))
           )
    (command "_.CHANGE" s "" "_Properties" "_Elevation" e ""))
  (princ)
  )
0 Likes