Code:
(vl-load-com)
;;This function loads the extended AutoLISP functions
;;provided with Visual LISP. The Visual LISP extensions
;;implement ActiveX and AutoCAD reactor support through
;;AutoLISP, and also provide ActiveX utility and data
;;conversion functions, dictionary handling functions,
;;and curve measurement functions.
;;Function jwaGetDis
;;Returns the Distamce of a point on a curve (myPline)
;;that is nearest to the specified point(myPoint need to be in WCS)
;;myPline is the entiyname of a line, arc, pline, ellipse, spline
(defun jwaGetDis( myPline myPoint)
(distance (vlax-curve-getclosestpointto myPline mypoint) myPoint)
)
;;use to test the jwaGetDis function
;;use the command jwaTestGetDis
;;will ask for a point
;;and a curve object
;;then run the jwaGetDis funtion
(defun c:jwaTestGetDis()
(setq pt (getpoint "\nPoint: "))
(setq pline (car (entsel "\nSelect object: ")));can be any line, arc, pline, ellipse, spline
(jwaGetDis pline pt)
)
Here a list of the Curve Object that can be use with the jwaGetDis funtion
Note: it List the ADT Object thaty can be use
AcDbCurve
AcDb2dPolyline
AcDb3dPolyline
AcDbArc
AcDbCircle
AcDbEllipse
AcDbLeader
AcDbLine
AcDbCommonEdgeLine
AcDbPolyline
AcDbRay
AcDbSpline
AcDbHelix
AcDbXline
AecDbEntity
AecDbAnnotationBase
AecDbBreakMarkObject
AecDbCalloutObject
AecDbTitleMarkObject
AecDbDebugEnt
AecDbGeo
AecDb2dSection
AecDbBlockRef
AecDbEntRef
AecDbMaskBlockRef
AecDbMvBlockRef
AecDbCamera
AecDbClipVolRes
AecDbBdgSection
AecDbDisplayTheme
AecDbEditInPlaceProfile
AecDbLayoutTool
AecDbCellLayoutTool
AecDbGridAssembly
AecDbCurtainWallLayout
AecDbCurtainWallUnit
AecDbWindowAssembly
AecDbLayoutGrid2d
AecDbCeilingGrid
AecDbColumnGrid
AecDbPolygon
AecDbVolumeLayoutTool
AecDbLayoutGrid3d
AecDbSpace
AecDbClipVol
AecDbBdgElevLine
AecDbBdgSectionLine
AecDbLayoutCurve
AecDbSlice
AecsDbMember
AecDbPoint
AecDbMassElem
AecDbMassGroup
AecDbScheduleTable
AecDbAddZoneDefinition
AecDbOpeningBase
AecDbOpenFiller
AecDbDoor
AecDbWindow
AecDbOpening
AecDbRailing
AecDbRoof
AecDbSlabBase
AecDbRoofSlab
AecDbSlab
AecDbSpaceBoundary
AecDbStair
AecDbWall
AecDbZone
AecDbAddAreaGroupDefinition
AecDbArea
AecDbAreaGroup
AecDbDimensionGroup
AecDbKeyNoteLegendObject
AecDbKeyNoteObject
AecDbScheduleTagObject