The Freecad User Book

Workflow

Tags

Freecad, Assembly 3, Constraint, Connector, Container.

Freecad Version Info

OS: Windows 10 (10.0) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.17089 +1543 (Git) Build type: Release Branch: LinkStage3 Hash: 950c082111ae5ebeefb4dddc90a80dc9b54b2408 Python version: 3.6.8 Qt version: 5.12.1 Coin version: 4.0.0a OCC version: 7.3.0 Locale: English/United States (en_US)

Files

asm-001.fcstd
Washer Component
asm-002.fcstd
Washer and Block
asm-003.fcstd
Washer, Block, Project Assembly Container, unassembled
asm-004.fcstd
Washer in the wrong orientation
asm-005.fcstd
Completed assembly, wrong washer orientation corrected
asm-006.fcstd
Completed assembly with pre-positioning.
asm-007.fcstd
Broken connector recovered.

Workflow Alternative 1

This workflow is applicable for components that are simple and have a limited functional set of Connector nodes with dedicated meanings. Examples are screws, washers, nuts, a combustion engine block or a gearbox. Components may be complex and have many individual mating interfaces, but it might be worth the effort to declare and describe connectors, to make the component user's life easier.

This is also the workflow suited for beginners to become familar with the concept of Connectors.

To create an Assembly,…

  1. Create a new Assembly object.
  2. Add one or more Parts to the Assembly to define the geometry.

To create Constraint Connectors,

  1. Select a geometry element in the 3D window, and drag the associated node in the Model Tree on the Constraint Connectors node.
  2. Give the connector a meaningful name and/or description.

To create an Assembly Constraint,

  1. Select a set of connectors Connectors.
  2. Apply a suitable Constraint command.

Workflow Alternative 2

The alternative workflow in Assembly 3 is very similar, if not identical, to assembly workbenches that do not have the notion of Constraint Connectors or its equivalent. The component designer simply does not wrap the component in an assembly container, or omits the definition of Connectors. The component user creates them as needed, directly from geometry elements.

This workflow for creating constraints is well suited for components with a prohibitive number of potential mating interfaces, and/or where it is likely that only a few of them will be used by the component user. Example: A perforated plate — there are potentially hundreds of holes, but only a few will be used to mate with other components.

When a Constraint is created, Connectors and ConnectorLinks are created implicitly, often without being noticed. Therefore the workflow is not very well suited for beginners to learn the concept of Connectors.

The workflow goes as follows:

  1. Create an Assembly container.
  2. Add Parts.
  3. Apply a set of geometry elements.
  4. Execute a suitable Constraint.
  5. Optional: Rename and/or describe implicitly created Connector nodes.

The necessary Connectors and ConnectorLinks are created implicitly, and bound to the geometry elements.

Enough theory, the next chapter is a hands-on tutorial. We will deepen the gained knowledge, and see how to get around some unexpected obstacles.

Walkthrough

In this section we will create two simple components, show various ways to bind connectors to geometry, and mate them with an Assembly Constraint. Then we will break a connector with a design change, and show how to repair it without breaking the contraint.

It is recommended, but not mandatory, that a component developer wraps components with an Assembly container and explicitly declares Constraint Connectors for use by component users.

    The Washer

    A Washer

    1. Create a new project file, and save it under the name "asm.fcstd".
    2. Switch to the Part Design workbench.
    3. Select the asm project node in the model tree.
    4. Create a new Body.
    5. Create a new Sketch on the XZ plane.
    6. Create two circles with their center constrained to the sketch origin.
    7. Constrain their diameters to "8.3" and "16 mm".
    8. Leave the sketch.
    9. Create a new Pad with a length of "2 mm".

    Wrap the Body with an Assembly:

    1. Switch to the Assembly 3 workbench.
    2. Create a new Assembly.
    3. Right-click on the Property Panel, then click Show all.
    4. Set the Label property to "Assembly000 000".
    5. Set the Label2 property to "Washer".
    6. Drag the Body node and drop it on the washer assembly.

    The Body appears under the Parts node of the washer assembly.

    Now we will define the Constraint Connectors of the washer component.

    1. Select the Elements node.
    2. Set its Label2 property to "Constraint Connectors" to describe the purpose of this node.
    3. Press "1" to select the front view, then tilt the view slightly back so that you have a clear view on both inner edges.
    4. Select the two inner edges if the washer body. These edges are owned by the Pad feature.
    5. Drag the Pad node on the Elements node.

    Two child nodes are created: Element and Element001. These are the Connectors that constraints can bind to. They are bound to the inner edges of the washer. If they are selected or if the mouse pointer hovers over them, they are highlighted in the 3D view.

    Now we will provide a better identification for the connectors.

    Depending on how you selected the edges in step 18, your connectors might have been assigned differently.

    1. Select the first Connectors child node, and verify the highlighted lower inner edge.
    2. Set the Label2 property to "Washer Lower Inner Edge".
    3. Select the second Connectors child node, and verify the highlighted upper inner edge.
    4. Set the Label2 property to "Washer Upper Inner Edge".

    At this point, the washer component is finished. Some cleanup steps:

    1. Collapse all open nodes.
    2. Hide the washer assembly.
    3. Save a copy under the file name "asm-001.fcstd".

    A Block Component

    In this step we will define a simple block with a bunch of holes where we can attach the washers to.

    To start here from scratch, …

    • Open the file asm-001.fcstd
    • Save as "asm.fcstd" to create the work file.
    1. Switch to the Part Design workbench.
    2. Select the asm project file node in the Model Tree.
    3. Create a new Body.
    4. Create a new Sketch on the XY plane.
    5. Create three circles with their center constrained to the X axis, and the middle one constrained to the sketch origin.
    6. Constrain their diameter to "8 mm".
    7. Constrain the center of the outer circles symmetrical to the Y axis.
    8. Draw a rectangle around them.
    9. Constrain the end points of a vertical edge symmetrical to the X axis.
    10. Constrain the end points of a horizontal edge symmetrical to the Y axis.
    11. Constrain the distance between the outer circles to "20 mm".
    12. Constrain the horizontal edge of the rectangle to "40 mm".
    13. Constrain the vertical edge of the rectangle to "20 mm".

    The sketch should be fully constrained now.

    You can name the datum constraints according to this image:

    Figure 10: Constraint names and values.
    1. Leave the sketch.
    2. Create a new Pad, lenght = "10 mm".
    3. Press "0" on the keyboard to get a standard view on the component.
    4. Select the upper edges of the holes.
    5. Create a new Chamfer with a size of "0.7 mm".
    6. Collapse Body001 and its child nodes.

    We will now wrap the body with an Assembly container:

    1. Switch to the Assembly 3 workbench.
    2. Create a new Assembly.
    3. Right-click on the Property Panel, then click Show all.
    4. Set the Label property to "Assembly001 000".
    5. Set the Label2 property to "Block".
    6. Drag Body001 on the block assembly.

    Now we will define the Constraint Connectors of the block component.

    1. Select the Elements001 node.
    2. Set its Label2 property to "Constraint Connectors" to describe the purpose of this node.
    3. Select the two outer chamfer edges of the outer bore holes. These edges are owned by the Chamfer feature.
    4. Drag the Chamfer node on the constraint connectors node.

    Two child nodes are created: Element002 and Element003. These are the Constraint Connectors that constraints can bind to.

    1. Select the two Connector nodes.
    2. Set the Label2 property to "Bore Hole Chamfer Outer Edge".

    It is quite risky to bind a geometry element generated by a late feature such as this chamfer to a Constraint Connector. If an earlier Feature of the Body is modified, the edge names might disappear, or worse, might get a different meaning. We will investigate that and the implications later.

    A better method is shown with the center hole:

    1. Select Pad001 and make it visible.
    2. Select the upper edge of the bore hole. It is owned by the Pad001.
    3. Drag Pad001 on the constraint connectors node. This creates a new Constraint Connector in the Block component.
    4. Set its Label2 property to "Center Bore Hole Upper Edge".
    5. Select the Chamfer node and make it visible.
    6. Select Element004 and watch how it hovers in thin air above the chamfer.

    Compared with the previous method, this Connector definition is more robust, because it was defined on an earlier Feature of the Body. However, there is still a better option:

    1. Hide the Chamfer node.
    2. Expand Pad001, and make Sketch001 visible. The circles lie on the XY base plane, on the same level with the underside of the block.
    3. Select the three circles in the 3D window. They are owned by Sketch001.
    4. Drag Sketch001 on the Constraint Connectors node.
    5. Set their Label2 property to "Bore Hole Underside Edge".
    6. Hide Sketch001 and show Chamfer.

    The block component is finished with six constraint connectors where things like washers can be mated with. We will try that in the next step. But before, some cleanup steps:

    1. Collapse the block and all of its child nodes.
    2. Make the washer assembly visible.
    3. Save a copy of the work file under the name "asm-002.fcstd".

    Mating Washer and Block

    Now is the time to get involved with Assembly Constraints.

    It is necessary to have the model tree option Sync selection active to use this workflow. Click the menu View > Treeview actions, and make sure that the entry Sync selection is active.

    To start here from scratch, …

    • Open the file asm-002.fcstd
    • Save as "asm.fcstd" to create the work file.
    1. Switch to the Assembly 3 workbench.
    2. Expand the washer's Constraint Connectors node.
    3. Select the Washer Lower Inner Edge connector.
    4. Expand the block's Constraint Connectors.
    5. Control-click to select the first Outer Hole Outer Chamfer Edge connector.

    6. With two Constraint Connectors selected, click the Plane Coincident constraint button on the Assembly 3 Constraints toolbar.

    Oh. The toolbar is inactive. Let's activate it!

    1. Click the menu View > Toolbars > Assembly 3 Constraints.

    Wait — the toolbar is already active! What's wrong here…?

    The answer is simple if you know the answer: There is no Assembly container that can store the constraint. The container must contain the objects to be mated. So let's create one!

    1. Create a new Assembly.
    2. Set the Label to "Assembly002 000".
    3. Set Label2 to "Project Assembly Container".
    4. Select the Elements002 node.
    5. Set its Label2 property to "Constraint Connectors".
    6. Save a copy of the work file under the name "asm-003".

    Continue:

    To start here from scratch, …

    • Open the file asm-003.fcstd
    • Save as "asm.fcstd" to create the work file.
    1. Drag both block and washer assemblies on the project assembly container.
    2. Once again, expand the washer's Constraint Connectors node.
    3. Select the Washer Lower Inner Edge connector.
    4. Expand the block's Constraint Connectors.
    5. Control-click to select the first Outer Hole Outer Chamfer Edge connector.
    6. On the Assembly 3 Constraints toolbar, click the Plane Coincident constraint button.

    The washer should have jumped to the bore hole. If not, …

    1. Click the menu Assembly3 > Solve constraints.

    Depending on the outside air temperature and the azimuth angle of the moon at a quarter to midnight, one of three things can happen:

    If option three happend, save all your files, shut down the computer, go out, have a beer or two and be happy.

    To be honest: That never has happened to me…

    Option 2 – Inconsistent Constraints

    I'm not really sure what's the problem here, the error message does not really help out. I guess that the solver cannot decide in which direction to turn the washer so that the Connector planes become coplanar. So we will help a little bit and tilt the washer slightly:

    1. Undo the last command, assembly constraint creation.
    2. Right-click the washer, click Assembly > Axial move part. The well-known Translation Tool appears.
    3. Tilt the washer slightly, perhaps like so:
    4. Select the two connectors, as shown above.
    5. Click the Plane Coincident constraint toolbar button.

    It happened that the toolbar remained inactive on the first try. Just deselect everything and try again. Et voilá — the washer jumped to the expected position. In the wrong orientation, of course.

    Anyway, …

    1. Save a copy under the name "asm-004.fcstd" to have as state for retries.

    Well, I'm not totally unhappy with the result, because now we can continue with…

    Option 1 – Washer in Wrong Orientation

    That's the situation:

    But let's see first what's happend in the Model Tree:

    • The project assembly container has gotten a new child node, Constraints002. To be precise, the node was already there, but not visible.
    • There is a new node named PlaneCoincident. This is our constraint that we just have created.
    • The constraint node has two child elements, _Element and _Element001. These are Link objects that point to other nodes with the same name.
    1. Right-click the PlaneCoincident > _Element node, then click Select linked object.

    This carries us to another node with the same name, but with a different parent, named Elements002, which holds the Constraint Connectors of the project assembly container. It appears that all connectors that were used in a constraint are automatically published in the Constraint Connectors collection of the container assembly.

    1. Set the description-Label2 of Elements002 to Constraint Connectors.
    2. Right-click the Elements002 > _Element node, then click Select linked object to follow the link chain to the next node.

    And indeed, that takes us to the Connector described as Washer Lower Inner Edge.

    Let's hold and think for a minute. On the previous page, we have defined that a project assembly container has no public constraint connectors, because a project is not intended to be mated with other assemblies. Clearly, the nodes in the Constraint Connectors child list are internal connectors. So if we find a way to designate them as "internal", we are back on track. A suggestion:

    Elements with no Description in the Constraint Connectors collection are considered "internal". A "public" or "external" connector has a non-blank description string.

    So if we leave everything as is, the world is all right.

    Just to be curious:

    1. Select the node Elements002 > _Element.
    2. Set the Label to "Washer Lower Inner Edge".
    3. Select the node Elements002 > _Element001.
    4. Set the Label to "Outer Hole Outer Chamfer Edge".

    Note that the Connectors under the Plane Coincident constraint also changed their names!

    To complete the documentation work, …

    1. Select the Plane Coincident node.
    2. Set its Label2 to "Washer on the right outer bore hole", or something similar descriptive.

    But now back to the problem: The washer is in the wrong orientation. We have three options to correct that:

    • Use the washer's other connector.
    • Bring the washer close to the desired position and orientation before creating the constraint.
    • Dig through the properties of the constraint and see if we can find something useful.

    Start with number three. Try the various angle properties. Nothing happens. Try the offset property. That works — but not an ideal solution.

    Let's check number one.

    1. Expand Parts002 > Assembly000 000 > Elements.
    2. Select Elements001.

    This is the washer upper inner edge. Inspect the edge in the 3D window. This could be the one.

    1. Drag Elements001 on Plane Coincident > Washer Lower Inner Edge.

    This rebinds the constraint to a different connector. Note that the washer jumped into the desired position, finally. Also note that the label changed, it is now prefixed with an underline character. A look into the constraint connectors list shows a new entry, named "_Washer Lower Inner Edge". This is misleading, because it is the upper inner edge:

    1. Right-click _Washer Lower Inner Edge, click Select linked object. This selects the same named node in the Constraint Connectors collection.
    2. Set its Label property to "Washer Upper Inner Edge".

    With this last action the tutorial is finished. Some final cleanup steps, as always:

    1. Collapse all open nodes.
    2. Save a copy under the name "asm-005.fcstd".

    Conclusion

    In this tutorial we have learned

    In the next tutorial, we will try the second option, prepositioning the components to be mated to help the solver deliver the expected results.

    Pre-Positioning Components

    In this small tutorial, we will try whether positioning components before mating them with constraints helps the solver to deliver better results. In the previous example we got the washer in the wrong orientation, so let's see if the strategy helps.

    1. Load the file "asm-003.fcstd".
    2. Save as "asm.fcstd" to create the work file.
    3. Drag washer and block components on the project assembly container.
    4. Select the Washer Lower Inner Edge to get an idea how to move the component.
    5. Right-click the washer, then click Assembly 3 > Axial move part. The Translation Tool appears.
    6. Pull the washer up, and tilt it backwards by 15 degree or so.
    7. Select the washer's lower inner edge connector.
    8. Control-click on the Outer Hole Outer Chamfer Edge connector.
    9. Click the Plane Coincident button on the Assembly 3 Constraints toolbar.

    The washer jumped to the desired position, in the desired orientation. Q. e. d.

    Now let's have a look at how the solver did the job.

    1. Collapse washer and block assemblies and their child nodes.
    2. Right-click on the Property Panel and uncheck Show all. This gives us a leaner interface.
    3. Select the block assembly, and inspect its Placement properties.

    It appears that the block remained in its initial position.

    1. Select the washer assembly, and inspect its Placement properties.

    The washer was moved and rotated, but it could have been the other way round. If it is important that the block stays in its default position, select an arbitrary face and click the Lock Constraint toobar button before you mate the components.

    Some final cleanup steps:

    1. Collapse all nodes.
    2. Save a copy under the name "asm-006.fcstd".

    Broken Constraint Connectors

    In this tutorial we will learn how to repair a broken connector.

    Setting up the work file:

    1. Load the file "asm-006.fcstd".
    2. Save it as "asm.fcstd" to create the workfile.

    As you can see, the washer is mated to the bore hole chamfer on the upper face of the block. And one of the connectors involved is an outer chamfer edge. Let's see what happens if we delete the chamfer feature on the block body 

    1. Hide the washer assembly.
    2. Right-click Assembly001 000 > Parts001 > Body001 > Chamfer, then click Delete.

    The chamfers on the upper faces of the block disappear as expected. But another node in the tree unfolded and presents two nodes with an error icon:

    When you hover the mouse pointer of the first defective node, an error message box appears and notifies that a geometry element from Body001.Chamfer, Edge12 could not be found. Not surprising, we just deleted that thing.

    The next steps illustrate how these broken connectors can be repaired.

    We will bind the upper edge of the pads to the connectors.

    1. Select the broken connectors of the block component, and find out which one is under the washer. It is the first one, Element002.
    2. Select the upper edge of the corresponding bore hole in the 3D window. The edge is owned by Pad001.
    3. Drag Pad001 on the broken connector identified in step 6, Element002.
    4. Change the description in Label2 to "Outer Bore Hole Upper Edge".
    5. Repeat from step 7 with the other outer bore hole edge.
    6. Make the washer assembly visible.
    7. Collapse all nodes.

    Now let's verify that the constraint is still intact.

    1. Select Assembly001 000 > Parts001 > Body001 > Pad001 > Sketch001.
    2. Expand the Constraints property.
    3. Set L0 to "60 mm".
    4. Set L1 to "40 mm".

    The block dimension were updated immediately, and the washer followed to the new bore hole location. If not, …

    1. Right-click Pad001, click Recompute object.
    2. And/or click the menu Assembly3 > Solve constraints.

    Q. e. d.

    As always, final cleanup steps:

    1. Collapse all nodes.
    2. Save a copy under the name "asm-007.fcstd".

    Conclusion

    In this tutorial we learned how to repair broken Constraint Connectors by rebinding them to another suitable geometry element.