2件事一条多段线的z值可以反映为一个“高程”,一条三维多段线的每个垂直都有单独的z值。
也就是说
- ; this is for plines with an elevation
- ; remove just for testing
- (command "-layer" "N" "0.001 - 1.0m contours" "N" "1.001 - 2.0m contours" "")
- (defun defun1 ()
- (setq ht (vla-get-elevation obj))
- )
- (defun defun2 ()
- (setq ht (nth 2 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj "Coordinates")))))
- )
- (defun c:test2 ( / ss ht x itis)
- (setq ss (ssget ))
- (repeat (setq x (sslength ss))
- (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
- (setq itis (vla-get-objectname obj))
- (cond ((= "AcDbPolyline" itis)(defun1))
- ((= "AcDb3dPolyline" itis)(defun2))
- ) ;cond
- (cond ((< ht 1.0)(vla-put-layer obj "0.001 - 1.0m contours"))
- ((< ht 2.0)(vla-put-layer obj "1.001 - 2.0m contours"))
- )
- ) ; repeat
- ) ; defun
|