Regarding linking Model States of Parts and Sub-Assemblies with the Model States of Main Assembly

Regarding linking Model States of Parts and Sub-Assemblies with the Model States of Main Assembly

ninad_Chaulamwar
Explorer Explorer
165 Views
1 Reply
Message 1 of 2

Regarding linking Model States of Parts and Sub-Assemblies with the Model States of Main Assembly

ninad_Chaulamwar
Explorer
Explorer

I have written a code to create Model States of Parts and Sub-Assemblies and Main Assembly. Now I want to link model states of part and subassembly with main assembly i.e. if LOD_300 model state of Main Assembly is activated then LOD_300 model state of every part and subassembly should get activated in main assembly using Inventor API. Kindly provide a sample code to help me with this issue.

0 Likes
166 Views
1 Reply
Reply (1)
Message 2 of 2

dalton98
Collaborator
Collaborator

Inventor already has this capability. Tab Assemble > Productivity > Link Model States

dalton98_0-1695307843073.png

 

If you want to do it with ilogic try something like this

Dim oADoc As AssemblyDocument = ThisDoc.Document
oADoc.ComponentDefinition.ModelStates.MemberEditScope = MemberEditScopeEnum.kEditActiveMember
For Each oMS As ModelState In oADoc.ComponentDefinition.ModelStates
	oMS.Activate
	For Each oOcc As ComponentOccurrence In oADoc.ComponentDefinition.Occurrences
		Try
			oOcc.ActiveModelState = oMS.Name
		Catch : End Try
	Next
Next