Need Small Changes in Base Scale

Need Small Changes in Base Scale

k14348
Advocate Advocate
313 Views
2 Replies
Message 1 of 3

Need Small Changes in Base Scale

k14348
Advocate
Advocate

SyntaxEditor Code Snippet

Sub Main()
Dim drawingDoc As DrawingDocument = TryCast(ThisDoc.Document, DrawingDocument)
For Each sheetX As Sheet In drawingDoc.Sheets
Dim titleBlockX As TitleBlock = sheetX.TitleBlock
If (titleBlockX Is Nothing) Then Continue For
Dim scaleTextBox As TextBox = GetScaleTextBox(titleBlockX.Definition)
If (scaleTextBox Is Nothing) Then Continue For
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 = "<Scale>" Or defText.Text = "Scale") Then
Return defText
End If
Next
Return Nothing
End Function

Hi,

   Above program is made to update scale detail in title block based on base scale view.

i need to add one condition in this. If the Base scale view is an isometric view then Scale value in the title block should be NTS. Else whatever the actual value need to be updated. Anybody can help?

-karthikeyan M 

0 Likes
314 Views
2 Replies
Replies (2)
Message 2 of 3

Jef_E
Collaborator
Collaborator

You should check the view type. And then if ... then the value you like.

 

DrawingViewTypeEnum Enumerator

Name Value Description
kAssociativeDraftDrawingViewType 10506 View is an associative draft one.
kAuxiliaryDrawingViewType 10499 View is an auxiliary one.
kCustomDrawingViewType 10498 View with customized camera setting.
kDefaultDrawingViewType 10497 Specifies the default View. The more strongly typed value is returned in a query.
kDetailDrawingViewType 10502 View is a detail of a portion of the document contents.
kDraftDrawingViewType 10505 View is a draft one.
kOLEAttachmentDrawingViewType 10500 View is an OLE attachment.
kOverlayDrawingViewType 10507 View is an overlay one.
kProjectedDrawingViewType 10504 View is a projected one.
kSectionDrawingViewType 10503 View is a section.
kStandardDrawingViewType 10501 View with the camera set to one of the standard orthogonal views (Top, Iso, etc.).


Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 3 of 3

k14348
Advocate
Advocate

Hi, 

 I don't know to write ilogic code. 

 

-karthikeyan M

0 Likes