How to retrive elevation Value(Property) of 3dPoly/2Dpoly/Poly using Lisp function using single entity Pick?
|
|
|
How to retrive elevation Value(Property) of 3dPoly/2Dpoly/Poly using Lisp function using single entity Pick?
Hope this work for you buddy ..
TharwatCode:(defun c:TesT (/ ss e lst) (vl-load-com) ;; Tharwat 01 Nov. 2011 ;; (if (and (setq ss (car (entsel "\n select a Polyline :"))) (member (cdr (assoc 0 (setq e (entget ss)))) '("POLYLINE" "LWPOLYLINE") ) ) (progn (setq lst (vl-remove-if-not (function (lambda (x) (eq (car x) 100) ) ) e ) ) (if (not (member '(100 . "AcDb3dPolyline") lst)) (princ (strcat "\n " "The Elevation is : " (rtos (vla-get-elevation (vlax-ename->vla-object ss)) 2) ) ) ) ) (princ) ) (princ) )
A 3dpolyline can have multiple elevations (different at each vertex). In that situation, are you wanting the closest vertex elevation to where you select the polyline?
Thanks for Reply.............it is true that every vertex might carry different Elevation Value. But in my case All Vertex Carry same Elevation Value.
As i am using AutoCAD map 2004. Using Clean up option i convert 3Dpoly to Simple Polyline. And Best result i found is that Elevation remains same it is not set "0". So i write Simple Lisp that works Perfect.
(defun c:ee()
(while(setq aa(car(entsel"pIck Entity ...")))
(setq bb(entget aa))
(setq cc (cdr(Assoc 38 bb)))
(setq rt (rtos cc 2 3))
(setq msg (strcat"\nCurrent Elevation Height is:" rt))
(prompt msg)
(setvar "OSMode" 204
(setq ww 200)
(setq aa (- cc ww))
(command "Pline" (getpoint) "Length" aa "" "")
)
)