"Constraint.IsActiveInComponent" gives error

"Constraint.IsActiveInComponent" gives error

tom89Y38
Enthusiast Enthusiast
606 Views
4 Replies
Message 1 of 5

"Constraint.IsActiveInComponent" gives error

tom89Y38
Enthusiast
Enthusiast

Hi all,

 

I want to suppress a constraint in a sub-assembly. The code that I use:

 

Constraint.IsActiveInDoc("000090-0000-A.iam", "Insert_180:1")=False

This works perfect but i can't copy and rename the parts because the iLogic rule won't find the filename anymore.

Instead of this i used the following code(like advised on https://knowledge.autodesk.com/support/inventor/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/Inve... :

Constraint.IsActiveInComponent("Empty_Pallet_Stopper:1", "Insert_180:1") = False   

This should work perfect, but it doesn't. I get the following error (see attached image) 

 

Anyone who could give me some advice? I use Inventor 2019

0 Likes
Accepted solutions (1)
607 Views
4 Replies
Replies (4)
Message 2 of 5

JhoelForshav
Mentor
Mentor

Hi @tom89Y38 

It seems that "Insert_180:1" doesn't exist in the component "Empty_Pallet_Stopper:1"?

0 Likes
Message 3 of 5

tom89Y38
Enthusiast
Enthusiast

It does exist, when i use the filename instead of the display name it works perfect.

 

Snipaste_2020-09-01_12-01-47.png

0 Likes
Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

@tom89Y38 

Constraint.IsActiveInComponent seems to take the actual leaf occurrence that the constraint is acting on.

I think this will work for you:

Constraint.IsActiveInComponent("000090-PL0007:1", "Insert_180:1") = False

 

0 Likes
Message 5 of 5

tom89Y38
Enthusiast
Enthusiast

This works! thanks a lot!

 

Looks like i was confused by this explenation on the Autodesk help page:

 

To copy and rename all the files in an assembly while keeping all the rules intact, use Constraint.IsActiveInComponent and specify a subassembly name instead of the filename.