A2plus Workbench

Introduction
The A2plus workbench is an external workbench to assemble different parts in FreeCAD...

Installing
The A2plus workbench is an addon to FreeCAD. It can easily be installed via the menu. A2plus is under active development and will get new features frequently. Therefore you should update it regularly using also the menu. The A2plus code is hosted and developed on GitHub and can also be installed manually by copying it into FreeCAD's MOD directory.

Getting Started
At first switch to the A2plus toolbar in FreeCAD. To create an assembly create a new file in FreeCAD. At first this file needs to be saved. It is recommended (but not necessary) to save it in the same folder of the parts you want to assemble.

Now parts can be added to the assembly by using the toolbar button. The first added part gets a fixed position by default. (You can change this later via the part property .) Parts that are already in the assembly can be cloned with the toolbar button. To edit a part from the assembly, select it in the model tree and use the toolbar button. This will open the part into a new tab in FreeCAD or switch to its tab if the file is already opened. To import changes in parts into the assembly click on the toolbar button.

Imported parts will keep their external dependencies and can be edited. For well-defined parts like screws it is however useful that their shape cannot be edited. This can be achieved with the toolbar button that converts the selected part to a static copy of the original part.

Assembling
Assembling parts is done by adding constraints between parts. After a constraint A2plus will move the parts according to the constraint if possible. For complex constraints between parts A2plus might fail to solve the constraints. Therefore also have a look at section Troubleshooting for strategies to resolve such cases.

Constraints between parts are added by keeping the key pressed and selecting an edge or face of two parts. The constraint will be added attached in the model tree to the affected parts.

Keeping the Overview
The more parts you add, the more important it is to keep the overview. A2plus therefore offers these tools to move and view parts:


 * To move a part around in the assembly, select it in the model tree and use the toolbar button [[Image:A2p MovePart.svg|24px]]. When you placed the part where you like it, left-click with the mouse. If the moved part has already constraints the part will be placed accordingly by pressing the toolbar button [[Image:A2p solver.svg|24px]] because this triggers to resolve all constraints of the assembly.
 * To show a constraint select it in the model tree and use the toolbar button [[Image:A2p ViewConnection.svg|24px]]. This will make the whole assembly transparent and highlight the two things that are connected in the constraint. To go back to the normal view, left-click into the assembly.
 * To show only certain parts in the assembly, select these parts in the model tree and use the toolbar button [[Image:A2p Isolate Element.svg|24px]]. Alternatively you can hide a certain part by selecting it in the model tree and pressing to toggle its visibility.
 * To toggle the transparency view of the whole assembly you can use the toolbar button [[Image:A2p ToggleTransparency.svg|24px]].

Constraints
When creating a constraint such a dialog will be displayed after you pressed a constraint toolbar button: . For certain constraints it allows you to modify the constraint direction. With the button you can check in advance if this new constraint can be solved by A2plus. If not, have a look at section Troubleshooting.

A2plus provides the following constraints:

Point on Point
Select a vertex (point) on each part. The toolbar button adds the constraint. It will make the vertices coincident.

Point on Line
Select a vertex (point) on one part and an edge on the other part. The toolbar button adds the constraint. It will put the vertex on the edge.

Point on Plane
Select a vertex (point) on one part and a plane on the other part. The toolbar button adds the constraint. The constraint dialog allows you to specify an offset between the point and the plane. This offset can also be flipped between both sides of the plane. If the offset is zero, the constraint will put the vertex on the plane.

Sphere on Sphere
Select either a spherical face or a vertex (point) on both parts. The toolbar button adds the constraint. It will either make the center of the spheres, the center of the sphere and the vertex, or the vertices coincident.

Circular Edge on Circular Edge
Select a circular edge on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify an offset between the edges. This offset can also be flipped. You can furthermore set the constraint direction and lock the rotation of the parts. If the offset is zero, the constraint will put the edges concentric in the same plane.

Axis Coincident
Select either a cylindrical face or a linear edge on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify the axis direction. The dialog allows you furthermore to lock the rotation of the parts. The constraint will make the axes or lines coincident.

Axis Parallel
Select either a cylindrical face or a linear edge on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify the axis direction. The constraint will make the axes or lines parallel.

Axis on Plane
Select either a cylindrical face or a linear edge on one part and a plane on the other part. The toolbar button adds the constraint. The constraint will make the axis or line parallel to the plane.

Plane Parallel
Select a plane on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify the constraint direction. The constraint will make the planes parallel.

Plane on Plane
Select a plane on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify a constraint direction and an offset between the planes. This offset can also be flipped. If the offset is zero, the constraint will make the planes coincident.

Plane Angular
Select a plane on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify an angle between the planes. The constraint will make the planes at first parallel and the set the specified angle.

Coincidence at Center of Mass
Select either a closed edge or a plane on both parts. The toolbar button adds the constraint. The constraint dialog allows you to specify an offset between the edges or planes. This offset can also be flipped. You can furthermore set the constraint direction and lock the rotation of the parts. If the offset is zero, the constraint will put the edges or planes into the same plane.

Subassemblies
An assembly can contain other assemblies. They are added like parts by pressing the toolbar button and selecting a  file containing an assembly. Such subassemblies can also be edited like parts using the toolbar button. Please assure sure for higher assembly stages that you update the assembly via the toolbar button when there were changes.

Constraint Handling
Possible constraints for a selection are displayed in the toolbar and the Constraint Tools dialog by enabling the corresponding buttons. The Constraint Tools dialog is opened via the toolbar button. It is intended to stay open to be able to add quickly several constraints to the assembly.

Existing constraints can be edited by selecting them in the model tree and then using the toolbar button. This opens the Constraint Properties dialog.

Constraints can be deleted either by selecting them in the model tree and pressing or by selecting a part with constraints in the model tree and using the toolbar button.

All constraints can any time be resolved with the toolbar button. If the toolbar button is turned on a resolve is automatically done after every edit of a constraint.

The toolbar button affects the constraint that was added most recently. It flips the constraint direction.

Assembly Structure
The toolbar button  creates a HTML file with the structure of your assembly. The file will by default be created in the folder of your assembly file. The structure looks like this one:

Degrees of Freedom
The button outputs a list of all parts in your assembly that are connected with a constraint. It states how many degrees of freedom and dependencies every part has. The list is output into FreeCAD's widget Report view. If this widget is currently not visible, it can either be shown by right-clicking into an empty part of the FreeCAD toolbar area and then choosing it in the appearing context menu or with the menu.

Shape of whole Assembly
Sometimes it is necessary to have the whole assembly combined as one shape. This shape can then for example be used for 3D printing in the Mesh workbench or for drawings in the TechDraw workbench. It is created using the toolbar button. The shape is by default not made visible. Use the same toolbar button to update the shape in case of changes in the assembly.

Troubleshooting
Sooner or later you will get the problem that A2plus cannot solve the constraints you set. To overcome this, there are different strategies:

Fixing Position
This strategy is no longer necessary for assemblies created with A2plus 0.3.11 or newer because A2plus issues now a warning for missing fixed positions.

When you set a constraint between two parts and no part has the property set to true or is connected by a constraint to a part with  set to true, the constraint cannot be solved. The same happens if both parts of the constraint have set to true.

Then in some cases A2plus outputs the info about the failed solution, but sometimes you only see that the parts are not moved accordingly and in the Report view widget of FreeCAD you see "REACHED POS-ACCURACY :0.0". This means the solver finished without errors but it could actually not solve the constraints.

Therefore check that at least one of your parts in the assembly has set to true. Then assure that you only set constraints to a part which is somehow connected to the fixed part. To visualize these dependencies, see section Assembly Structure.

Checking Constraint Direction
Sometimes constraints seem to be consistently defined but they can nevertheless not be solved. An example: Assume you have a constraint set for two planes. Now you want to set for the same planes the constraint and A2plus cannot solve this. Then the constraint directions of and  are different. Use the same direction for both constraints to fix this.

Deleting Constraints
Most cases of unsolvable constraints occur directly when adding a new constraint. The solution is then to delete the constraint you added the last. A2plus will also propose this.

Sometimes the deletion strategy is the only one, for example when you edited a part in FreeCAD so that faces or edges connected to constraints are missing. You should then delete one constraint after another that is connected to the changed part. Use the toolbar button after every deletion to see if you reached a solvable state.

When you got an assembly that can be solved, add step by step the constraints you need.

Moving Parts
In many cases the solver need only better start values to solve the constraints. Take for example the case that you have an axle part and a wheel part. You add a constraint and get no info that the solver failed but the parts are not moved accordingly and in the Report view widget of FreeCAD you see "REACHED  POS-ACCURACY :0.0". A solution for this is to move the parts closer to that position you like to get by the constraint.

Note: Assure that at least one part of the constraint has the property set to false.

Repairing Assembly Tree
If you cannot see a clear reason why some constraints cannot be resolved, you can try to use the toolbar button. This will resolve all constraints and re-group then again under the different parts.

Avoiding Accented Characters
On some operating systems you can get problems if the file names or the file paths of parts or the assembly contain accented characters. Therefore avoid such characters and also special characters in general.

A2plus Preferences
The a2plus preferences can be accessed via FreeCAD's menu and there in the section A2plus. You can set the following options:

Default solving method

 * Use solving of partial systems The solver begins with a part that has the property set to true and continues with a part constrained to it. All other parts are not calculated. If a solution could be found, the next constrained part is added for the calculation and so on.
 * Use "magnetic" solver, solving all parts at once The solver tries to move all parts at once in direction to a part that has the property set to true. Note that this will in most cases take more time for the calculation of a solution.
 * Force fixed position This sets for all parts in the assembly the property to true. Then no calculation is actually performed since all parts will always be fixed to the positions where they were created.

Default solver behavior

 * Solve automatically if a constraint property is changed The solver will automatically be started. The same as turning on the toolbar button [[Image:A2p ToggleAutoSolve.svg|24px]].

Behavior when updating imported parts

 * Recalculate imported parts before updating them All parts of the assembly, including subassemblies, will be opened in FreeCAD to be reconstructed using values from spreadsheets. This feature is designed to construct fully parametrically. Note: This feature is very experimental and not recommended for important projects.

User interface settings

 * Show constraints in toolbar If this option is not used, the toolbar buttons for the different constraints are not visible to save space in the toolbar. New constraints can still be set using the Constraint Tools dialog (toolbar button [[Image:A2p DefineConstraints.svg|24px]]).

Storage of files

 * Use relative paths for imported parts Uses relative file paths to the part files.
 * Use absolute paths for imported parts Uses absolute file paths to the part files.
 * All files are in this project folder: All project files have to be in the specified folder. It doesn't matter if they are in subfolders of this folder. Note: No file is allowed to exist several times in the folder (e.g. in different subfolders). This option is helpful to work on different machines because then one only has to copy the project folder.