@KMaloneyPCKDF As others have stated, there ate different kinds of polylines, although IMO lwpolyline is best options. Here you have two functions that I regularly use at my work. One is for contour labeling, and other for setting elevations when received contours are flattened. In contours labeling function two options are commented
(; ) at beginning of the line, one is to put mask behind the elevation text, and other to trim contour so you can use what's needed in particular situation.
(defun c:lel ( / intersections textmask doc decplaces th e eo pt elev co ispts ang )
;Label lwpolyline contour at pick point and rotate answer to question is different from ""
(defun intersections ( ob1 ob2 mod / lst rtn )
(if (and (vlax-method-applicable-p ob1 'intersectwith)
(vlax-method-applicable-p ob2 'intersectwith)
(setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
)
(repeat (/ (length lst) 3)
(setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
lst (cdddr lst)
)
)
)
(reverse rtn)
)
(setq doc (vla-get-activedocument (vlax-get-acad-object)) mspace (vla-get-modelspace doc))
(setq decplaces (getint "\nNumber of decimal places >"))
(setq th (getreal "\nText height"))
(while (setq e (entsel "\nPick point at contour > "))
(setq pt (cadr e) e (car e) eo (vlax-ename->vla-object e) pt (vlax-curve-getClosestPointTo eo pt))
(setq elev (rtos(vlax-get eo 'Elevation) 2 decplaces))
(setq co(vla-addcircle mspace (vlax-3d-point pt) 2))
(setq ispts (intersections eo co acextendnone))
(vla-delete co)
(setq ang (angle (car ispts) (cadr ispts)))
(if (> ang (/ pi 2)) (setq ang (- ang pi)))
(setq to (vla-AddText mspace elev (vlax-3d-point pt) th))
(vla-put-Alignment to acAlignmentMiddle)
(vla-put-TextAlignmentPoint to (vlax-3d-point pt))
(vla-put-Rotation to ang)
;(acet-textmask-make-wipeout (vlax-vla-object->ename to) 0.5)
(setq ro (strcase (getstring "\nRotate >")))
(if (= (strlen ro ) 1) (command "_.rotate" (vlax-vla-object->ename to) "" pt 180))
(setvar 'cmdecho 0)
;(command "_.trim" (vlax-vla-object->ename to) "" (list (vlax-vla-object->ename eo) pt) "")
(setvar 'cmdecho 1)
)
(princ)
)
(defun c:repelev ( / *error* n pt1 base step e text pt2)
(defun *error* ()
(setvar "cmdecho" 1)
(princ)
)
(setq base (getreal"\n New starting elevation: >")
step (getreal "\n Isohypse step (+ or - value) >:")
)
(setvar "cmdecho" 0)
(princ (strcat "\nSelect isohypse(s) at " (rtos base 2 1) " Press 'Enter' when done): >"))
(while (and (setq ss (ssget)) (> (sslength ss) 0))
(setq i -1)
(while (< (setq i (1+ i)) (sslength ss))
(setq eo (vlax-ename->vla-object (ssname ss i)))
(vlax-put eo 'Elevation base)
(vlax-put eo 'Color 40)
)
(setq base (+ base step))
(princ (strcat "\nSelect isohypse(s) at " (rtos base 2 1) " Press 'Enter' when done): >"))
)
(setvar "cmdecho" 1)
(princ)
)
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.