วันพุธที่ 13 มีนาคม พ.ศ. 2567

Change Elv by attribute

 

;|

changes a blocks z coordinate to 

the elevation listed in attribute 

|;

(defun c:chbel()

(setq old_cmdecho  (getvar "cmdecho"))

(setvar "cmdecho" 0)

(setq SS (ssget '((0 . "INSERT")(66 . 1)))

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

(setvar "cmdecho" old_cmdecho)

(princ)

);end defun

ไม่มีความคิดเห็น:

แสดงความคิดเห็น