czlj2008 发表于 2005-8-16 19:39:00

请教斑竹VLAX问题

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