y1982_0 发表于 2005-7-25 21:22:00

引线标注

<P></P>
<P>这样的标注怎么用vba实现?</P>

雪山飞狐_lzh 发表于 2005-7-26 10:26:00

http://www.vba.cn/object/acad2004/idh_leader_object.htm

y1982_0 发表于 2005-7-26 10:40:00

<P>这个东东很好,谢谢啦,万分感谢,</P>

y1982_0 发表于 2005-8-5 19:02:00

<P>引线标注时末尾的注释用的是多行文本的形式,如何在程序中确定其字高呢?谢谢,头疼</P>

y1982_0 发表于 2005-8-5 21:01:00

<P>'创建引线标注<BR>Public Function AddLeader()<BR>&nbsp;&nbsp;&nbsp; ' This example creates a leader in model space.<BR>&nbsp;&nbsp;&nbsp; ' The leader is not attached to any annotation object<BR>&nbsp;&nbsp;&nbsp; ' in this example.<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim leaderObj As AcadLeader, MTextObj&nbsp; As AcadMText<BR>&nbsp;&nbsp;&nbsp; Dim points(0 To 8) As Double<BR>&nbsp;&nbsp;&nbsp; Dim leaderType As Integer<BR>&nbsp;&nbsp;&nbsp; Dim annotationObject As AcadObject<BR>&nbsp;&nbsp;&nbsp; Dim textString As String<BR>&nbsp;&nbsp;&nbsp; Dim insertionPoint(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim height As Double<BR>&nbsp;&nbsp;&nbsp; Dim width As Double<BR>&nbsp;&nbsp;&nbsp;&nbsp;dim str as string</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; str=100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; ' Define the new MText object<BR>&nbsp;&nbsp;&nbsp; textString = "大概可能" &amp; str<BR>&nbsp;&nbsp;&nbsp; insertionPoint(0) =&nbsp; 10: insertionPoint(1) =&nbsp; 13: insertionPoint(2) = 0</P>
<P>'&nbsp;&nbsp;&nbsp; height = 1.8<BR>&nbsp;&nbsp;&nbsp; width = 10<BR>&nbsp;&nbsp;&nbsp; ' Create the MText object in model space<BR>&nbsp;&nbsp;&nbsp; Set MTextObj = ThisDrawing.ModelSpace.AddMText(insertionPoint, width, textString)<BR>&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; points(0) = 0: points(1) = 0: points(2) = 0<BR>&nbsp;&nbsp;&nbsp; points(3) = 10: points(4) =&nbsp; 10: points(5) = 0<BR>&nbsp;&nbsp;&nbsp; points(6) = 11: points(7) =&nbsp; 10: points(8) = 0<BR>&nbsp;&nbsp;&nbsp; 'leaderType = acLineWithArrow<BR>&nbsp;&nbsp;&nbsp; leaderType = acLineNoArrow<BR>&nbsp;&nbsp;&nbsp; Set annotationObject = MTextObj<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' Create the leader object in model space<BR>&nbsp;&nbsp;&nbsp; Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)<BR>&nbsp;&nbsp;&nbsp; ZoomAll<BR>&nbsp;&nbsp;&nbsp; <BR>End Function<BR>这是我写的函数,高手看看怎么改变字高,默认是2.5</P>
<P>,改成1.8,</P>

y1982_0 发表于 2005-8-6 09:52:00

<P>我发现points(8)这个点组中,最后三位即6,7,8确定的点对引线标注没有影响,关键是怎么调整好多行文本的字高和字宽,还是希望能有办法调整这个字高,希望有高手给看看!</P>

pen_1983 发表于 2005-8-11 10:42:00

可以在定义的时候就调整它的高度,height = 1.8<BR>&nbsp;&nbsp;&nbsp; width = 10<BR>就在这个里面定义,检查以下美观就OK了

y1982_0 发表于 2005-8-11 19:10:00

谢谢,知道了,把多行文本字高设置一下MTextObj.height = 1.8,然后调整点的位置就可以满足要求
页: [1]
查看完整版本: 引线标注