All texts in the TitleBlock object are stored in the TextBox objects.
- TitleBlock.Definition property -> TitleBlockDefinition object
- TitleBlockDefinition.Sketch property -> DrawingSketch object
- DrawingSketch.TextBoxes Property -> TextBoxes collection
The TextBoxes collection provides access to all the existing TextBox objects in this Sketch.
Here is the VBA snippet that prints texts stored in all TextBoxes in the current TitleBlock
Sub TextBoxesInTitleBlock()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oTitleBlock As TitleBlock
Set oTitleBlock = oSheet.TitleBlock
' Obtain a reference to the title block defintion.
Dim oDef As TitleBlockDefinition
Set oDef = oTitleBlock.Definition
Dim oSketch As DrawingSketch
Set oSketch = oDef.sketch
Dim oTextBoxes As TextBoxes
Set oTextBoxes = oSketch.TextBoxes
Debug.Print "Total number: " & oTextBoxes.Count
Debug.Print "Content: "
Dim i As Integer
Dim St As String
Dim oBox As TextBox
For i = 1 To oTextBoxes.Count
Set oBox = oTextBoxes.Item(i)
St = oBox.Text
'' St = oBox.FormattedText
Debug.Print i, St
Next i
End Sub
Here is the result I got with the newly created drawing sheet:
Total number: 19
Content:
1 <Sheet number>
2 <Sheet Size>
3 <TITLE>
4 <PART NUMBER>
5 State
6 Changes
7 Date
8 Name
9 Drawn
10 Checked
11 Standard
12 Date
13 Name
14 <CREATION DATE>
15 <CHECKED DATE>
16 <ENG APPROVAL DATE>
17 <AUTHOR>
18 <ENG APPROVED BY>
19 <CHECKED BY>
The Sheet size in my title block is stored in the box #2.
So we may save it’s text in the custom iProperty:
iProperties.Value("Custom", "Sheet Size") = oTextBoxes.Item(2).Text
Hope this could help you to develop the iLogic rule that suits your needs.
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network