When we are making new IPT-files at my workplace, we use a UserForm I have made to select material and changes dimensions etc.
If a user selects a material for which have bend rules assigned, the UserForm converts the part to a sheet metal with the PartConvertToSheetMetalCmd-command:
Dim oPartToSheetMetal As ControlDefinition
Set oPartToSheetMetal = ThisApplication.CommandManager.ControlDefinitions.Item("PartConvertToSheetMetalCmd")
If odoc.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'If the part is different from sheet metal type, then set to sheet metal oPartToSheetMetal.Execute2 (True) 'Convert to Sheet metal. This activates the Sheet Metal Defaults, and waits for user input. End If
This was all well and good in Inventor 2015. Now we have just upgraded to Inventor 2017, and someone at Autodesk have decided that the "Sheet Metal Defaults"-command is executed when converting a part to Sheet Metal. That is not a great solution when we use VBA to all our settings.
I am trying to find a work around.
What I have come up with so far:
Dim oPartToSheetMetal As ControlDefinition Set oPartToSheetMetal = ThisApplication.CommandManager.ControlDefinitions.Item("PartConvertToSheetMetalCmd") Dim oCMD As ControlDefinition
Set oCMD = oApp.CommandManager.ControlDefinitions("SheetMetalStylesCmd")
If odoc.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'If the part is different from sheet metal type, then set to sheet metal oPartToSheetMetal.Execute2 (True) 'Convert to Sheet metal. This activates the Sheet Metal Defaults, and waits for user input.
oCMD.Execute 'Open Sheet Metal Defaults (this interupts the "Select Base Face" user input)
SendKeys "{ESC}", True ' Close the "Sheet Metal Defaults-window"
End If
This solution works as intended, except that the Sendkeys-command annoys every user by changing key-states on NumLock etc. And I have to run through the code twice to be sure the Sheet metal defaults are updated properly.
My question:
Is there any way to abort or disable the "Sheet Metal Defaults" from running in the first place? (regedit, xml files?)
I want it to work just as it did in Inventor 2015.
Can I abort SheetMetalDefault with VBA code (I would rather not use send keys)
Solved! Go to Solution.