Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
zoe.baker-bushby
in reply to: vpeuvion

The activated model state does change though?

When you create a new model state it automatically changes to the new state?

Just running something as small as:

MessageBox.Show("START")
Dim doc As PartDocument = ThisDoc.Document
oPCD = doc.ComponentDefinition
oMStates = oPCD.ModelStates
oMState = oMStates.Add(PartNumber)
iLogicVb.UpdateWhenDone = True

Changes the state.

 

You are however correct in saying that:

ThisDoc.ActiveModelState = "Master"

Is the line that is making it so that the rule does not run again.

However, I need it to toggle back to Master.

 

Changing syntax to:

Dim masterMS As ModelState = oMStates.Item("Master")
masterMS.Activate()

Also doesn't work. It again runs once but won't run again.

 

However if I make a separate rule which just has:

ThisDoc.ActiveModelState = "Master"

 

I can then call this from my other rule and everything works fine...

MessageBox.Show("START")
Dim doc As PartDocument = ThisDoc.Document
oPCD = doc.ComponentDefinition
oMStates = oPCD.ModelStates
oMState = oMStates.Add(PartNumber)
iLogicVb.RunRule("Master")
iLogicVb.UpdateWhenDone = True

 So the order I am trying to do things is fine.

 

This has got to be a bug?

Unless I am just overlooking something :confused_face: