Converter
Files
- GhMeshConverter.cs
`GhMeshConverter.cs` is a utility class within the `GlassHopper.Converter` namespace that facilitates bidirectional mesh conversion between the Maffeis Geometry library and Rhino/Grasshopper. It provides two static methods: `ToGhMesh`, which converts a generic Maffeis mesh into a Rhino geometry mesh with optional scaling, and `ToMmMesh`, which performs the reverse operation from Rhino to Maffeis. The key components include handling both triangular and quadrilateral faces by checking face properties before adding them to the target structure. Additionally, the converter applies coordinate scaling during translation and regenerates edges in the Maffeis mesh after construction. This tool ensures interoperability between different geometric data structures used in computational design workflows.
- InterlayerMaterialFromDBComverter.cs
This file defines a custom JSON converter (`InterlayerMaterialFromDBComverter`) for deserializing `InterlayerMaterial` objects from database-stored JSON formats. It implements the `ReadJson` method to manually parse JSON tokens, mapping properties like ID, name, density, and thermal expansion to corresponding model fields. The converter specifically handles nested structures by recursively parsing load duration modules and their associated temperature-dependent material properties. It ignores unsupported or complex nested data (like stress-strain tables) by skipping their tokens, ensuring robust parsing of partial data. The `WriteJson` method is currently unimplemented, indicating this converter is read-only. This approach allows fine-grained control over how specific engineering material data is reconstructed from JSON payloads.
- VectorConverter.cs
This file defines a `VectorConverter` class within the `GlassHopper.Converter` namespace, serving as a bridge between Rhino.Geometry and Maffeis.Geometry libraries. It provides four static methods to convert 3D points and vectors bidirectionally between these two specific geometry frameworks. The implementation is straightforward, simply copying X, Y, and Z coordinates from source objects to new destination objects of the target type. Key components include the `RhinoToMm` and `MmToRhino` method pairs for both `Point3d` and `Vector3d` types. This utility ensures compatibility when passing geometric data between Rhino-based plugins and external math libraries like Maffeis.