How to color specific parts of an STL object in 3D World Editor

17 次查看(过去 30 天)
Hi,
I am having trouble coloring a CAD model I designed in Fusion360 in the 3D World Editor (Simulink 3D Animation).
When I import an STL file, the 3D World Editor displays a completely grey model, but the original model has multiple colors in specific parts of the model. I followed the steps outlined here: https://www.mathworks.com/help/sl3d/import-stl-and-physical-modeling-xml-files.html
I found a way to color the model with only one color using the diffuseColor (SFColor) field, but I cannot find a way to color specific parts of the model with different colors.
If I need to import multiply CAD models, color them separately, and assemble them to make the whole model, how can I export multiple STL files and assemble them together in the editor?
Any assistance would be greatly appreciated.
Thank you in advance.

采纳的回答

Jan Houska
Jan Houska 2023-3-17
Hi Alex,
your geometry is most probably a hierarchical tree of Transform nodes that contain Shape nodes. These contain Geometry nodes that describe the body geometry and Appearance nodes that describe the body look. To add color, you create a Material node inside the Appearance node and set its diffuseColor field to the desired color. This is described in the X3D standard. You may also want to take a look at the vrmanipul_global shipping example and examine its node hierarchy. The example contains hierarchically organized individually colored objects, maybe similar to what you are trying to achieve.
Jan

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by