求vba代码:给定曲线上任意点坐标计算改点到曲线起点的距离
希望使用VLAX类或纯VBA代码计算曲线上任意一点(坐标已知)到曲线起点的距离,向高人请教!! '自定义函数 返回顺着曲线长度方向任一点的距离Public Function GetDistanceAtPoint(ByVal mvarEntity As AcadEntity, ByVal Point As Object) As Double
Dim objVLAX As New vlax, retval As Object
objVLAX.SetLispSymbol("d", Point)
objVLAX.EvalLispExpression("(setq ent (handent " & Chr(34) & mvarEntity.Handle & Chr(34) & "))")
objVLAX.EvalLispExpression("(setq pt (vlax-curve-getDistAtPoint ent d))")
retval = objVLAX.GetLispList("pt")
objVLAX.NullifySymbol("ent", "d", "pt")
MsgBox(retval)
GetDistanceAtPoint = retval
objVLAX = Nothing
End Function
返回结果为空值 vba 的用法举个例子 vlax的挺方便啊。 没有通用的方法。取决于特定的曲线(曲线类型、参数),了解特性才能计算长度
除非你复制,该点截断,然后再查询长度属性
页:
[1]