Okie
1) The getSegment function mentioned above will get segment data from both 2D and 3D polylines. I take it that with "line" data you mean vertices comprising a segment?
2) When you say subentities within the crossing polygon, which data are you interested in? If it is merely vertices of 3Dpoly's and lwpoly's then this might get you started:
getCoordinates is a simple example of extracting coordinates from both kinds of polylines (I'm sure there are cleaner and faster methods out there than this)
crossPolygon will use a polyline as a CP selection by calling getCoordinates and pass the coordinates to an SSGET "_CP" function. Beware that self-intersecting polylines will always cause SSGET to return nil.
C:INPOLY will call crossPolygon to get a selection set and run through each member. If a member is a polyline, it'll call getCoordinates to extract the coordinates. The return value is a list of coordinates lists of plines found within the pline. Is that what you're after?
If at all usable then take what you can use, or at least add some error handling. These are just quickly written samples of some generic ideas without much error handling.
Code:
(defun getCoordinates (obj / coords coordlst objname)
(defun getCoords (obj)
(vlax-safearray->list
(vlax-variant-value (vla-get-coordinates obj))))
(cond ((member (setq objname (vla-get-objectName obj))
'("AcDb3dPolyline" "AcDbPolyline"))
(setq coordlst (getCoords obj))
(while coordlst
(cond ((= objname "AcDb3dPolyline")
(setq coords (cons (list (car coordlst) (cadr coordlst)
(caddr coordlst)) coords)
coordlst (cdddr coordlst)))
((setq coords (cons (list (car coordlst) (cadr coordlst)) coords)
coordlst (cddr coordlst)))
)
)
)
)
(reverse coords)
)
(defun crossPolygon (/ ent vertices sset)
(and (setq ent (car (entsel)))
(member (cdr (assoc 0 (entget ent))) '("POLYLINE" "LWPOLYLINE"))
(setq vertices (getCoordinates (vlax-ename->vla-object ent)))
(setq sset (ssget "_CP" vertices))
(ssdel ent sset)
)
sset
)
(defun C:inPoly (/ lst ss a coords)
(cond ((setq ss (crossPolygon))
(setq a 0)
(repeat (sslength ss)
(if (setq coords (getCoordinates (vlax-ename->vla-object (ssname ss a))))
(setq lst (cons coords lst)))
(setq a (1+ a))
)
)
)
(reverse lst)
)