-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPROMPTED_SCALE.ILOGICVB
More file actions
43 lines (34 loc) · 1.54 KB
/
PROMPTED_SCALE.ILOGICVB
File metadata and controls
43 lines (34 loc) · 1.54 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
' If iProperties.Value("Custom", "Scale") = "" Then
' iProperties.Value("Custom", "Scale")= "NTS"
' End If
For Each viewX As DrawingView In sheetX.DrawingViews
If (Not String.IsNullOrEmpty(viewX.ScaleString)) Then
scaleString = viewX.ScaleString
If iProperties.Value("Custom", "Scale") <> "NTS" Then
iProperties.Value("Custom", "Scale")=scalestring
Else
scalestring = "NTS"
End If
Exit For
End If
Next
On Error Resume Next
titleBlockX.SetPromptResultText(scaleTextBox, scaleString)
Next
InventorVb.DocumentUpdate()
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