# Thread: Elevation Retrive? Using AutoLisp Function

1. Login to Give a bone

## Elevation Retrive? Using AutoLisp Function

How to retrive elevation Value(Property) of 3dPoly/2Dpoly/Poly using Lisp function using single entity Pick?

2. Login to Give a bone

## Re: Elevation Retrive? Using AutoLisp Function

Hope this work for you buddy ..

Code:
```(defun c:TesT (/ ss e lst)
;; 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)
)```
Tharwat

3. Login to Give a bone

## Re: Elevation Retrive? Using AutoLisp Function

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?

4. Login to Give a bone

## Re: Elevation Retrive? Using AutoLisp Function

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

Originally Posted by alanjt
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?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•