Hi @Covello_O. Asking an AI bot to write code to automate Inventor does not seem to produce good results from what I have seen examples of in this forum. It is better to learn to write the code yourself first, that way you have a better idea what is going to happen when you run the code. Spending some time looking around in this forum, and looking at the code examples found here that worked for others is a good place to start. This forum has search functionality that can be used to find other forum topics and responses related to your search terms.
An iLogic rule in Inventor can be far more powerful, and have far greater reach than most folks would originally imagine, so they can be dangerous if you do not understand them. They can control a lot more than just Inventor. They can reach out and control other applications (such as Excel, Outlook, Word, and others) and system resources also, and can even process entire folders full of files, if designed to.
In your first code after my last response, I see that it is using a 'Stack' type collection, which I have never seen used in an iLogic rule before. Then that example also still had the old RenderStyle objects in it, which should not be used in any new code projects. Then in the last code you posted, it looks like you are trying to get the Asset objects from a PartComponentDefinition type of object, which will not work. Then again in a later line of code, it is trying to copy an Asset object to a PartComponentDefinition type of object, which will not work. Asset objects are either stored within an AssetLibrary, or in a PartDocument, not in a ComponentDefinition. My earlier example showed you how to possibly get them from a PartDocument or set one to a PartDocument. The PartDocument object is a different object than the PartComponentDefinition object.
As I mentioned before, setting appearances in an assembly should be done starting from the bottom, not from the top. These code attempts are all trying to do it starting from the top, so you may not be able to achieve the results you want this way. When you change the color of an assembly component, that color change is recorded by whichever DVR was active in that component's parent assembly at that moment. When you look at the model browser tree in an assembly, you will see a folder near the top named "Representations", then if you expand that browser node, you will see a category named 'View'. Then, if you expand that browser node, you will see the individual DVR's (design view representations). Like the image below.

That is where things like component visibility and component color or appearance settings are being recorded. This is recorded in this document, not some other higher level assembly. Then, if this assembly is added into a higher level assembly as an assembly component, you can set that component to one of these DVR's that are defined within this assembly (not a DVR from some other assembly). This will control the appearance of that component within the parent level assembly. This is partially why this needs to be done starting from the bottom, instead of from the top. None of these codes are doing anything with the DVR's, but are just trying to force appearance changes at multiple levels of an assembly while ignoring all the DVR's of all the documents along the way.
I did create a different version of the code that I created earlier, using a different strategy, to see if it might possibly work any better for you. The code is within the attached text file. However, like all the earlier code examples, it is still completely ignoring all of the DVR's in all the documents along the way, so it is still not ideal either.
To make a task like this easier in the future, you should have one or more custom DVR's defined within each model document that you would like to control the appearance of. While that custom DVR is active, make sure the model looks the way you want it to look, then save the model. Then when you place an instance of that model into an assembly, set the instance to the custom DVR that you defined within that model, to maintain control of its appearance. That is the proper way to control appearances in an assembly.
Wesley Crihfield

(Not an Autodesk Employee)