Try this:
(setq plobj (vlax-ename->vla-object yourEntityName))
(vla-getboundingbox plobj 'minpt 'maxpt)
(command "_.line"
"_none" (list yourXcoord (cadr (vlax-safearray->list minpt)) 0)
"_none" (list yourXcoord (cadr (vlax-safearray->list maxpt)) 0)
""
); command
(setq Ycoord
(cadr
(safearray-value
(variant-value
(vla-intersectwith
(vlax-ename->vla-object (entlast))
plobj
acExtendNone
)
)
)
); cadr
); setq
(entdel (entlast))
I tried extending both objects, with a short Line, but if the Polyline has an arc segment at either end, the extension of that can mean it finds virtual intersection you don't want. That's why I went with getting the Y coordinates from the Polyline's bounding box to draw the temporary vertical Line.
That assumes one such crossing. If the Polyline might be shaped such that there could be more than one, that would take some more playing around with some criterion to choose which one you want.
It puts nil in the Ycoord variable if the X coordinate is beyond the bounding box of the Polyline.
Kent Cooper, AIA