Rename Model View to its View Cube Orientation

Rename Model View to its View Cube Orientation

C_Haines_ENG
Collaborator Collaborator
538 Views
10 Replies
Message 1 of 11

Rename Model View to its View Cube Orientation

C_Haines_ENG
Collaborator
Collaborator

I would like to be able to click on an a model view at it will rename the models label to its current view cube orientation. 

 

So if you're looking at the top view it will rename the model to "Top".

 

I'm not entirely sure if this is even possible but it would save my fingers from getting carpel tunnel haha.

0 Likes
539 Views
10 Replies
Replies (10)
Message 2 of 11

A.Acheson
Mentor
Mentor

Here is a post on how to do the whole sheet.

If you want to do a single selection then use the pick function and change the SelectionFilterEnum to kDrawingViewFilter

Ensure to remove the for loop for the views. 

 

CommandManager.PickFilter As SelectionFilterEnumPromptText As String ) As Object

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 11

C_Haines_ENG
Collaborator
Collaborator

I'm getting a "Object reference not set to an instance of an object." every time I try to close the tool

Dim tmpSheet As Sheet = ThisDrawing.ActiveSheet.Sheet
Dim tmpView As DrawingView
For Each tmpView In tmpSheet.DrawingViews
    Dim myDrawingViewName As String = ""
	tmpView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a face")
    
        Select Case tmpView.Camera.ViewOrientationType
            Case ViewOrientationTypeEnum.kBackViewOrientation
                myDrawingViewName = "BACK"
            Case ViewOrientationTypeEnum.kBottomViewOrientation
                myDrawingViewName = "BOTTOM"
            Case ViewOrientationTypeEnum.kFrontViewOrientation
                myDrawingViewName = "FRONT"
            Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation
                myDrawingViewName = "ISOMETRIC"
            Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation
                myDrawingViewName = "ISOMETRIC"
            Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
                myDrawingViewName = "ISOMETRIC"
            Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation
                myDrawingViewName = "ISOMETRIC"
            Case ViewOrientationTypeEnum.kLeftViewOrientation
                myDrawingViewName = "SIDE"
            Case ViewOrientationTypeEnum.kRightViewOrientation
                myDrawingViewName = "SIDE"
            Case ViewOrientationTypeEnum.kTopViewOrientation
                myDrawingViewName = "TOP"
            Case Else
                myDrawingViewName = ""
            End Select        
        If Not myDrawingViewName = "" Then
            tmpView.Name = myDrawingViewName
        End If		
		If tmpView.IsFlatPatternView =True Then
           tmpView.Name = "FLAT PATTERN"
        End If
	
    myDrawingViewName = ""
	
 
Next

.Im assuming this is because of the looping function but I need to be able to select multiple views at once. 

0 Likes
Message 4 of 11

JelteDeJong
Mentor
Mentor

This version will let you select views till you hit escape.

Do
    Dim tmpView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a view")
    If (tmpView Is Nothing) Then Exit Do

    Dim myDrawingViewName As String = ""

    Select Case tmpView.Camera.ViewOrientationType
        Case ViewOrientationTypeEnum.kBackViewOrientation
            myDrawingViewName = "BACK"
        Case ViewOrientationTypeEnum.kBottomViewOrientation
            myDrawingViewName = "BOTTOM"
        Case ViewOrientationTypeEnum.kFrontViewOrientation
            myDrawingViewName = "FRONT"
        Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation
            myDrawingViewName = "ISOMETRIC"
        Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation
            myDrawingViewName = "ISOMETRIC"
        Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
            myDrawingViewName = "ISOMETRIC"
        Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation
            myDrawingViewName = "ISOMETRIC"
        Case ViewOrientationTypeEnum.kLeftViewOrientation
            myDrawingViewName = "SIDE"
        Case ViewOrientationTypeEnum.kRightViewOrientation
            myDrawingViewName = "SIDE"
        Case ViewOrientationTypeEnum.kTopViewOrientation
            myDrawingViewName = "TOP"
        Case Else
            myDrawingViewName = ""
    End Select
    If Not myDrawingViewName = "" Then
        tmpView.Name = myDrawingViewName
    End If
    If tmpView.IsFlatPatternView = True Then
        tmpView.Name = "FLAT PATTERN"
    End If

    myDrawingViewName = ""

Loop

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 11

C_Haines_ENG
Collaborator
Collaborator

Why cant I delete comments...

0 Likes
Message 6 of 11

GosponZ
Collaborator
Collaborator
JelteDeJong It would be nice if label toggle is on and not to show scale when pick a view. Can you do that please.
0 Likes
Message 7 of 11

C_Haines_ENG
Collaborator
Collaborator

Is it possible for the loop to only effect views with the views listed in the code such as "Top" "Front", etc.

 

I don't want it to overwrite custom view labels every time it runs. 

0 Likes
Message 8 of 11

GosponZ
Collaborator
Collaborator
Still looking..
0 Likes
Message 9 of 11

C_Haines_ENG
Collaborator
Collaborator

As for not showing scale I think that comes down to your Style Library in the Standards section. You can change the default label for your drawing views. 

 

As for toggling labels, you could add

oView.ShowLabel = True 

 to the code above. 

0 Likes
Message 10 of 11

GosponZ
Collaborator
Collaborator
I tried but no working
0 Likes
Message 11 of 11

C_Haines_ENG
Collaborator
Collaborator

Is there a way to account for rotation of a view?

0 Likes