My First Assembly
In this chapter, we're going to create our first assembly. In this example, we will use the flange part from the chapter before to create an assembly. We will add the flange twice to the assembly and add a bolt and a nut. Both parts come from a library and already contain coordinate systems for assembling.
So let's start coding!
- Create the root assembly and load products
- Add the products to the assembly
- Adding constraints to the nodes
#1. Create the root assembly and load products
First, we create an empty assembly; it will be the root assembly. As explained in the beginning, we will add the flange twice, then a bolt and a nut. So we need to load these products into the assembly as arraybuffer. The bolt and the nut can be found in buerli-examples in the folder client/src/resources/history/Flange. Next, add the flange part saved in native file format to this directory. Use the following snippet in your template.
You won't see anything on the screen; we just loaded the products but didn't add any instance yet. So let's go to the next chapter.
#2. Add the products to the assembly
Next, we add two nodes or instances of the flange, then a bolt node, and finally a nut node to the assembly. We then retrieve the necessary work coordinate systems (WCS) from the parts to connect the nodes using 3d constraints. Coordinate systems, also called mates, are used for positioning nodes in the assembly relative to each other. Copy the following code snippet to your template.
As result you should see the following graphics. All nodes have been added to the origin. We even can't see the two flanges, because they have exactly the same position.
As you probably expect, we have to fix the postions by adding constraints to the nodes.
#3. Adding constraints to the nodes
Depending on the constraints we set, the nodes will have different degrees of freedom. In our example we will simply use the fastened origin and the fastened constraint. We will follow the next steps to constrain the whole assembly.
- Create a fastened origin constraint to fasten the first flange to the origin
- Create a fastened constraint between the first and the second flange
- Create a fastened constraint between the bolt and the first flange
- Create a fastened constraint between the nut and the second flange
Now we should have an assembly which is fully constrained. Save the assembly like we did with the part and open it in buerligons to see what we have created.