xuxun616 发表于 2007-2-2 08:56:00

帮解决下问题,不甚感激

<p><font color="#ff0000">程序的目的是希望分解每个图元后,将其再重新还原到原层</font></p><p><font color="#ff0000">问题一:我想调用最下边这个explodere是否正确</font></p><p><font color="#ff0000">问题二;和昨天问的一样,怎么解决图元分解为题(不是块)element.explode不行用什么其他的方法正确</font></p><p><font color="#ff0000">刚开始学vb,用vba做东ix,这个是我写的程序,有很多问题,希望高手解决下,不甚感激</font></p><p>Private Sub explode()<br/>On Error Resume Next<br/>Dim sset As AcadSelectionSet<br/>If Not IsNull(ThisDrawing.SelectionSets.Item("all")) Then<br/>&nbsp;&nbsp; Set sset = ThisDrawing.SelectionSets.Item("all")<br/>&nbsp;&nbsp; sset.Delete<br/>End If<br/>Set sset = ThisDrawing.SelectionSets.Add("all")<br/>Dim filtertype(0 To 8) As Integer<br/>Dim filterdata(0 To 8) As Variant<br/>filtertype(0) = 8: filterdata(0) = "AERTAL"<br/>filtertype(1) = 8: filterdata(1) = "BURIED"<br/>filtertype(2) = 8: filterdata(2) = "HICAP"<br/>filtertype(3) = 8: filterdata(3) = "KANDBASE"<br/>filtertype(4) = 8: filterdata(4) = "NOTE"<br/>filtertype(5) = 8: filterdata(5) = "SYSTEM"<br/>filtertype(6) = 8: filterdata(6) = "TELCO_BOUNDARY"<br/>filtertype(7) = 8: filterdata(7) = "TERMINAL"<br/>filtertype(8) = 8: filterdata(8) = "BORDERSTAMP"<br/>sset.Select acSelectionSetAll, , , filtertype, filterdata<br/>Dim element As AcadEntity<br/>Dim layername As Variant<br/>For Each element In sset<br/>&nbsp;&nbsp;&nbsp; layername = element.Layer<br/>&nbsp;&nbsp;&nbsp; Select Case layername<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "AERTAL"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "BURIED"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font></p><p><font color="#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>&nbsp;Case "HICAP"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "KANDBASE"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "NOTE"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "SYSTEM"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "TELCO_BOUNDARY"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "TERMINAL"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "BORDERSTAMP"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">Call explodere(element)</font><br/>&nbsp;&nbsp;&nbsp; End Select<br/>Next<br/>sset.Delete<br/>End Sub<br/></p><p><font color="#ff0000">//希望分步执行的时候调用他</font></p><p>Private Sub explodere(element)<br/>'分解该元素<br/>element.explode<br/>'将层反回<br/>element.Layer = layername<br/>End Sub<br/></p><p>程序的目的是希望分解每个图元后,将其再重新还原到原层</p><p>问题一:我想调用最下边这个explodere是否正确</p><p>问题二;和昨天问的一样,怎么解决图元分解为题(不是块)element.explode不行用什么其他的方法正确</p>
页: [1]
查看完整版本: 帮解决下问题,不甚感激