yg545france 发表于 2010-2-5 07:08:00

如何返回选择集中多义线对象的端点坐标

<p>&nbsp;</p><p>'通过ThisDrawing.Utility.GetEntity返回多义线上个点的坐标,该多义线由用户选&nbsp;&nbsp; <br/>Dim oEnt As AcadEntity </p><p>ThisDrawing.Utility.GetEntity oEnt, pt, "Select a polyline"</p><p>If TypeOf oEnt Is AcadLWPolyline Then&nbsp; </p><p>&nbsp;&nbsp;&nbsp; get2Dpts = oEnt.Coordinates<br/>endif</p><p><br/>'通过选择集方法,选中若干多义线对象,遍历返回每一个多义线对象的个点坐标时,返回个点的坐标都不正确。选择集中对象的数量也不正确。不知道如何解决,请大侠指教。</p><p>Dim oEnt As Object<br/>Dim get2Dpts As Variant</p><p>On Error Resume Next<br/>If Not IsNull(ThisDrawing.SelectionSets.Item("SS2")) Then<br/>Set sstext = ThisDrawing.SelectionSets.Item("SS2")<br/>CreateSelectionSet.Delete<br/>End If</p><p>Set sstext = ThisDrawing.SelectionSets.Add("SS2")</p><p>&nbsp;&nbsp; 'FilterType(0) = 0<br/>&nbsp;&nbsp; 'FilterData(0) = "LWpolyline"<br/>&nbsp;&nbsp; 'sstext.SelectOnScreen FilterType, FilterData</p><p>sstext.SelectOnScreen</p><p>For Each oEnt In sstext </p><p>&nbsp; If (TypeOf oEnt Is AcadLWPolyline) Then<br/>&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp; get2Dpts = oEnt.Coordinates</p><p>next</p>

yg545france 发表于 2010-2-6 19:24:00

<p>终于解决了。</p><p>For Each oEnt In sset&nbsp; </p><p>'ThisDrawing.Utility.GetEntity oEnt, pt, "Select a polyline"&nbsp;&nbsp;&nbsp;&nbsp; </p><p>If TypeOf oEnt Is AcadLWPolyline Then&nbsp;</p><p>&nbsp;&nbsp;&nbsp; get2Dpts = oEnt.Coordinates&nbsp; '得到点的坐标</p>
页: [1]
查看完整版本: 如何返回选择集中多义线对象的端点坐标