Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
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.
Solved by chandra.shekar.g. Go to Solution.
Update 1:
I managed to find the following solution:
Sub CloseCommand() If ThisApplication.CommandManager.ActiveCommand = "SheetMetalStylesCmd" Then 'close the command window ThisApplication.CommandManager.StopActiveCommand End If End Sub
It works in the situation where I do the steps manually. Case scenario: I open my userform, just to have the form open. then I convert to sheet metal manually. I press "Sheet Metal Defaults" to interrupt the "Select Base Face"-selection. I then run the above code. It works flawless.
However, if i put in the above code to my user form I end up with "Select base face".......
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 (False) ocmd.Execute If ThisApplication.CommandManager.ActiveCommand = "SheetMetalStylesCmd" Then 'close the command window ThisApplication.CommandManager.StopActiveCommand End If End If
I have made a video where I show the (supposed to be) identical processes. First you se the manual way, then the proces of my form.
Hi Steffen,
In UserForm, update the following code to cancel "Sheet Metal Defaults" dialog.
Dim oPartToSheetMetal As ControlDefinition Set oPartToSheetMetal = ThisApplication.CommandManager.ControlDefinitions.Item("PartConvertToSheetMetalCmd") Dim oCMD As ControlDefinition Set oCMD = ThisApplication.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) Dim cancleCmd As ControlDefinition Set cancleCmd = ThisApplication.CommandManager.ControlDefinitions.Item("AppContextual_CancelCmd") cancleCmd.Execute End If
Please feel free to contact if there is any doubt.
If solves your problem, click on "Accept as solution" / give a "Kudo".
Thanks and regards,
Can't find what you're looking for? Ask the community or share your knowledge.