Building Assemblies
Assembly modeling is a fundamental aspect of CAD systems, allowing users to define how different components come together to form a complete product. In ClassCAD, our CAD infrastructure offers flexible ways to create assemblies, whether through interactive methods, APIs, or automated processes. This article explores the assembly structure, the concept of mates, and 3D constraints, providing insights into how these elements work together to define precise assemblies.
Understanding the Assembly Structure
In ClassCAD, an assembly consists of multiple components arranged in a hierarchical structure. This means that an assembly can contain subassemblies, which in turn contain their own components. Managing these hierarchical relationships is crucial for ensuring accurate positioning and motion within the assembly.
Template-Based Approach
ClassCAD supports a template-based approach for parts and assemblies. You can instantiate parts and assemblies in your assembly model, provided they are available in the part or assembly container. This is achieved by either adding pre-existing components or creating new ones within the system.
Example: Nut-Bolt Assembly in JSON
A simple nut and bolt assembly can be represented in JSON format as follows:
{
"ident": "NutBoltAsm_Template",
"instances": [
{
"ident": "Bolt_Instance",
"template": "Bolt_Template"
},
{
"ident": "Nut_Instance",
"template": "Nut_Template"
}
],
"templates": [
{
"ident": "Bolt_Template",
"type": "part",
"reference": {
"location": "https://raw.githubusercontent.com/dm385/cad-files/main/json-assembly/Bolt.ofb",
"type": "ofb"
}
},
{
"ident": "Nut_Template",
"type": "part",
"reference": {
"location": "https://raw.githubusercontent.com/dm385/cad-files/main/json-assembly/Nut.ofb",
"type": "ofb"
}
}
],
"constraints": [
{
"type": "CC_FastenedOriginConstraint",
"mate1": {
"path": ["/NutBoltAsm_Template/Bolt_Instance"],
"csys": "WCS_Origin",
"flip": 4,
"reorient": 0
}
},
{
"type": "CC_FastenedConstraint",
"mate1": {
"path": ["/NutBoltAsm_Template/Bolt_Instance"],
"csys": "WCS_Nut",
"flip": 4,
"reorient": 0
},
"mate2": {
"path": ["/NutBoltAsm_Template/Nut_Instance"],
"csys": "WCS_Hole-Top",
"flip": 4,
"reorient": 0
}
}
]
}
This JSON structure defines a simple Nut-Bolt assembly using a template-based approach. The nut and bolt are instantiated from predefined templates and positioned using mates. Constraints ensure that the nut and bolt are properly fastened together.
Approaches to Assembly Building
ClassCAD offers multiple ways to construct assemblies, catering to different user needs:
1. Interactive Assembly Building in Buerligons
For users who prefer a visual and intuitive approach, Buerligons, our end-user CAD system, provides interactive tools for assembling components. Users can select parts, define mates, and apply constraints in a seamless interface, making it easy to construct complex assemblies.
2. API-Based Assembly Creation
For developers and advanced users, our API provides powerful functionality for programmatically defining assemblies. The assemble
API allows for automated placement of components, mate creation, and constraint definition, enabling integration into custom workflows and applications.
3. Automated Assembly via JSON Requests
For automation and scalability, ClassCAD supports sending JSON-structured requests to an HTTP server. This approach is ideal for:
- Batch processing of assemblies
- Integration with external systems
- Automated validation and testing of designs
By structuring assembly definitions in JSON, users can leverage scripting and automation to efficiently generate complex assemblies.
The Role of Mates
Mates in ClassCAD serve as coordinate systems attached to specific geometric entities. They define relationships between parts, ensuring that components are properly positioned relative to one another. Mates are particularly useful for:
- Aligning components: Ensuring that surfaces, edges, or points align correctly.
- Defining movement: Restricting or allowing motion based on constraints.
- Handling subassemblies: Finding precise locations for connections within nested structures.
3D Constraints and Their Role
To control how components interact, ClassCAD provides several types of 3D constraints. These include:
- Fastened Constraint: Fixes two components together, preventing any relative movement.
- Revolute Constraint: Allows rotational movement around a single axis while restricting all other motion.
- Prismatic Constraint: Permits linear sliding motion along a specified axis.
- Cylindrical Constraint: Enables both rotational and translational movement along a shared axis.
Each constraint relies on mates to determine precise placement, ensuring that components behave as expected within the assembly.
We also provide linear and circular pattern contraints, that dynamically add and position instances in an assembly.
Instance Positioning and the 3D Constraint Solver
Every instance in an assembly has a position and transformation within the model. The assembler functionality in ClassCAD uses a 3D constraint solver to determine these positions. The positioning follows a hierarchy:
- Default Positioning: If no transformation is supplied in the JSON definition, parts and subassemblies are initially placed at the origin.
- User-Supplied Transformations: If transformations are provided, they are used to position components accordingly.
- Constraint-Based Positioning: When constraints are defined, the constraint solver calculates the final positions, overwriting any previously defined transformations.
This structured approach ensures that assemblies are positioned accurately based on the intended design logic, providing flexibility in defining assemblies interactively, via API, or through automation.
Understanding Mate Paths in Constraints
One of the more advanced aspects of assembly modeling in ClassCAD is defining mate paths within constraints. A mate path specifies how to navigate through an assembly hierarchy to locate a particular mate position deep within a subassembly. This is critical for ensuring that constraints apply correctly across nested components. As a standard user, working with Buerligons or the assembly api you do not have to worry, because the sytem will support you. An advanced user creating a JSON ASM in an external system can contact the team. In ClassCAD we often cache data to efficiently run operations.
Example of a Mate Path
Consider a scenario where a constraint needs to reference a mate within a subassembly:
Assembly1 -> SubassemblyA -> PartX
To define a constraint that connects PartX
to another component in Assembly1
, the mate path must traverse the hierarchy correctly, ensuring that the correct reference frame is used. Understanding and defining these paths accurately is key to achieving the desired assembly behavior.
Conclusion
Assembly building in ClassCAD provides powerful tools for creating and managing complex structures. Whether using interactive methods, APIs, or automated workflows, the flexibility of ClassCAD ensures that users can efficiently construct and control assemblies.
With these concepts in hand, users can leverage the full potential of ClassCAD for their engineering and design needs.