- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @JohnBoySarcia. In this case there are a couple things going on. First of all, unless you are still using Inventor 2016 version, the 'Material' object type no longer exists. That pretty much changed after that year to MaterialAsset object type, and can no longer be used exactly the same way as the old Material object was used. The MaterialAsset object has its own set of methods and properties. At the same time the Render styles also changed to a regular Asset type object. And now you access them through AssemblyDocument.MaterialAssets or PartDocument.MaterialAssets, instead of AssemblyDocument.Materials. And can set the active one for a part through the PartDocument.ActiveMaterial property, which will accept either a MaterialAsset object or regular Asset object as input.
And yes, due to you having the local multi-value parameter named "Material" that is being recognized within your rule as a parameter, that is messing with your ability to 'declare' the oMaterial variable's Type. Some of the old Material & RenderStyle functionality may still be supported, but just to support old code functionality, so you should not use those terms in any new code solutions. A common issue in any type of coding is naming your variable the same spelling and capitalization as the object's Type, which causes confusion and errors.
Edit: My mistake on when the change happened. The change happened between 2013 & 2014 releases. Here is a link to a page describing the changes.
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-2912C0FB-885F-47ED-81C3-AF19584EA9C1
If the link does not work, you can click the Help button in Inventor, then navigate to Programming Interface > Inventor API User's Manual > General Concepts > Materials and Appearances
Wesley Crihfield
(Not an Autodesk Employee)