langzf2003 发表于 2005-1-7 22:49:00

如何从DRAWING获取文本的坐标和内容

小弟初学编程,现在工作中需要把CAD图纸中的文本读出并放入表格,需要得到文本的内容和文本的坐标,


Dim sset As AcadSelectionSet<BR>Set sset = ActDocument.SelectionSets.Add("S")


sset.SelectOnScreen


For Each Entry In sset


       这中间我应怎么办?<BR>Entry.Update<BR>Next


请各位高手指教,万分感激!!!!

王咣生 发表于 2005-1-8 00:03:00

Dim i As Integer


For i = 0 To ssetObj.Count - 1


       Dim ent As AcadEntity


       Set ent = ssetObj.Item(i)


       If ent.ObjectName = "AcDbText" Then


                       Dim textObj As AcadText


                       Set textObj = ent


                       ...


       End If


Next

sieben 发表于 2005-1-8 00:12:00

建议使用过滤器


Dim Select1 As AcadSelectionSet<BR>FilterType(0) = 0: FilterData(0) = "TEXT"<BR>Select1.SelectOnScreen FilterType, FilterData


Dim textobj As AcadText<BR>Dim Text_String As String<BR>Dim Text_InsertPoint As Variant


下面为TEXT文本的内容和坐标,注意只对应于DTEXT而不包括MTEXT


Text_String = textobj.TextString<BR>Text_InsertPoint = textobj.InsertionPoint
页: [1]
查看完整版本: 如何从DRAWING获取文本的坐标和内容