Error in assembly

Error in assembly

steven.coxVCM6J
Advocate Advocate
358 Views
2 Replies
Message 1 of 3

Error in assembly

steven.coxVCM6J
Advocate
Advocate

Hi all,

 

A while back I added an iLogic rule to toggle edit scope anytime I open(triggers after open) a part or assembly.  The rule works great in a single part or an assembly.

 

However, sometimes I get an error when opening assemblies that are populated with a lot of parts and sub-assemblies.

 

The code is:

Dim oDoc As Document = ThisDoc.Document

oModelStates = oDoc.ComponentDefinition.ModelStates
If oModelStates.MemberEditScope = MemberEditScopeEnum.kEditActiveMember Then

oModelStates.MemberEditScope = MemberEditScopeEnum.kEditAllMembers

End If

The error is this:

stevencoxVCM6J_0-1680890493974.png

When I click ok, it pops up the next one until it cycles through all and then the assembly works fine.

The error appears to only be for documents that are using two different model states.  The part template has two models states but if they are not different than the primary, it does not seem to cause the error.

 

Any ideas as to how to make this not cause the error, or to suppress the error?

 

Please keep in mind I am not a coder...this is all new to me but quite useful.

 

Thanks, Steven

 

0 Likes
Accepted solutions (1)
359 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

I expect your rule is having problems because you use the member document instead of the factory document. I wrote a blog post about this issue some weeks ago. You might want to check "Modelstates: iLogic and unexpected results" If my guess is correct then you could solve your issue by using

ThisDoc.FactoryDocument
' instead of
ThisDoc.Document

Your rule should look something like this:

Dim oDoc As Document = ThisDoc.FactoryDocument

oModelStates = oDoc.ComponentDefinition.ModelStates
If oModelStates.MemberEditScope = MemberEditScopeEnum.kEditActiveMember Then
	oModelStates.MemberEditScope = MemberEditScopeEnum.kEditAllMembers
End If

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

steven.coxVCM6J
Advocate
Advocate

This seems to have corrected the problem.

 

Thanks so much for the lesson!!

 

Steven

0 Likes