after a lot of brainstorming in the assembly without solver thread, and also some on the Assembly3 preview and New Assembly 4? threads, a new assembly workbench for FreeCAD has emerged, called sequentially in the list Assembly #4.
This thread starter will be updated if new versions of the workbench appear. The main development repository is https://github.com/Zolko-123/FreeCAD_Assembly4
The basic principle is the one from assembly without solver: FreeCAD's App::Part container serve as basic building blocs, that are inserted into each other using the App::Link interface introduced with FreeCAD 0.19.
The advantage of App::Link feature is that it's possible to link FreeCAD objects between files, seamlessly: a model in a file will appear in the tree of another model in another file, but the data is not copied across. This allows to create many instances of the same object without any overhead, allowing the creation of large assemblies. In other words, this is identical what other CAD systems do when speaking of assembly.
The particularity of Assembly 4 is that the placement of the inserted (linked) part is done by matching corresponding coordinate systems in the parent assembly and in the linked part: therefore, there must be at least 1 coordinate system in the assembly and at least 1 in the part. There can be many coordinate systems in each, and the user can choose which of these coordinate systems — in the assembly and in the part — shall be used. Under the hood, for those interested in the technical details, the ExpressionEngine of the Placement property of the App::Link is used to superimpose the Placement of two coordinate systems — one in the assembly and one in the inserted part — which fixes all degrees of freedom of the inserted part.
Another particularity of Assembly 4 is that there is no difference between a part and an assembly: it's possible to mix datum objects, 2D sketches, 3D geometries and inserted parts at will. This feature can prove to be extremely powerful once a user gets used to it.
Please bear in mind that Assembly 4 is not compatible with the stable FreeCAD v0.18, it needs the App::Link frame-work originally developed by realthunder and merged into FreeCAD v0.19. Pre-built binaries for this development branch can be downloaded here.
Addon Manager: The preferred method for installing the Assembly 4 workbench is through the Addons Manager (menu > Tools > Addons Manager). It is listed as Assembly4.
Manual install: you can download the Assembly 4 workbench as a ZIP archive here: it must be extracted somewhere, and the Mod_Asm4 subdirectory must be moved to the regular FreeCAD/Mod directory, where all other workbenches reside:
- for Windows it's in C:\Users\********\AppData\Roaming\FreeCAD\Mod
- for Linux it's in ~/.FreeCAD/Mod
For the impatient, there are tutorials that guide you step-by-step through the building of simple assemblies :
- https://github.com/Zolko-123/FreeCAD_As ... TORIAL1.md
- https://github.com/Zolko-123/FreeCAD_As ... TORIAL2.md
In order to insert a part in Assembly 4 (and App::Link in general), it needs to be open in FreeCAD. It also needs to be saved to disk, because the App::Link framework needs the file's path. Unfortunately, it seems that when creating a new part and saving it, the App::Link doesn't "see" the file's path. So the surest way to use this workbench is to have files created, saved, closed, and re-opened: this way, the App::Link always sees the files you need. The workflow is then the following:
- create a new (empty) file
- click on the "create Model" button: this creates an App::Part container with all the needed elements
The Assembly 4 toolbar has following buttons:
- Create a new Model : creates a new App::Part in the current active document and populates its tree with necessary items to make it ready for Assembly4
- Create a new Body : creates a PartDesign::Body container in the selected App::Part
- Create a new Part : creates an App::Part object in the current document
- Import external Part : this opens a dialog allowing to link external object (the corresponding document must be open in FreeCAD)
- Place linked Part : allows to attach the linked part to LCS in the current assembly
- Insert Fastener : drop-down menu that allows to insert screws, nuts and washers from the Fasteners WB. If this WB is not installed the command is greyes-out
- make Array: creates a linear or circular array of links in the assembly. This feature is as yet experimental.
- Create Sketch : creates a Sketch in the currently selected Part
- Create Datul : creates a new PartDesign::DatumObject (LCS, Plane, Axis, Point) in the currently selected Part
- Import Datum : this opens a dialog allowing to select an existing datum object (LCS or Point) in an existing linked part in the assembly, and creates a datum object of the same type in the assembly placed where the original datum object is. This is useful if one wants to copy into the assembly something from a sub-part. This is parametric, meaning that when the original datum object moves the copied one moves accordingly.
- Place Datum
- Add Variable : adds a variable that can be used in the entire document
- Animate assembly : allows to change a variable between 2 values, and updates the assembly at each step
- Recompute and Update
After the root App::Part container — called 'Model' in Assembly 4 — has been created , there are 2 ways to have 3D geometries in a part:
- import or copy an existing Body from an existing FreeCAD document into the 'Model'. This allows easy re-use of your existing FreeCAD designs
- create a Body in the root 'Model' and use the PartDesign workbench as usually in this Body
LCS - Local Coordinate Systems
As said before, the principle of Assembly 4 is to match coordinate systems in the assembly and in the part. Therefore, coordinate systems need to exist in both the assembly and in the part. Technically, they are FreeCAD objects of type PartDesign::CoordinateSystem. When such an LCS is first created, it is placed at the origin of the part. In order to be useful, an LCS must be located and oriented at a position where something is attached: a hole, an edge, offset ... For that, use the MapMode of the LCS object:
There are basically 2 methods :
- either create the 3D geometry first, and then place the LCS on top of the useful features
- or create first a functional skeleton of the part, using datum object and sketches at the root of the Model, and then build the 3D geometry around the datum objects
In order to insert an Assembly 4 'Model' into another Assembly 4 'Model, use the command 'Insert External Part' : this will allow you to chose one part in any of the open documents, and will ask you the name under which the instance of the part shall appear in the assembly tree. It is important to note that this name must be unique in the tree. By default, the insert part dialog will propose the same name for the instance as the name of the document where the part is located, but you can choose any name of your liking. If you choose a name that already exists, FreeCAD will modify it to something unique (and which may be un-nice to you)
Once inserted, the instance is placed using the command 'Place an Instance' (or 'Move an Instance'). This will show a dialog in 2 columns: the left column shows all coordinate systems in the linked part that can be used to attach to part, and the right column shows all other parts in the assembly and their coordinate systems that can be used to attach the instance-to. Use the 'Show' button to pre-visualize where the part's going to be placed. 3 rotation buttons allow the instance to be rotated by steps of 90° around the 3 axes X, Y and Z
A part can be attached either to an LCS in the assembly itself ("parent assembly"), or to an LCS in a part already inserted in the assembly ("sister part"). But only coordinate systems directly at the root of a 'Model' container — in the parent assembly or in a sister part — can be used for attachment, and not, for example, coordinate systems from a Body in the part tree.
This workbench allows the assembly of assemblies: since there is no difference between parts and assemblies, the 'Insert External Part' allows to chose a part that has other parts linked to it. The only difference will be for the coordinate systems in the inserted assemblies: in order to be used with Assembly 4, a coordinate system must be directly in the root 'Model' container, meaning that a coordinate system inside a linked part cannot be used to attach the assembly to a higher-level assembly.
Therefore, in order to re-use a coordinate system of a part in an assembly, a coordinate system must be created at the root of the 'Model', and the placement of this coordinate system must be 'copied' over from the coordinate system that the user wants to use. This is done by inserting a coordinate system and using the 'Place LCS' command, which allows to select a linked part in the assembly and one of it's coordinate systems: the 2 coordinate systems — the one at the root of 'Model' and the one in the linked part — will always be superimposed, even if the linked part is modified, allowing the placement of the assembly in a higher level assembly using a linked part as reference. It sounds more complicated than it actually is.
EDIT (2020.02.11): Added section about tutorials.
EDIT (2019.10.09): this Assembly 4 workbench is now in the FreeCAD addon manager, and can be installed as any other module.
EDIT (2019.10.05): the Asm4 workbench has been updated to work with FreeCAD v0.19-preview. The main difference is in the syntax of the ExpressionEngine
EDIT (2019.03.11): the git repository should now work as it's supposed-to
EDIT (2019.03.12): cosmetic change: moved actual Python code to Mod_Asm4: this is the directory to be moved/copied/linked inside ~/FreeCAD/Mod. Added some more examples to experiment
EDIT (2019.07.16): added location for Mod_Asm4 subdirectory in Windows and Linux
EDIT (2019.07.18): added loads of new explanations