• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Active Member
    Posts: 8
    Registered: ‎04-25-2012
    Accepted Solution

    Base and Projected View Label Name to match Orientation Name

    240 Views, 4 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? 

    Please use plain text.
    Product Support
    Dennis.Ossadnik
    Posts: 23
    Registered: ‎05-11-2011

    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
    Support Specialist
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎04-25-2012

    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. 

    Please use plain text.
    Product Support
    Dennis.Ossadnik
    Posts: 23
    Registered: ‎05-11-2011

    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
    Support Specialist
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎04-25-2012

    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. 

    Please use plain text.