这是我作业中遇到的不知大家有用否 (defun c:gbg(/ ss a name elev) (command "undo" "be") (setq ss(ssget (list '(-4 . "<OR") (cons 0 "lwpolyline") (cons 0 "polyline") '(-4 . "OR>") ))) (setq a 0) (repeat (sslength ss) (setq name(ssname ss a)) (setq vlaobject-name (vlax-ename->vla-object name)) (setq elev (vla-get-Elevation vlaobject-name)) (vla-put-Elevation vlaobject-name (* elev 5));;乘常数 (vlax-release-object vlaobject-name) (setq a(1+ a)) ) (command "undo" "e") ) ;;除常数 (defun c:qbg(/ ss a name elev) (command "undo" "be") (setq ss(ssget (list '(-4 . "<OR") (cons 0 "lwpolyline") (cons 0 "polyline") '(-4 . "OR>") ))) (setq a 0) (repeat (sslength ss) (setq name(ssname ss a)) (setq vlaobject-name (vlax-ename->vla-object name)) (setq elev (vla-get-Elevation vlaobject-name)) (vla-put-Elevation vlaobject-name (/ elev 5));;除常数 (vlax-release-object vlaobject-name) (setq a(1+ a)) ) (command "undo" "e") ) |