Inventor General

Reply
Active Member
jbauer
Posts: 8
Registered: ‎04-25-2012
Message 1 of 6 (441 Views)
Accepted Solution

Base and Projected View Label Name to match Orientation Name

441 Views, 5 Replies
04-26-2012 08:38 AM

I would like to know if there is a way to have each view name to be set to the orientation names/ the 3D view cube's name. Is there a way to do this without manually changing each one? 

Product Support
Dennis.Ossadnik
Posts: 30
Registered: ‎05-11-2011
Message 2 of 6 (419 Views)

Re: Base and Projected View Label Name to match Orientation Name

04-30-2012 07:55 AM in reply to: jbauer

Hi jbauer,

you could manage this with a little macro like this:

Sub OrientationToLabel()

Dim odoc As DrawingDocument
Set odoc = ThisApplication.ActiveDocument

'active sheet
Dim tmpSheet As Sheet
Set tmpSheet = odoc.ActiveSheet


Dim tmpView As DrawingView
'every draring view

For Each tmpView In tmpSheet.DrawingViews

Dim myDrawingViewName As String


'Which text for which orientation
Select Case tmpView.Camera.ViewOrientationType
    Case ViewOrientationTypeEnum.kBackViewOrientation
        myDrawingViewName = "Back View"
    Case ViewOrientationTypeEnum.kBottomViewOrientation
        myDrawingViewName = "Bottom View"
    Case ViewOrientationTypeEnum.kFrontViewOrientation
        myDrawingViewName = "Front View"
    Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation
        myDrawingViewName = "Iso - Bottom Left View"
    Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation
        myDrawingViewName = "Iso - Bottom Right View"
    Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
        myDrawingViewName = "Iso - Top Left View"
    Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation
        myDrawingViewName = "Iso - Top Right View"
    Case ViewOrientationTypeEnum.kLeftViewOrientation
        myDrawingViewName = "Left View"
    Case ViewOrientationTypeEnum.kRightViewOrientation
        myDrawingViewName = "Right View"
    Case ViewOrientationTypeEnum.kTopViewOrientation
        myDrawingViewName = "Top View"
    Case Else
        myDrawingViewName = ""
    End Select

'Chang if view orientation was found
If Not myDrawingViewName = "" Then
    'change drawing view name
    tmpView.Name = myDrawingViewName
End If

Next

End Sub

 bofore:

Screenshot1.png

 

After using the macro:

Screenshot2.png

 

The macro will change the name of the drawing view of all view on that sheet.

You can adjust the code and replace the names of the orientation with names you like.

 

Do you think, this would work for you?

Please use the button "Accept as Solution" if it works.

 




Dennis Ossadnik


______________________________________________________________

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!

Active Member
jbauer
Posts: 8
Registered: ‎04-25-2012
Message 3 of 6 (408 Views)

Re: Base and Projected View Label Name to match Orientation Name

04-30-2012 08:36 AM in reply to: jbauer

When I paste this code into the iLogic Browser, I get an error message. I attached a screenshot image of it. 

Product Support
Dennis.Ossadnik
Posts: 30
Registered: ‎05-11-2011
Message 4 of 6 (384 Views)

Re: Base and Projected View Label Name to match Orientation Name

05-02-2012 01:04 AM in reply to: jbauer

Hi jbauer,

sorry, i was not aware that you wanted to use it in iLogic. The code above is for using as a macro in VBA.

I changed the code. Now you should be able to use it with iLogic:

Here is the code for iLogic:

Sub Main()

Dim odoc As DrawingDocument
odoc = ThisApplication.ActiveDocument

'active sheet
Dim tmpSheet As Sheet
tmpSheet = odoc.ActiveSheet


Dim tmpView As DrawingView
'every draring view

For Each tmpView In tmpSheet.DrawingViews

Dim myDrawingViewName As String


'Which text for which orientation
Select Case tmpView.Camera.ViewOrientationType
    Case ViewOrientationTypeEnum.kBackViewOrientation
        myDrawingViewName = "Back View"
    Case ViewOrientationTypeEnum.kBottomViewOrientation
        myDrawingViewName = "Bottom View"
    Case ViewOrientationTypeEnum.kFrontViewOrientation
        myDrawingViewName = "Front View"
    Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation
        myDrawingViewName = "Iso - Bottom Left View"
    Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation
        myDrawingViewName = "Iso - Bottom Right View"
    Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
        myDrawingViewName = "Iso - Top Left View"
    Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation
        myDrawingViewName = "Iso - Top Right View"
    Case ViewOrientationTypeEnum.kLeftViewOrientation
        myDrawingViewName = "Left View"
    Case ViewOrientationTypeEnum.kRightViewOrientation
        myDrawingViewName = "Right View"
    Case ViewOrientationTypeEnum.kTopViewOrientation
        myDrawingViewName = "Top View"
    Case Else
        myDrawingViewName = ""
    End Select

'Chang if view orientation was found
If Not myDrawingViewName = "" Then
    'change drawing view name
    tmpView.Name = myDrawingViewName
End If

Next

End Sub

 

Please use the button "Accept as Solution" if it works.

 

Thanks.




Dennis Ossadnik


______________________________________________________________

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!

Active Member
jbauer
Posts: 8
Registered: ‎04-25-2012
Message 5 of 6 (369 Views)

Re: Base and Projected View Label Name to match Orientation Name

05-02-2012 09:15 AM in reply to: Dennis.Ossadnik

Thanks for your help,

It's greatly appreciated. 

Distinguished Contributor
sergelachance
Posts: 166
Registered: ‎04-30-2012
Message 6 of 6 (131 Views)

Re: Base and Projected View Label Name to match Orientation Name

11-07-2013 03:18 AM in reply to: jbauer

hi :smileyhappy:

 

work great, but is you have a section in your drawing, put side view in view label name????

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube