Log in

View Full Version : How to get All Object's name in dwg?



hoa35ktxd
03-30-2010, 10:44 AM
Please help me VBA code.
How can I to get all Object's name in a dwg?
etc: TEXT, MTEXT, DIMENSION, LINE, CIRCLE....
Thanks.

Tommy
03-31-2010, 05:16 AM
Function Aset(iSSetName As String) As AcadSelectionSet
Dim ssetA As AcadSelectionSet
On Error Resume Next
Set ssetA = ThisDrawing.SelectionSets.Add(iSSetName)
If Err.Number <> 0 Then
Set ssetA = ThisDrawing.SelectionSets(iSSetName)
ssetA.Delete
Set ssetA = ThisDrawing.SelectionSets.Add(iSSetName)
Err.Clear
End If
On Error GoTo 0
Set Aset = ssetA
End Function
Sub GetEntities()
Dim Sm As AcadEntity
Dim Alss As AcadSelectionSet
Set Alss = Aset("AllOfThem")
Alss.Select acSelectionSetAll
For Each Sm In Alss
MsgBox Sm.ObjectName
Next
End Sub

hoa35ktxd
03-31-2010, 08:31 AM
Ok, Thank you very much.