Message 1 of 3

Not applicable
05-06-2020
08:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to follow Mr Ekins' code to create a new appearance and assign a color to it, then add this new appearance to a Brep face.
It's going wrong in the CAST line (and probably elsewhere.
HELP!
// create appearance first
Ptr<MaterialLibraries> matlib = app->materialLibraries();
Ptr<Appearance> yellowc = matlib->itemByName("Paint - Enamel Glossy (Yellow)");
Ptr<Appearance> newc = FA->addByCopy(yellowc, "MyGreen");
Ptr<Appearances> prop1 = newc->appearanceProperties();
Ptr<ColorProperty> cprop = adsk::core::ColorProperty::cast(prop1->itemByName("color")); // WRONG HERE
cprop->value = adsk::core::Color::create(0, 255, 0,0);
bool retval = bfaceCyl->appearance(newc);
Solved! Go to Solution.