Hi,
As mention in the Help forum, I’ve started working on better material support in FreeCAD. These are the changes/additions I want to implement:
- Extend and modify the Material class to support arbitrary, but pre-defined, properties.
This is done by adding a vector of boost::any variables. This will provide a type-safe way of accessing various properties, minimizing conversion code throughout FreeCAD. The currently existing member variables are replaced by functions calls accessing this vector. These should be exposed in python as normal attributes.
- Add a material property to the class/classes that represent a solid.
This property needs to handle the material for the solid itself, but also the surface. This is done by having a single reference for the solid, and a map of faces → materials for the surface. This makes it possible to color different faces of a solid. Also, each face may have multiple materials (e.g paint + silk print).
- Add infrastructure for a material database.
This is done to unify access to the materials. Two main classes are defined: MaterialDatabase and MaterialSource. A database is basically a collection of sources. One of the sources will be the standard FCmat files already defined and used.
I don’t think these changes will be very intrusive to the already existing material support in FreeCAD; in fact my gut feeling is that this will simplify things, and code in other workbenches can be minimized.
For the moment I don’t have any code worth sharing; what I have barely compiles, doesn’t have all the functions, and most likely doesn’t work properly yet ![]()
Eivind