Hi, I found navigating around this incredible routine teacher lee-mac, it works great, but I have a doubt in the dwg file I uploaded is a point that fails, or the point is within the routine but says this outside, maybe someone can tell me why? thanks
;; Point Inside-p - Lee Mac
;; Utilises a ray-casting algorithm to determine whether a
;; given point (WCS) resides within a supplied object.
(defun LM:PointInside-p ( pt obj / lst ray )
(setq lst
(vlax-invoke
(setq ray
(vla-addray
(vla-objectidtoobject (vla-get-document obj) (vla-get-ownerid obj))
(vlax-3D-point pt)
(vlax-3D-point (mapcar '+ pt '(1.0 0.0 0.0)))
)
)
'intersectwith obj acextendnone
)
)
(vla-delete ray)
(= 1 (logand 1 (length lst)))
)
(defun c:test ( / ent obj pnt )
(if (setq ent (car (entsel "\nSelect Polyline: ")))
(if (vlax-method-applicable-p (setq obj (vlax-ename->vla-object ent)) 'intersectwith)
(while (setq pnt (getpoint "\nPick Point: "))
(if (LM:PointInside-p (trans pnt 1 0) obj)
(alert "Point is INSIDE")
(alert "Point is OUTSIDE")
)
)
(princ "\nInvalid Object selected.")
)
)
(princ)
)
(vl-load-com) (princ)
see attached dwg file