关于AUTOCAD VBA二次开发教程第87页那道题目的出错提出
<P>Public Sub CreateCircleToText()<BR> Dim objText As AcadText<BR> Dim ptPick As Variant<BR> ThisDrawing.Utility.GetEntity objText, ptPick, "拾取文字:"<BR> <BR> ' 获得文字的包围框<BR> Dim ptMin As Variant, ptMax As Variant<BR> objText.GetBoundingBox ptMin, ptMax<BR> <BR> ' 获得圆心和半径<BR> Dim ptCenter(0 To 2) As Double<BR> ptCenter(0) = (ptMin(0) + ptMax(0)) / 2<BR> ptCenter(1) = (ptMin(1) + ptMax(1)) / 2<BR> ptCenter(2) = 0<BR> Dim radius As Double<BR> radius = Sqr((ptMin(0) - ptMax(0)) ^ 2 + (ptMin(1) - ptMax(1)) ^ 2) / 2<BR> <BR> ' 创建圆<BR> Dim objCircle As AcadCircle<BR> Set objCircle = ThisDrawing.ModelSpace.AddCircle(ptCenter, radius)<BR>End Sub</P><P>最后运行结果是弹出一个MSGBOX,提示"类型不匹配"</P> objText定义为AcadText,所以选择的只能是单行文字。检查一下是不是这儿出错了。 恩,说的是,昨天和你一起出书的同志已经帮我解决了问题,谢谢王老哥
页:
[1]