Visual Lisp LWPolyline Vertex

I'm trying to display details about a lwpolyline at the vertices ... specifically describing them as Begin Curve, Point of Intersection, or End Curve but do not have any idea how to move forward.
Currently I'm inserting blocks at the vertices with a distance from the beginning without the description (see image) .... any help is appreciated :-)

(setq lVerts (vlax-get vPL "Coordinates"))
(setq nVerts (/ (length lVerts) 2))

(while (< nCurVert nVerts)
(setq pInsert (vlax-curve-getPointAtParam vPL nCurVert))
(setq nRot (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv vPL (vlax-curve-getParamAtPoint vPL pInsert))))
(setq nRot (+ nRot (/ pi 2)))
(setq sStation (HASD:FORMATSTATION (+ nBsta (vlax-curve-getDistAtPoint vPL (vlax-curve-getClosestPointTo vPL pInsert)))))
(setq bref (vla-insertblock mspace pInsert sBlock nHScale nHScale nHScale nRot))

...

Comments

  • vla-getbulge was the critical piece I was missing ... it is working pretty well now. I still have to clean up some of the code, add comments, and assign the variables ...

    (defun HASD:VertLabels ( / )

    (setq sBlock "c:\cadd_support\shared\blocks\Station Label.dwg")

    (setq sEName (car (entsel "\nSelect Alignment > ")))
    (setq vPL (vlax-ename->vla-object sEName))

    (setq nBSta (HASD:GetAlignmentStation vPL))

    (setq nIndex 0)
    (setq lVerts (vlax-get vPL "Coordinates"))
    (setq nVerts (/ (length lVerts) 2))

    (while (< nIndex nVerts); number of vertices

    (setq pInsert (vlax-safearray->list (vlax-variant-value (vla-get-coordinate vPL nIndex))))
    (setq nNow (vla-getbulge vPL nIndex))
    
    (if (> nIndex 0)
      (progn
        (setq pBefore (vlax-safearray->list (vlax-variant-value (vla-get-coordinate vPL (- nIndex 1)))))
        (setq nBefore (vla-getbulge vPL (- nIndex 1)))
      )
    )
    
    (cond
      ((= nIndex 0)
        (setq sSuffix " BP")
      )
      ((= nIndex (- nVerts 1))
        (setq sSuffix " EP")
      )
      ((AND (= nBefore 0) (= nNow 0))
        (setq sSuffix " PI")
      )
      ((AND (/= nBefore 0) (= nNow 0))
        (setq sSuffix " EC")
      )
      ((AND (/= nBefore 0) (/= nNow 0))
        (setq sSuffix " RC")
      )
      ((AND (= nBefore 0) (/= nNow 0))
        (setq sSuffix " BC")
      )
    )
    
    (setq nRot (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv vPL (vlax-curve-getParamAtPoint vPL pInsert))))
    (setq nRot (+ nRot (/ pi 2)))
    (setq sStation (HASD:FORMATSTATION (+ nBsta (vlax-curve-getDistAtPoint vPL (vlax-curve-getClosestPointTo vPL pInsert)))))
    (setq sOffset (rtos (distance (vlax-curve-getClosestPointTo vPL pInsert) pInsert) 2 2))
    (setq bref (vla-insertblock mspace pInsert sBlock *nHScale* *nHScale* *nHScale* nRot))
    
    (LM:CHANGEATTRTEXT bref "STATION" (strcat sStation sSuffix))
    
    (LM:SETDYNPROP bref "Separator" 32)
    (LM:SETDYNPROP bref "Position1 X" 10)
    (LM:SETDYNPROP bref "Symbol" "Circle")
    
    (setq nIndex (+ nIndex 1))
    

    )

    (princ) ;exit quietly

    )