Unspecified error when adding a model state to a part

Unspecified error when adding a model state to a part

rogmitch
Advocate Advocate
972 Views
4 Replies
Message 1 of 5

Unspecified error when adding a model state to a part

rogmitch
Advocate
Advocate

I have a simple part with a circular array of holes.  The number of holes is defined by the multi-value list of a user parameter. 

The part is inserted in an assembly which has a user parameter (HoleNumber) with the same multi-value list.  A single line ilogic rule links the assembly to the part.  An ilogic form in the assembly allows the hole pattern to be changed.  Everything works as expected.

 

If I now copy the Master model state to create a Master1 model state the rule then fails with an unspecified error (see screen capture).  I tried setting the active model state in the rule but the error persists.

 

Does anyone know what is causing the error?

 

I attach the part and assembly and screenshot.

 

Thanks

 

Roger Mitchell

IV 2022.0.1

Accepted solutions (1)
973 Views
4 Replies
Replies (4)
Message 2 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @rogmitch 

 

It gets a little bit messier with model states, but if you change your rule to this (assuming the Model State name is correct), I think it'll work as expected.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

oOcc = Component.InventorComponent("Plate:1")
'activate it in the assembly
oOcc.ActiveModelState = "Model State1"

oMSFactory = oOcc.Definition.FactoryDocument
'activate it for edits in the part
oMSFactory.ComponentDefinition.ModelStates.Item("Model State1").Activate()
oMSFactory.ComponentDefinition.Parameters.ModelParameters.Item("d11").Value = HoleNumber

 

 

 

EESignature

0 Likes
Message 3 of 5

rogmitch
Advocate
Advocate

Hi Curtis,

 

Thank you - that did the trick.  I really appreciate the help as I would not have been able to sort that out myself as I have not found much relating to model state coding on-line.

 

Roger

Message 4 of 5

Z0methink
Enthusiast
Enthusiast

I load two versions of the model:
1.with an error that occurs to me;
2.with my simpler solution.

0 Likes
Message 5 of 5

jw_park29F53
Explorer
Explorer

Hello, I would like to ask you for help with Inventor iLogic.

 

I found your article helpful about utilizing variables in parts in Inventor model state.

 

I want to run a rule in a part.

 

oOcc = Component.InventorComponent("M4:1")
oOcc.ActiveModelState = "Non_Standard"

oMSFactory = oOcc.Definition.FactoryDocument
oMSFactory.ComponentDefinition.ModelStates.Item("Non_Standard").Activate()
oMSFactory.ComponentDefinition.iLogicVb.RunRule("M4:1","Excel to Parameter")

 I did the above, but I get an error.

0 Likes