怎么删除特点条件的多段线呢?
比如我要删除4条边的封闭多段线。谢谢啦 过滤出只有封闭的多段线,然后判断多段线是否为4个顶点,如果是则删除。 hehe ~~谢谢Dim pl As AcadEntity<BR>Dim sss As AcadSelectionSet<BR>Set sss = ThisDrawing.SelectionSets.Add("123")<BR>Dim Gpcode(0) As Integer<BR>Gpcode(0) = 0<BR>Dim Datavalue(0) As Variant<BR>Datavalue(0) = "lwpolyline"<BR>sss.Select acSelectionSetAll, , , Gpcode, Datavalue<BR>MsgBox sss.count<BR>For Each pl In sss<BR> If (UBound(pl.Coordinates) + 1) / 2 = 4 Then<BR> pl.Delete<BR> End If<BR>Next 你获取的多段线是模型空间最后3个,不需要建选择集 哦
这个呢 炸开轮廓线并保存到选择集
Dim explodedObjects As Variant<BR>Dim outlinearr() As Variant<BR>Dim outliness As AcadSelectionSet<BR>Set outliness = ThisDrawing.SelectionSets.Add("ss")<BR>explodedObjects = plent.Explode<BR>For j = 0 To UBound(explodedObjects) - 1<BR> explodedObjects(j).Update<BR> <FONT color=#d52b2b>Set outlinearr(j) = explodedObjects(j) 'subscript out of range ?????</FONT><BR> explodedObjects(j).Update<BR>Next<BR>outliness.AddItems outlinearr <FONT color=#d52b2b>redim一下</FONT>
<P class=syntax>RetVal = object.Explode
<P class=element>Object
<P class=element-desc><A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_3dpoly_object.htm" target="_blank" >3DPolyline </A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_blockref_object.htm" target="_blank" >BlockRef</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_lightweightpolyline_object.htm" target="_blank" >LightweightPolyline</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_minsertblock_object.htm" target="_blank" >MInsertBlock</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_polygonmesh_object.htm" target="_blank" >Polygonmesh</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_polyline_object.htm" target="_blank" >Polyline</A>, <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_region_object.htm" target="_blank" >Region</A><BR>The object or objects this method applies to.
<P class=element>RetVal
<P class=element-desc>Variant (array of objects)<BR>The array of exploded objects.
<P class=element-desc>或直接用
<P class=element-desc>dim a as Variant
<P class=element-desc>a=pPline.Explode 这也有问题?
outliness.AddItems outlinearr
说 Invalid argument pselset in additems 我这样没问题呀
Sub test()<BR>Dim a As Variant<BR>a = ThisDrawing.ModelSpace(0).Explode<BR>Dim ss As AcadSelectionSet<BR>Set ss = ThisDrawing.ActiveSelectionSet<BR>ss.AddItems a<BR>MsgBox ss.Count<BR>ss.Clear<BR>End Sub<BR> 你的可以
发现炸开以后pline还在 一个Bug,块引用也一样
要在Explode方法后调用Delete方法干掉它
页:
[1]