Sub getlength() Dim obj As AcadEntity Dim pnt As Variant ThisDrawing.Utility.GetEntity obj, pnt, "请选择道路中线:" Dim leng As Double leng = getcurvelength(obj) MsgBox "所选曲线的长度为" & leng, , "acad2000x"
End Sub
'2005.0816调试未成功 Public Function getcurvelength(curve As AcadEntity) As Double Dim obj As VLAX, retval Set obj = New VLAX obj.EvalLispExpression "(setq curve(handent " & Chr(34) & curve.Handle & Chr(34) & "))" obj.EvalLispExpression "(setq curvelength(vlax-curve-getDistAtParam curve " & -" (vlax-curve-getEndParam curve)))" retval = obj.GetLispSymbol("curvelength") obj.NullifySymbol "curve", "curvelength" Set obj = Nothing getcurvelength = CDbl(retval) End Function
我想获得曲线的长度,使用你的vals类和上面的程序进行调试时,提示类型不一致,请
赐教,谢谢了 |