Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Rahul.Khande
in reply to: Jef_E

Thank you !!

Actually, I need to add a custom material and apply that to part document.
I never worked on material yet. So don't know how it works. What all I have for my material is only name for e.g. "CustomMaterial". Rest material properties can be default.

 

I have few questions :
1. Can we add custom material ? If yes, how can we ?
2. How to apply that custom material ?

3. Is there any working C# code snippet ?

 

I tried your snippet as below :

ThisApplication = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");

                    foreach (AssetLibraries lib in ThisApplication.AssetLibraries)
                    {
                        foreach (AssetLibrary assetlib in lib)
                        {
                            string name = assetlib.DisplayName;
                            
                        }
                    }

But it's crashing at highlighted code above.