- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm currently working on a project where I'm attempting to create a new material from an existing one.
However, I'm encountering an issue in my C++ code where the pointer is returning NULL pointer for the new Material generated. Surprisingly, when I use the same code in Python, the new material is successfully generated.
- C++ Code
Ptr<MaterialLibraries> matLibs = app->materialLibraries();
Ptr<MaterialLibrary> matLib = matLibs->itemByName("Fusion 360 Material Library");
Ptr<Materials> materials = matLib->materials();
Ptr<Material> existingMaterial = materials->item(0);
Ptr<Material> newMaterial = materials->addByCopy(existingMaterial, "NewMaterial");
- Python Code
matlibs = app.materialLibraries
matLib = matlibs.itemByName('Fusion 360 Material Library')
materials = matLib.materials
existingMaterial = materials.item(0)
newMaterial = design.materials.addByCopy(existingMaterial, "NewMaterial")
I was wondering if anyone could assist me in identifying any potential issues within the code.
Thank you in advance for your help!
Solved! Go to Solution.