Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Override Environment Exception

1 REPLY 1
Reply
Message 1 of 2
Anonymous
327 Views, 1 Reply

Override Environment Exception

I wrote an Add-In that uses custom override environments.  These are set when switching to different states in the Add-In to show different commands.

 

I found a bug in the Factory Design Suite version of Inventor 2012 Professional, 64 bit, Factory Ultimate, Build 160 running on a machine in France.

 

When I set the override environment, an exception is return with INVALID_ARG.

 

 I tried the same version, and many others here in Canada, and this never happens.

 

Anyone have any ideas about what might cause this?  I'm at an absolute stand-still on this one.

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Sorry for reviving this post, but the same error has occured in my project.

When I am trying to set the override environment I am receiving and Argument Exception.

So I tried the API HELP sample for override environments. Same problem here. Any Ideas. Would be great!

Sub AddOverrideEnvironment()
    ' Make sure a part document is active
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument

    Dim oEnvironments As Environments
    Set oEnvironments = ThisApplication.UserInterfaceManager.Environments

    ' Create a new environment
    Dim oOverrideEnv As Environment
    Set oOverrideEnv = oEnvironments.Add("Override", "OverrideEnvironment")

    ' Get the part ribbon
    Dim oPartRibbon As Ribbon
    Set oPartRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Part")

    ' Create a contextual tab to be used as the default for the override environment
    Dim oTabOne As RibbonTab
    Set oTabOne = oPartRibbon.RibbonTabs.Add("Tab One", "TabOne", "ClientId123", "id_TabSheetMetal", True, False)

    ' Create panels with the tab
    Dim oPanelOne As RibbonPanel
    Set oPanelOne = oTabOne.RibbonPanels.Add("Panel One", "PanelOne", "ClientId123")

    Dim oDef1 As ButtonDefinition
    Set oDef1 = ThisApplication.CommandManager.ControlDefinitions.Item("PartExtrudeCmd")

    Call oPanelOne.CommandControls.AddButton(oDef1, True)

    Dim oPanelTwo As RibbonPanel
    Set oPanelTwo = oTabOne.RibbonPanels.Add("Panel Two", "PanelTwo", "ClientId123")

    Dim oDef2 As ButtonDefinition
    Set oDef2 = ThisApplication.CommandManager.ControlDefinitions.Item("PartRevolveCmd")

    Call oPanelTwo.CommandControls.AddButton(oDef2, True)

    Dim strTabs(0) As String
    strTabs(0) = "TabOne"

    oOverrideEnv.InheritAllRibbonTabs = False
    oOverrideEnv.AdditionalVisibleRibbonTabs = strTabs
    oOverrideEnv.DefaultRibbonTab = "TabOne"

    ' Set the override environment on the active part
    oPartDoc.EnvironmentManager.OverrideEnvironment = oOverrideEnv ' --> ARGUMENT EXCEPTION HERE

End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report