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: 

Convert to weldment assembly with iLogic

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
DannyVanDuijn
1036 Views, 4 Replies

Convert to weldment assembly with iLogic

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

4 REPLIES 4
Message 2 of 5

I don't think it is, their document definition are different objects:

 

AssemblyComponentDefinition

WeldmentComponentDefinition

 

Sorry fo the bad news.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
eljoseppo
in reply to: DannyVanDuijn

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?

Message 4 of 5

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

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 5 of 5

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

 

 

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

Post to forums  

Autodesk Design & Make Report