If the base view is an isometric view in idw Titleblock scale value should b NTS

If the base view is an isometric view in idw Titleblock scale value should b NTS

k14348
Advocate Advocate
983 Views
8 Replies
Message 1 of 9

If the base view is an isometric view in idw Titleblock scale value should b NTS

k14348
Advocate
Advocate

Hi,

If the base view is an isometric view in idw Titleblock scale value should b NTS

-karthik

0 Likes
Accepted solutions (1)
984 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

 

Sorry, wrong account 🙂

0 Likes
Message 3 of 9

frederic.vandenplas
Collaborator
Collaborator

Hi,

Sorry, previously posted on my other account!
This does a check for the first drawingview placed on a sheet (base view)
Because i don't know how you fill the titleblock, i can't help you with that.
If needed provide more info please

Sub DrawingViewOrientation()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oDrawView As DrawingView
    Set oDrawView = oSheet.DrawingViews(1)
    
    If oDrawView.Camera.ViewOrientationType = kArbitraryViewOrientation Then
    MsgBox "view is iso"
    Else
    MsgBox "view is bottom/top/..."
    End If
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 4 of 9

k14348
Advocate
Advocate

Hi,

   Title block scale value comes under Prompted entry field edit. Plz refer attachment.

-karthikeyan M

0 Likes
Message 5 of 9

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

Then this is the code that you need...

 

Sub DrawingViewOrientationInTitleBlock()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oDrawView As DrawingView
    Set oDrawView = oSheet.DrawingViews(1)
    
    If oDrawView.Camera.ViewOrientationType = kArbitraryViewOrientation Then
        strscale = "NTSA"
    Else
        strscale = oDrawView.ScaleString
    End If
    
    Dim oTitleBlock As TitleBlock
    Set oTitleBlock = oSheet.TitleBlock
    
    Dim oTextbox As TextBox
    For Each oTextbox In oTitleBlock.Definition.Sketch.TextBoxes
        If oTextbox.Text = "Scale" Then 'This is the name you see in the promted text dialog box
            Call oTitleBlock.SetPromptResultText(oTextbox, strscale)
            Exit For
        End If
    Next oTextbox
    
        
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 6 of 9

k14348
Advocate
Advocate

Hi,

  This code is not working. If i run this code Scale value is coming as per Base scale view. Not NTS. If the base view is an isometric view then scale value should be NTS.

 

-karthikeyanM

0 Likes
Message 7 of 9

frederic.vandenplas
Collaborator
Collaborator
Accepted solution

Hi,

 

Indeed, i must have overlooked something, it looks now at the upvector, when 1 out of 3 vectors is 1, it means that you are looking perpendicular to the part/assy

Sub DrawingViewOrientationInTitleBlock()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oDrawView As DrawingView
    Set oDrawView = oSheet.DrawingViews(1)
    If oDrawView.Camera.UpVector.X = 1 Or oDrawView.Camera.UpVector.Y = 1 Or oDrawView.Camera.UpVector.Z = 1 Then
        strscale = oDrawView.ScaleString
    Else
        strscale = "NTS"
    End If
    
    Dim oTitleBlock As TitleBlock
    Set oTitleBlock = oSheet.TitleBlock
    
    Dim oTextbox As TextBox
    For Each oTextbox In oTitleBlock.Definition.Sketch.TextBoxes
        If oTextbox.Text = "Scale" Then 'This is the name you see in the promted text dialog box
            Call oTitleBlock.SetPromptResultText(oTextbox, strscale)
            Exit For
        End If
    Next oTextbox
    
        
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 8 of 9

k14348
Advocate
Advocate

Hi,

   Great it works thanks for your effort.

 

-karthikeyan M

0 Likes
Message 9 of 9

Anonymous
Not applicable

Just wondering if this could be tweeked to override the view label to show NTS for all ISO views? Thanks

0 Likes