如何查找和统计这些块?
<p><font face="宋体" color="#ff0066" size="3">在我的图形中含有多个(上百个)名为“zPanel”的块,</font></p><p><font face="宋体" color="#ff0066" size="3">块中有图号“DrawNO”/色卡“Color”/长度“Len”/宽度“Width”等属性,</font></p><p><font face="宋体" color="#ff0066" size="3">怎么样才能将这些统计数据写入DBF文件中。(已建有相同字段的D:\CYC\DeckP.dbf文件)</font></p> <p>Sub Example_Select_text() '低等级表形式<br/> <br/> Dim ssetObj As AcadSelectionSet<br/> Dim CONUT As Integer<br/> CONUT = 0<br/> Count = ThisDrawing.SelectionSets.Count<br/> For I = 0 To Count - 1 '删除所有的选择集<br/> Set ssetObj = ThisDrawing.SelectionSets.Item(0)<br/> ssetObj.Delete<br/> Next I<br/> <br/> Dim sjx, dmx As AcadSelectionSet<br/> <br/> <br/> Dim FilterType(1) As Integer<br/> Dim FilterData(1) As Variant<br/> Set sjx = ThisDrawing.SelectionSets.Add("sjx")<br/> Set dmx = ThisDrawing.SelectionSets.Add("dmx")</p><p> FilterType(0) = 2<br/> FilterData(0) = "TK" '是块名</p><p> 'FilterType(1) = 62<br/> 'FilterData(1) = 10 '颜色是3</p><p> FilterType(1) = 8<br/> FilterData(1) = "0" '图层是0<br/> <br/> Dim mode As Integer<br/> Dim doc2 As AcadDocument<br/> Set doc2 = ThisDrawing.ModelSpace.Document<br/> <br/> mode = acSelectionSetAll<br/> 'sjx.Select mode, , , FilterType, FilterData<br/> sjx.SelectOnScreen FilterType, FilterData '得到图框<br/> Dim newvarAttributes, inpoint, entry1 As Variant<br/> Dim ss, sss, ssss As String<br/> Dim sjxcount As Integer<br/> sjxcount = sjx.Count<br/> <br/> Dim templateFileName As String<br/> Dim DOC1 As AcadDocument<br/> ReDim objects(sjxcount - 1) As AcadEntity<br/> Dim retObjects As Variant<br/> Dim minExt As Variant<br/> Dim maxExt As Variant</p><p> <br/> <br/> For Each ENTRY In sjx</p><p> newvarAttributes = ENTRY.GetAttributes '得到图框块的属性,即图名图号页码<br/> <br/> ENTRY.GetBoundingBox minExt, maxExt '得到图框的最大最小坐标<br/> mode = acSelectionSetWindow 'acSelectionSetPrevious 'acSelectionSetCrossing<br/> ThisDrawing.Application.ZoomWindow minExt, maxExt<br/> <br/> dmx.Select mode, minExt, maxExt '选择图框内的对象<br/> <br/> ReDim objects(dmx.Count - 1) As AcadEntity<br/> I = 0<br/> For Each entry1 In dmx<br/> Set objects(I) = entry1<br/> I = I + 1<br/> Next entry1<br/> Set DOC1 = Documents.Add<br/> doc2.CopyObjects objects, DOC1.ModelSpace '拷贝对象到新文件中<br/> ThisDrawing.Application.ZoomWindow minExt, maxExt<br/> <br/> DOC1.SaveAs doc2.Path & "\" & newvarAttributes(1).TextString & "(" & newvarAttributes(2).TextString & ")" & newvarAttributes(0).TextString<br/> DOC1.Close<br/> <br/> dmx.Clear<br/> Next ENTRY<br/> </p><p> <br/> <br/>End Sub<br/></p><p>这个功能是实现把0层按块名为“TK”的块,把一张图会成多张。在存文件名时。用到了属性,</p><p>你仔细看下吧。应可以满足你的要求。</p><p></p><p></p> <font color="#ff0033">十分感谢您的回复,我会认真地研究您提供的源码,谢谢!</font> <p><font color="#ff0066">我已经顺利的将图块中的属性提取出来,但如何才能形成Visual Foxpro6.0识别的DBF文件?</font></p>
页:
[1]