Advanced Topics
ClassCAD generic object structure
ClassCAD is written in C++ and provide a very generic object system to support the development of Cad application. Key is a ClassCAD langauge, which is a object oriented language that is bytecode compiled at runtime.
ClassCad Tree
Structured ClassCad Graphics (SCG)
Parts and Assemblies
We provide part and assembly modelling functionality. Creating a new part involves sequentially adding features into the part’s operation sequence. Everything you can do in our interactive Buerligons modeling system can also be accessed via API calls. This allows for a series of API calls to achieve the same results.
If you wish to create multiple parts in a single session, you use assembly mode. In this mode, parts are created within a part container using the API call partTemplate. Similarly, assemblies can be created as templates using the assemblyTemplates API. To add existing parts to an assembly session, you use the loadProduct API, which loads parts and assemblies into the container and prepares the templates for instantiation, i.e., placing instances in the assembly.
We provide a native ofb format for our models. For parts this format contains the history of the part including the parametrization and the solid models for the CAD kernel in binary format. For smaller self contained projects you store assemblies and parts packed in single ofb files. For larger projects we support splitting models into json assemblies and native or code-generated parts. An assembly is a recursive datastructure, that contains subassemblies and parts. The Json Schema describes an assembly in detail and can be found here [link] Using json assemblies is currently supported only via assembly API api.v1.assembly.from . We do not support the model export to JSON yet and plan it for an upcoming version.
Assemblies consists of instances of subassemblies or parts positioned in the 3d space. The transformation can be provided by a user or are calculated using our 3d solver based on constraints. Typical constraints are fastened, revolute or slider, while more advanced contraints like linear or circular pattern contraints, can dynamically add and position instances in an assembly. These contraints require mates or coordinate systems and the paths through instances to them to be defined. When positioning subassemblies, the design origin of the subassembly, can also be used to position the subassembly. These definitions of a matepath can be challenging to programm, but we suppport in the API to pass just the instance and we determine the matepath internally.
Some important notes about CAD in the cloud,
ClassCAD, like most other CAD systems, is a "in-memory" CAD. This means that a process or engine is started, and the complete model is loaded or created in memory for processing. The model itself can be stored in a database or in files elsewhere.
In cloud environments, where processes may crash or connections can be lost, it is crucial to store the state of an ongoing CAD interactive design session. Think of it as a high-performance auto-save feature that minimizes the risk of data loss. To understand the difference between stateful and stateless applications, we first examine the three different ways our engine can be used and how communication channels play a role.
- HTTP-Based CAD Service (Stateless) The simplest usage, where state management is not a concern, is through a REST-based CAD service. For example, you can load a parametric model, modify its parameters to create a variant, and then export it. In ClassCAD, this is done by sending a CCScript to an API endpoint. The script is executed, produces thes results and the system returns an "OK" status.
- Interactive CAD Design Sessions (Stateful) For interactive CAD design sessions, state management is essential. These sessions are typically implemented using WebSockets, which allow bidirectional communication. The browser remains connected to the CAD process through an instance or a load balancer. If any part of this connection fails, it must be possible to recover the session seamlessly. Today we provide a node.js based instance manager. In the future we will replace it by a more capable loadbalancer written in C++ and thus avoiding the need of node.js in many usecases situations.
- WASM-Based CAD Engine (Client-Side Execution) The WASM package is loaded once from our Cloudflare storage and then resides in your local browser cache. This executable runs directly in the browser, leveraging local CPU, GPU, and other resources. This is a single click installed parametric CAD system; no setup, just instant access.
State Management Approaches
For cloud-based CAD, state management can be centralized or decentralized, each with its own advantages and disadvantages.
- Decentralized State Management (Currently Supported) In this approach, the state is stored on the machine where the process is running. This ensures high performance since data remains local. However, it has limitations in optimizing resources when handling many users. While users can be swapped within the same machine, moving a user to another machine after a long session pause is more challenging.
- Centralized State Management This approach involves moving states to different machines and using in-memory databases like Redis to enhance performance. Unlike decentralized management, it allows for more flexible resource allocation across multiple users and machines.
Load balancers address this with a "sticky session" flag. If a user is swapped out due to inactivity, the system ensures they reconnect to the same machine when they resume. Note that on a single machine with N cores, N processes can run in parallel.
NOTE: It is also worth to mention, that the REST based approach can be made statefull by storing states and provide stateidentification with the parameters of each REST call.
Using Postman to work with ClassCAD
Make sure that ClassCAD is running as described in the download section. -Screendump Check the status of the engine by send a GET to http://localhost:9094/status
model storage
Model storage is a very important point to elaborate and with ClassCAD you have the options to store them in our native format or store the model as code.
Readablity:
Long term storage:
Performance:
standardized formats: