本帖最后由 newer 于 2020-6-27 21:53 编辑
增加进去了点表支持而已,API有N多种方法
 - (defun c:tt ()
- (xdrx-begin)
- (if (setq e (xdrx-entsel
- "\n拾取多段线获取点表<退出>:"
- '((0 . "*polyline"))
- )
- pt (getpoint "\n测试点<退出>:")
- )
- (progn (setq pts (xdrx-getpropertyvalue (car e) "vertices"))
- (setq g (xdge::constructor "kcompositecrv3d" pts)
- near (xdrx-getpropertyvalue g "getclosestpointto" pt t)
- )
- (xdrx-prompt "\nnear=" near)
- (xdrx-sysvar-push '("pdmode" 35))
- (xdrx-point-make near)
- )
- )
- (xdrx-end)
- (princ)
- )
甚至:
(xdrx-getpropertyvalue pts "getclosestpointto" pt) 也行
xdrx-getpropertyvalue 也支持点表
给个点表,也可以查下面各种属性 , API 就是想方设法的方便编程,让代码更短,同时效率更高
命令: (xdrx-getpropertyvalue pts)
------ Geom Entity Method ------
<kCompositeCrv3d>:
Edit Functions:
├───setCurveList
Query Functions:
├───getCurveList
├───getCurveList
├───Vertices
├───Bulges
├───LineSegAt
├───ArcSegAt
├───PointAt
├───BulgeAt
├───isOnlyLines
├───isOnlyArcs
├───hasBulges
├───OnSegAt
├───ToBox
├───NumVerts
├───globalToLocalParam
├───localToGlobalParam
<kCurve3d>:
Bounding Box Functions:
├───boundBlock
├───orthoBoundBlock
Closest Point Functions:
├───closestPointTo
├───projClosestPointTo
Degeneracy Functions:
├───isDegenerate
Distance Functions:
├───distanceTo
Edit Functions:
├───setInterval
Evaluation Functions:
├───evalPoint
Geometric Inquiry Functions:
├───hasEndPoint
├───hasStartPoint
├───isClosed
├───isCoplannarWith
├───isLinear
├───isPeriodic
├───isPlannar
Length Functions:
├───area
├───areaOf
├───length
├───paramAtLength
├───porintAtLength
Parameterization Functions:
├───paramOf
├───reverseParam
Point Containment Functions:
├───isOn
├───orthoProject
├───project
Query Functions:
├───startParam
├───endParam
├───firstdeiv
├───firstderiv-
├───secondDeriv
├───secondDeriv-
├───getClosestPointTo
├───getInterval
├───getLocalClosestPoints
├───getNormalPoint
├───getProjClosestPointTo
├───getSamplePoints
├───getSplitCurves
├───getTrimmedOffset
Subdivide Functions:
├───explode
<kEntity3d>:
Equality Checking Functions:
├───isEqualTo
Point Containment Functions:
├───isOn
Type Identification Functions:
├───isKindOf
├───type
------ DB Entity Method ------
Class AcDbPolyline:
├─ToBox
├─AllInnerAngles
├─AllOuterAngles
├─Angle
├─AngularLineVector
├─AllSegs
├─SegAt
├─ArcSegs
├─ArcSegAt
├─ArcSegIndex
├─LineSegIndex
├─BulgeAt
├─Bulges
├─Elevation
├─ConstantWidth
├─Get
├─LineSegAt
├─Length
├─Lengths
├─HasBulges
├─HasPlinegen
├─HasWidth
├─InAngle
├─IsSelfCrossting
├─isInnerAngle
├─isOuterAngle
├─IsOnlyLines
├─NearIndex
├─Normal
├─NumVerts
├─OnSegAt
├─PointAt
├─PrevNextIndex
├─-Index+
├─SegType
├─SelfIntPoints
├─SelfIntParams
├─Thickness
├─Vertices
├─FeaturePoints
├─WidthsAt
├─StartWidth
├─EndWidth
├─OutLine (NULL or Index or (Index and (Int or Real))
Class AcDbCurve:
├─Area
├─Centroid
├─DistanceTo
├─Divide
├─EndParam
├─EndPoint
├─GetClosestPointTo
├─GetFirstDeriv
├─GetFirstDeriv-
├─GetSecondDeriv
├─GetSecondDeriv-
├─GetPointAtParam
├─GetPointAtDist
├─GetPointsAtDist
├─GetPointsAtDists
├─GetParamAtPoint
├─GetParamAtDist
├─GetDistAtPoint
├─GetDistAtParam
├─GetSamplePoints
├─IsClosed
├─IsOn
├─IsPeriodic
├─MidPoint
├─StartPoint
├─StartParam
├─Length
Class AcDbEntity:
├─9PT
├─Centroid
├─GeomExtents
├─BoundingBox
├─Elevation
├─Color (None or T[real color])
├─ColorIndex (None or T)
├─ECS
├─IsMemoryEntity
├─Layer (None or T or NIL)
├─Layout
├─Linetype (None or T or NIL)
├─LinetypeScale
├─LineWeight
├─Project(Plane Normal T)
├─OrthoProject(Plane T)
├─Plane
├─PlotStyleName
├─StretchPoint
├─Transparency
├─Visibility
Class AcDbObject:
├─ClassName
├─ExtensionDictionary
├─FieldDictionary
├─IsA
├─IsAProxy
├─IsErased
├─IsReallyClosing
├─Handle
├─HasFields
├─HasPersistentReactor
├─MyParent
├─ObjectID
├─Owner
├─xData
|