Message 1 of 13
Not applicable
03-10-2017
09:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want I have a CAD file with DRAWING NUMBER is "HELLO WORLD". Assume that I do not know what the drawing number is "HELLOW WORLD" and I want to get it programmingly, how do I do it? With the help of the community members, I now can search for "DRAWING NUMBER", I have a thought on how to get the "HELLOW WORLD" but not how to translate my thought into code
Thought:
- after I have the TEXT DRAWING NUMBER 's location, I will find the next TEXT below it to get "HELLO WORLD"
Dim doc = Application.DocumentManager.MdiActiveDocument
Dim db = doc.Database
Dim ed = doc.Editor
Using tr = db.TransactionManager.StartTransaction()
Dim model = DirectCast(tr.GetObject(
SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead), BlockTableRecord)
For Each id As ObjectId In model
Select Case id.ObjectClass.DxfName
Case "TEXT"
Dim text = DirectCast(tr.GetObject(id, OpenMode.ForRead), DBText)
If text.TextString = "DRAWING NUMBER" Then
'Do another loop-search below DRAWING NUMBER
End If
Exit Select
End Select
Next
tr.Commit()
End Using
Solved! Go to Solution.