JSON File Format

IGLGraphics imports CAD assemblies from JSON files. These files store the complete hierarchical structure of the 3D model, including assemblies, bodies and geometric shape data.

The imported JSON file represents a complete CAD assembly tree. Each assembly can contain multiple sub-assemblies and bodies, while each body contains geometric shape information such as edges, surfaces and mesh data.

Hierarchical Structure

Assembly
│
├── Sub Assembly
│   │
│   ├── Body
│   │   └── Shape Data
|   |           └── Edges
|   |           └── Faces
│   │
│   └── Body
│       └── Shape Data
|               └── Edges
|               └── Faces
│
└── Sub Assembly
    └── Body
        └── Shape Data
                └── Edges
                └── Faces

Example JSON Structure

[
    {
        "ARoot": "Saddle",
        "Bodies": [
            {
                "ARoot": "DN1800",
                "Bodies": [
                    {
                        "BodyID": 1,
                        "BodyName": "Component1",
                        "BodyType": "Solid",
                        "BodyVol": 6821470.139624689,
                        "Shape":{
                            "Edges":[],
                            "Faces":[],
                        }
                    },
                    {
                        "ARoot": "Component2",
                        "Bodies": [
                            {
                                "BodyID": 2,
                                "BodyName": "Component2",
                                "BodyType": "Solid",
                                "BodyVol": 8766432.095213901,
                                "Shape":{
                                    "Edges":[],
                                    "Faces":[],
                                }
                            },
                            {
                                "BodyID": 3,
                                "BodyName": "Component2",
                                "BodyType": "Solid",
                                "BodyVol": 924276.3953792171,
                                "Shape":{
                                    "Edges":[],
                                    "Faces":[],
                                }
                            },
                        ]
                    },
                    {
                        "BodyID": 13,
                        "BodyName": "Component3",
                        "BodyType": "Solid",
                        "BodyVol": 7250733.376781812,
                        "Shape":{
                            "Edges":[],
                            "Faces":[],
                        }
                    }
                ]
            }
        ]
    }
]
                        

The file begins with a root assembly named Saddle, which contains nested assemblies and body objects. Each body has a unique ID, name, type and volume, along with shape data that includes edge and face information.

Shape Geometry

The shape object contains the actual geometric representation used for rendering and visualization.

Advantages of the JSON Structure

Hierarchical

Supports complex CAD assembly structures.

Human Readable

Easy to inspect and debug during development.

Flexible

Can store geometry, metadata and visualization data together.