forked from mspace912/iLogic-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrompted_Scale.txt
More file actions
26 lines (24 loc) · 1.19 KB
/
Prompted_Scale.txt
File metadata and controls
26 lines (24 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Sub Main()
Dim drawingDoc As DrawingDocument = TryCast(ThisDoc.Document, DrawingDocument)
For Each sheetX As Sheet In drawingDoc.Sheets
If (sheetX.TitleBlock Is Nothing) Then Continue For
Dim titleBlockX As TitleBlock = sheetX.TitleBlock
Dim scaleTextBox As TextBox = GetScaleTextBox(titleBlockX.Definition)
Dim scaleString As String = String.Empty
For Each viewX As DrawingView In sheetX.DrawingViews
If (Not String.IsNullOrEmpty(viewX.ScaleString)) Then
scaleString = viewX.ScaleString
Exit For
End If
Next
titleBlockX.SetPromptResultText(scaleTextBox, scaleString)
Next
End Sub
Function GetScaleTextBox(ByVal titleDef As TitleBlockDefinition) As TextBox
For Each defText As TextBox In titleDef.Sketch.TextBoxes
If (defText.Text.IndexOf("<Scale>", StringComparison.OrdinalIgnoreCase) >= 0) Then
Return defText
End If
Next
Throw New ArgumentException("No prompted entry string containing <Scale> was found in the title block definition: " & titleDef.Name)
End Function