IsActive Feature doesnt work

IsActive Feature doesnt work

luca_schulz2RES8
Contributor Contributor
727 Views
10 Replies
Message 1 of 11

IsActive Feature doesnt work

luca_schulz2RES8
Contributor
Contributor

Hey guys,
Can somebody please explain me why the IsActive Feature doesnt work ?

If Feet_Type = "Yeti 480" Then
	         Component.IsActive("Yeti_480:1") = 1
	         Component.IsActive("Yeti_480:2") = 1
	         Component.IsActive("Yeti_480:3") = 1
	         Component.IsActive("Yeti_480:4") = 1
		 Component.IsActive("Yeti_335:1") = 0    ------------
		 Component.IsActive("Yeti_335:2") = 0
		 Component.IsActive("Yeti_335:3") = 0
		 Component.IsActive("Yeti_335:4") = 0
		 Component.IsActive("Yeti_280:1") = 0
		 Component.IsActive("Yeti_280:2") = 0
		 Component.IsActive("Yeti_280:3") = 0
		 Component.IsActive("Yeti_280:4") = 0
	
	ElseIf Feet_Type = "Yeti 335" Then

	         Component.IsActive("Yeti_480:1") = 0
	         Component.IsActive("Yeti_480:2") = 0
	         Component.IsActive("Yeti_480:3") = 0
	         Component.IsActive("Yeti_480:4") = 0
		 Component.IsActive("Yeti_335:1") = 1
		 Component.IsActive("Yeti_335:2") = 1
		 Component.IsActive("Yeti_335:3") = 1
		 Component.IsActive("Yeti_335:4") = 1
		 Component.IsActive("Yeti_280:1") = 0
		 Component.IsActive("Yeti_280:2") = 0
		 Component.IsActive("Yeti_280:3") = 0
		 Component.IsActive("Yeti_280:4") = 0

		
	ElseIf Feet_Type = "Yeti 280" Then

	         Component.IsActive("Yeti_480:1") = 0
	         Component.IsActive("Yeti_480:2") = 0
	         Component.IsActive("Yeti_480:3") = 0
	         Component.IsActive("Yeti_480:4") = 0
		 Component.IsActive("Yeti_335:1") = 0
		 Component.IsActive("Yeti_335:2") = 0
		 Component.IsActive("Yeti_335:3") = 0
		 Component.IsActive("Yeti_335:4") = 0
		 Component.IsActive("Yeti_280:1") = 1
		 Component.IsActive("Yeti_280:2") = 1
		 Component.IsActive("Yeti_280:3") = 1
		 Component.IsActive("Yeti_280:4") = 1
		 
End If


I tried out so many things to get it work... in the parameters there is also in my optionion everything right.
(Add text and edit mutli-value list) I marked the line where is a Error (class not registered).


If Support_Beams = True Then
	Component.IsActive("Support_Beam:1") = 1
	Component.IsActive("Support_Beam:2") = 1
	Component.IsActive("Support_Beam:3") = 1
	Component.IsActive("Support_Beam:4") = 1
	
Else
	Component.IsActive("Support_Beam:1") = 0
	Component.IsActive("Support_Beam:2") = 0
	Component.IsActive("Support_Beam:3") = 0
	Component.IsActive("Support_Beam:4") = 0

End If

Same i got in this code. I done it with true/false in parameters.
Here error code is also (class not registered)

 



 

 

 

0 Likes
728 Views
10 Replies
Replies (10)
Message 2 of 11

WCrihfield
Mentor
Mentor

Hi @luca_schulz2RES8.  I have never seen anyone use ones and zeros with those types of lines of codes.  They usually use either True or False.  But I have seen 0/1 substituted for True/False in other scenarios, so it makes sense, as long as it is being accepted, and works OK.

 

One of the most common problems I see when using a list of 'IsActive' lines of code, is that they often need to be done in a specific order, due to 'dependency' related issues.  The 'IsActive' line controls suppression status (IsActive = True means un-suppress ; IsActive = False means suppress).  If any of the things being suppressed or un-suppressed is dependent on one of the other things being suppressed or un-suppressed, then the order that you suppress or un-suppress them in will be critical, and often needs to be done in reverse order on one side of 'check', verses the other.  For example, you do not want to un-suppress one object, before you un-suppress another object that it depends on.  So, you would need to un-suppress that other object first, then un-suppress the object that depends on that first one later.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 11

luca_schulz2RES8
Contributor
Contributor

Hi ! 
Im sorry but that did not help me :c 
I just copied a iLogic assembly i did bevore and just delete every komponent and placed the things i used bevore.
There i also just copied the code wich i posted here and it worked in this assembly without any changes.
But why ?
Could my template be wrong or do you know if I can change some settings when i will create the next iLogic assembly ?

0 Likes
Message 4 of 11

WCrihfield
Mentor
Mentor

Hi @luca_schulz2RES8.  Since you mentioned copying an assembly, another idea comes to mind.  Have you 'stabilized' the model browser tree names for all of your assembly components yet?  You stabilize them by renaming them differently than their default names.  This is needed in situations where you are copying assemblies, then renaming some or all of the files involved, because when you change the file names, that normally also changes the model browser tree names of those assembly components within the assembly, which will usually make your code stop working, because it can not find those named assembly components anymore.  When you stabilize their names, that will cause the model browser tree names for the assembly components to stay the same, even when the file names have changed.  That way, your code that accesses those components by name, will still work, even after the file names have changed.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 11

luca_schulz2RES8
Contributor
Contributor

Hello !
Yeah i stabilized them all. also in first version. I gave every single component a unique name. But in the copy I also gave them the same unique name like i did bevore so i dont have to change the code. 
But in the copy it works and in the original its not working. Everything is the same.

So I thought maybe its anything in the Template ? But I also dont think I used different Templates.

0 Likes
Message 6 of 11

WCrihfield
Mentor
Mentor

Since that code looks like it may be using the unquoted, blue name of a local parameter within it (Feet_Type), I assume this code is within an 'internal' iLogic rule (saved within the main assembly document), right (not in an external rule)?

Are there any ModelStates in that main assembly, other than the one default one named "[Primary]"?

Are there any ModelStates in any of those part files, other than the one default one named "[Primary]"?

If so, then that may be the detail that is effecting its behavior, and the code may need to get a little more complex to make it work as expected.  ModelStates would normally be the thing that will be recording suppression status changes.  And when multiple ModelStates are involved, we have to deal with 'factory' vs 'member' versions of those model documents.  Member versions can act like ReadOnly at first, unless dealt with properly.  Sometimes all that is needed is to update the main assembly between working with one referenced document and the next, but not always.

 

Edit:  Also, is the 'original' assembly still open when the code may be starting to try to work on the 'new copy' of that assembly?  If so, it may be possible that the code is attempting to access the original assembly, instead of the 'new copy' of it.  This may potentially / partially be due to the Component.IsActive() line of code not really specifying which specific assembly document it should be focused on.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 11

luca_schulz2RES8
Contributor
Contributor

In the copied Version wich works there is a primary folder.
In the Original there is no ordner called primary.
Is that the mistake ? And how do I create such a Ordner?

0 Likes
Message 8 of 11

WCrihfield
Mentor
Mentor

Before 2022 version of Inventor, we had LOD's (LevelOfDetailRepresentations), and the default one was named "Master" (in English), then in 2022 version of Inventor, those were changed into ModelStates, but its default one was still named "Master" (again in English), but then in later version of Inventor the default one was named "[Primary]" (in English).  Every new part or assembly will have that one, original ModelState already included, named "[Primary]".  The only exceptions are things like iAssembly, iPart, and similar types of files, because they will not have any ModelStates in them.

 

The image below (from an English version of Inventor) is showing the original / default status of all new assemblies (that are not an iAssembly).  This does not have multiple ModelStates, just the one original / default one.  If this is the case, then the ModelStates of the main assembly are not even a factor here.  However, that does not answer about the individual part files themselves.

WCrihfield_0-1716387838714.png

I did find it interesting that in your original post here, you indicated that it did not encounter a problem until it got to the first line of code that is dealing with the second (not the first) component name.  This indicates that it did not have a problem changing the suppression status of any of the instances of that first specifically named part components.

You did not answer about if the original assembly is still open when the code may be trying to work on the new assembly.

If the original assembly did not even have that folder in the model browser tree, I am very curious about that.

Is the original assembly an iAssembly?

Or, was the original assembly created in an earlier version of Inventor than your current version of Inventor?

Has that original assembly been migrated from a previous version of Inventor to your current version of Inventor?

What version year of Inventor are you using?

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 11

luca_schulz2RES8
Contributor
Contributor

I have the Inventor Version 2024.
I created both assemblys with this version of Inventor. I cant imagine why the primary ordner is just only in the copied Version.
When I created the copie of the assembly I obviously got it open to copie the codes. After this I closed the original and the copie still works.
Now i tried in in every way :
both opened 

only 1 of both
and every time just the copie works.

In both ways I created a Assembly and then set the parameters and then the code.
I think I created both of  them the same way.

0 Likes
Message 10 of 11

Frederick_Law
Mentor
Mentor
 Component.IsActive("Yeti_335:1") = 0

Is Yeti_335:1 in the assembly?

0 Likes
Message 11 of 11

luca_schulz2RES8
Contributor
Contributor

Good Morning,

Yeah the Yeti 335 and the Yeti 480 are assemblys but not the Yeti 280.

 

0 Likes