[VBA]怎样获取选择集内点的坐标
怎样获取选择集内点的坐标On Error Resume Next<BR> <BR> Dim FilterType As Variant '<BR> Dim FilterData As Variant '<BR> Dim Fdata(0) As Variant '<BR> Dim Ftype(0) As Integer '<BR> Dim XYH As Variant<BR> Dim Sel As AcadSelectionSet '选择集<BR> Dim Obj As AcadObject '<BR> Dim Fill As String<BR> <BR> Fill = "D:\xyh.dat"<BR> Open Fill For Output As #1<BR> <BR> Set Sel = ThisDrawing.SelectionSets.Add("ssel")<BR> If Err Then<BR> Err.Clear<BR> ThisDrawing.SelectionSets("ssel").Delete<BR> Set Sel = ThisDrawing.SelectionSets.Add("ssel")<BR> End If<BR> <BR> Ftype(0) = 0<BR> Fdata(0) = "Point"<BR> FilterType = Ftype<BR> FilterData = Fdata<BR> Sel.Select acSelectionSetAll, , , FilterType, FilterData<BR> <BR> For Each Obj In Sel<BR> If Obj.ObjectName = "Point" Then '如果是点则输入到文件<BR> XYH = Point '这里应该怎样编写程序<BR> <BR> Print #1, XYH(0); " ,"; XYH(1); " ,"; XYH(2)<BR> End If<BR> Next<BR> Close #1
<BR> 1. 既然已经使用过滤器过滤出“点”,则后面不再需要判断选择集中的对象是否为“点”。<BR>2. 判断点对象的对象名称应该是“AcDbPoint”,而不是Point。<BR>3. 点对象的点坐标可以通过XYH = Obj.Coordinates 取得。
页:
[1]