Aubrey.kieren68998
2004-06-08, 10:06 AM
Please help! I'm very new to lisp.
I found this routine a few days ago on the AutoDESK forums, it looks for the "top attribute"(?) I assume this means the first attribute in the list?
I cannot for the life of me work out how to change it to search for a "named" attribute in a block that I wish to use (attribute name is "INVERT").
I would be most grateful if someone could tell me how to to do this! It would save me SOOOO much time!
Thanks,
..::KIEREN::..
;;;C:bel changes a blocks z coordinate to the elevation listed in the top attribute ;
;;;----------------------------
(defun C:bel()
(setq ss (ssget)
ucsf (getvar "ucsfollow"))
(if (/= ss nil)
(progn
(setq ssl (sslength ss))
(setvar "ucsfollow" 0)
(if (/= 1 (getvar "worlducs"))(setq wucs 0)(setq wucs 1))
(command "ucs" "")
(setq numchg ssl
n ssl
newss (ssadd))
(while (> n 0)
(setq n (1- n)
blk (ssname ss n))
(setq ent (vlax-ename->vla-object blk))
(setq atts (vla-getattributes ent))
(setq temp (vlax-variant-value atts))
(setq elem1 (vlax-safearray-get-element temp 0))
(setq el (atof (vla-get-textstring elem1)))
(command "CHANGE" blk "" "P" "E" el "")
);end while
(setq ssl (sslength newss)
n ssl)
(setq txt "block(s) raised to elevation.")
(if (/= numchg 0)
(progn
(print numchg)
(princ txt))
(prompt "No blocks selected."))
)
(prompt "Empty selection set."))
(if (= 0 wucs)(command "ucs" "p"))
(setvar "ucsfollow" ucsf)
(princ)
);end defun
I found this routine a few days ago on the AutoDESK forums, it looks for the "top attribute"(?) I assume this means the first attribute in the list?
I cannot for the life of me work out how to change it to search for a "named" attribute in a block that I wish to use (attribute name is "INVERT").
I would be most grateful if someone could tell me how to to do this! It would save me SOOOO much time!
Thanks,
..::KIEREN::..
;;;C:bel changes a blocks z coordinate to the elevation listed in the top attribute ;
;;;----------------------------
(defun C:bel()
(setq ss (ssget)
ucsf (getvar "ucsfollow"))
(if (/= ss nil)
(progn
(setq ssl (sslength ss))
(setvar "ucsfollow" 0)
(if (/= 1 (getvar "worlducs"))(setq wucs 0)(setq wucs 1))
(command "ucs" "")
(setq numchg ssl
n ssl
newss (ssadd))
(while (> n 0)
(setq n (1- n)
blk (ssname ss n))
(setq ent (vlax-ename->vla-object blk))
(setq atts (vla-getattributes ent))
(setq temp (vlax-variant-value atts))
(setq elem1 (vlax-safearray-get-element temp 0))
(setq el (atof (vla-get-textstring elem1)))
(command "CHANGE" blk "" "P" "E" el "")
);end while
(setq ssl (sslength newss)
n ssl)
(setq txt "block(s) raised to elevation.")
(if (/= numchg 0)
(progn
(print numchg)
(princ txt))
(prompt "No blocks selected."))
)
(prompt "Empty selection set."))
(if (= 0 wucs)(command "ucs" "p"))
(setvar "ucsfollow" ucsf)
(princ)
);end defun