Hi,
Just a simple question:
Is it possible to change a normal assembly into a weldment assembly through iLogic?
If Yes, please post the code.
Thanks
Danny
Solved! Go to Solution.
Solved by DannyVanDuijn. Go to Solution.
I don't think it is, their document definition are different objects:
AssemblyComponentDefinition
WeldmentComponentDefinition
Sorry fo the bad news.
Regards,
Philippe.
But there is an option to hit the button "Convert to weldment" if that's helpful somehow.
I cannot find... edit: found.
Sub Priority_Previous() 'Revert to previous component selection Run_CMD ("AssemblyConvertToWeldmentDocCmd") End Sub Function Run_CMD(ByVal cmd As String) As Boolean ' Get the CommandManager object. Dim oCommandMgr As CommandManager Set oCommandMgr = ThisApplication.CommandManager ' Get control definition for the line command. Dim oControlDef As ControlDefinition Set oControlDef = oCommandMgr.ControlDefinitions.Item(cmd) ' Execute the command. Call oControlDef.Execute End Function
Why do you need to change type to weldment? Always with the same options or choosing material everytime?
That's correct, however the command displays dialogs to prompt user for options, you won't be able to set those choices when invoking the command.
Your only workaround is to follow the defaults by setting silent ops to true:
Public Sub WeldMeUp() ThisApplication.SilentOperation = True ThisApplication.CommandManager.ControlDefinitions.item("AssemblyConvertToWeldmentDocCmd").Execute ThisApplication.SilentOperation = False End Sub
Thanks for the replies!
I've found an easy way based on the subtype of the document:
oModelDoc = ThisDoc.ModelDocument
oModelDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}"
This works great and easy.
Danny