yuangw1234 发表于 2006-4-9 21:44:00

请教提取块的中心的方法

<P>请问各位大师:</P>
<P>本人写了下面一个程式就是想通过框选一个块来取得块的圆心,然后在这圆心处画一个螺丝孔(其中选择的块是圆组成的),但结果不行,如果将块换成是一个圆,则可以用</P>
<P>selobj.center属性来取得圆心,请老手指点怎么可以取得由圆组成的块的圆心,多谢!</P>
<P>Public Sub c(layerr As String)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>Dim ssetobj1 As AcadSelectionSet<BR>Dim icount1 As Integer<BR>icount1 = ThisDrawing.SelectionSets.Count<BR>While (icount1 &gt; 0)<BR>&nbsp;&nbsp;&nbsp; If ThisDrawing.SelectionSets.Item(icount1 - 1).Name = "yuan" Then<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.SelectionSets.Item(icount1 - 1).Delete<BR>&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; icount1 = icount1 - 1<BR>&nbsp;&nbsp;&nbsp; Wend<BR>&nbsp;&nbsp;&nbsp; Set ssetobj1 = ThisDrawing.SelectionSets.Add("yuan")<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.Prompt "please select object"<BR>&nbsp;&nbsp;&nbsp; ssetobj1.SelectOnScreen<BR>&nbsp; Dim i1 As Integer<BR>&nbsp; Dim selobj1 As Acadblock<BR>&nbsp; For i1 = 0 To ssetobj1.Count - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set selobj1 = ssetobj1.Item(i1)<BR>&nbsp;&nbsp;dim pt as&nbsp;double</P>
<P>dim circ as acadcircle</P>
<P>pt=selobj1.center</P>
<P>set circ = thisdrawing.modelspace.addcircle(pt,10)</P>
<P><BR><BR>&nbsp; Next</P>

雪山飞狐_lzh 发表于 2006-4-10 11:04:00

<P>块里有几个圆?每个圆都要取圆心?发个块的图样上来最好</P>

yuangw1234 发表于 2006-4-10 11:52:00

<P>有两个不同心的圆</P>
页: [1]
查看完整版本: 请教提取块的中心的方法