[求助]大虾们,用VB怎么取得在cad中一个对象的特性
我想用VB取出在cad中选中的对象的特性,包括“坐标”等值,我不知道怎样取出来,请各位高手教教我,我等着急用 大哥,我也很想知道啊!!!!!!!! 那就先定义一个选择集,然后将那个加入选择集中,然后察看那个对象的属性,就可以了 取坐标的程序片断:注明:CurZjFwObj为选择集当前对象
numNodes = (UBound(CurZjFwObj.Coordinates) + 1) / 3 '针对IAcadPolyline<BR> ReDim myCoordsys(numNodes * 3 - 1)<BR> myTempCoords = CurZjFwObj.Coordinates '该句是关键<BR> For I = 0 To numNodes - 1<BR> myCoordsys(I) = myTempCoords(I * 3)<BR> myCoordsys(I + 1) = myTempCoords(I * 3 + 1)<BR> myCoordsys(I + 2) = myTempCoords(I * 3 + 2)<BR> Next 谢谢各位的支持,不过我想问一下<A name=29178><FONT color=#000066><B>hangc</B></FONT></A>能不能取得任意对象的坐标。我取的是圆的圆心坐标,可怎么取也取不出,而且我的选择集里也没有Coordinates属性。
下面是我写的取坐标的按钮代码,我这取写就是取不出来坐标。希望哪位救救我
Private Sub Command7_Click()<BR> Dim sst As AcadSelectionSet<BR> Dim acadDc As Object<BR> <BR> Set acadDc = acadapp.ActiveDocument<BR> <BR>On Error Resume Next
If Not IsNull(acadDc.SelectionSets.Item("ss2")) Then<BR> Set sst = acadapp.ActiveDocument.SelectionSets.Add("ss2")<BR> sst.SelectOnScreen<BR>End If
MsgBox sst.Count & "个对象被选择"
<BR>For i = 0 To sst.Count - 1<BR> MsgBox "对象是:" & sst.Item(i).ObjectName & Chr(13) & "坐标是:"<BR>Next
<BR>sst.Delete<BR>End Sub <DIV>你这样肯定不行的啊</DIV>
<DIV> </DIV>
<DIV>For i = 0 To sst.Count - 1<BR> '''你要遍历选择集中的每个实体,如果为圆,则取出圆心</DIV>
<DIV>'''如下列语句</DIV>
<DIV>Dim centerPoint As Variant<BR> centerPoint = circObj.center<BR> MsgBox "The center point of the circle is " & centerPoint(0) & ", " & centerPoint(1) & ", " & centerPoint(2), vbInformation, "Center Example"<BR></DIV>
<DIV> </DIV>
<DIV>Next</DIV> 太谢谢各位了!有空我请吃饭 谢了
页:
[1]