Code Red > AutoLISP (Vanilla / Visual)
Subtrat or add Z to all items
renkor:
Hello all,
I need help you. I has a drawing with different elements (lines, plines, block, arcs....) with different Z value each one. And I would like to be able to subtract or add Z to all items (not move to Z=0)
Example:
Line 1-->original Z=5.
Line 1--> Desired Z=6+2 (2 or whatever I need)= 8. Or 6-2=4
ronjonp:
Try this:
--- Code - Auto/Visual Lisp: ---(defun c:foo (/ b i s) ;; RJP » 2019-06-11 (cond ((and (setq i (getreal "\nEnter number [+ or -]: ")) (setq s (ssget ":L" '((0 . "arc,circle,insert,line,lwpolyline,*text")))) ) (foreach a (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (foreach x '(insertionpoint center elevation startpoint endpoint) (cond ((= 'list (type (vl-catch-all-apply 'vlax-get (list a x)))) (setq b (vlax-get a x)) (vl-catch-all-apply 'vlax-put (list a x (list (car b) (cadr b) (+ (caddr b) i)))) ) ) ) ) ) ) (princ))
Lee Mac:
Try this:
--- Code - Auto/Visual Lisp: ---(defun c:chz ( / s z ) (if (and (setq z (getreal "\nSpecify elevation change: ")) (setq s (ssget "_:L")) ) (vl-cmdf "_.move" s "" "_non" '(0 0 0) "_non" (list 0 0 z)) ) (princ))
ronjonp:
--- Quote from: Lee Mac on June 11, 2019, 04:53:47 PM ---Try this:
--- Code - Auto/Visual Lisp: ---(defun c:chz ( / s z ) (if (and (setq z (getreal "\nSpecify elevation change: ")) (setq s (ssget "_:L")) ) (vl-cmdf "_.move" s "" "_non" '(0 0 0) "_non" (list 0 0 z)) ) (princ))
--- End quote ---
Nice :)
Lee Mac:
--- Quote from: ronjonp on June 12, 2019, 09:20:39 AM ---
--- Quote from: Lee Mac on June 11, 2019, 04:53:47 PM ---Try this:
--- Code - Auto/Visual Lisp: ---(defun c:chz ( / s z ) (if (and (setq z (getreal "\nSpecify elevation change: ")) (setq s (ssget "_:L")) ) (vl-cmdf "_.move" s "" "_non" '(0 0 0) "_non" (list 0 0 z)) ) (princ))
--- End quote ---
Nice :)
--- End quote ---
Thanks :-)
Navigation
[0] Message Index
[#] Next page
Go to full version