Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Create Model States using iLogic

zoe.baker-bushby
Enthusiast

Create Model States using iLogic

zoe.baker-bushby
Enthusiast
Enthusiast

I have an assembly that has a duplication of the same part. 

The part has only the master model state, but I want to be able to add model states to this part via ilogic.

 

This line creates model states at the assembly level (which I don't need).

oModelState = oDoc.ComponentDefinition.ModelStates.Add(oName)
		oDoc.ActiveModelState = oName

 

This is what I am trying to do... vaguely...

Dim oDoc As AssemblyDocument
	
Dim oOcc As ComponentOccurrence 	
For Each oOcc In Occurrences
'The below line does not work, what is the correct syntax????
oOcc.ComponentDefinition.ModelStates.Add(oName)
next

 

Any help/advice would be great?

 

Reply
Accepted solutions (3)
4,917 Views
20 Replies
Replies (20)

tecnico
Contributor
Contributor

Unfortunately this rule of error, I will try to explain myself better.
I need to have a rule that when I enter a length value (on a dialog box that appears when the rule or module is executed) and once the length is set (which will be the only variable that will change) the rule will have to create a model state with that specific value and a model state with the same name as the variable value.
If the variable has already assumed that value and therefore a model state with that name is already present, it will not have to create any model state but simply load the existing one with the name corresponding to the entered value.

0 Likes