Inventor General Discussion

Inventor General Discussion

Reply
Active Member
8 Posts
0 Kudos
Registered: ‎04-25-2012
Post 1 of 6
Accepted Solution

Base and Projected View Label Name to match Orientation Name

536 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? 

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.

Product Support
34 Posts
4 Kudos
Registered: ‎05-11-2011
Post 2 of 6

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
8 Posts
0 Kudos
Registered: ‎04-25-2012
Post 3 of 6

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
34 Posts
4 Kudos
Registered: ‎05-11-2011
Post 4 of 6

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
8 Posts
0 Kudos
Registered: ‎04-25-2012
Post 5 of 6

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. 

Mentor
185 Posts
3 Kudos
Registered: ‎04-30-2012
Post 6 of 6

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????

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!