Sizing parts through master sketch in Assembly4

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
OscarLazoA
Posts: 9
Joined: Tue Apr 04, 2023 4:25 pm

Sizing parts through master sketch in Assembly4

Post by OscarLazoA »

I have been using Assembly4 to build some mechanisms, and I was reading Zolko's description of the top down approach, and I am amazed that that is exactly the workflow I had been trying to get at. Thanks for the great work!

The master sketch approach drives the positioning of parts through its geometry, thus saving the user or an engine from having to solve the geometry for parts. However, the tutorials that I have seen seem to leave the geometry of the parts separate from the master sketch, leaving the user to figure out the sizes of the parts. I would imagine a fully top down approach would let the user make reference to the master sketch to draw the parts so that the functionality of the master sketch drives the sizing of the parts, and not just their positioning.

I tried using a Part Design shape binder to get a reference to the master sketch inside the body, but then attaching an lcs to the part doesn't work, because the lcs makes links to the body, which is outside its allowed scope, for some reason.

Code: Select all

PartDesign::CoordinateSystem: Link(s) to object(s) 'ShapeBinder001' go out of the allowed scope 'lcs_rod_x'. Instead, the linked object(s) reside within 'rod'.
Attaching the lcs to the body doesn't have this issue, but then the add part command doesn't find the body lcs when I want to place it in the model. Is there a standard way of doing this?

Here's my installation:

Code: Select all

OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Help 1.0.3
  * Assembly4 0.12.6
  * freecad.gears 1.0.0
  * Assembly3 0.11.4
  * OpticsWorkbench 1.0.9
  * A2plus 0.4.60k
  * fasteners 0.4.56
Thanks a lot!
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Sizing parts through master sketch in Assembly4

Post by ppemawm »

OscarLazoA wrote: Wed Apr 05, 2023 1:18 pm The master sketch approach drives the positioning of parts through its geometry, thus saving the user or an engine from having to solve the geometry for parts.
If you want to use a master sketch for positioning then you do not need Assembly4. It is redundant IMO. The master sketch in Assembly4 is typically used as a solver to constrain an assembly when the body links need additional degrees of freedom in order to simulate motion. It is placed in Model.

I used your approach in the past before becoming a fan of Assembly4. Example here: viewtopic.php?p=313359#p313359 where you will note that the geometry is controlled by carbon copies of the master (see Picture 15,16,17). I no longer use this method for assemblies.

However, I do frequently use master sketches and carbon copies to control features in a single body.
"It is a poor workman who blames his tools..." ;)
OscarLazoA
Posts: 9
Joined: Tue Apr 04, 2023 4:25 pm

Re: Sizing parts through master sketch in Assembly4

Post by OscarLazoA »

ppemawm wrote: Wed Apr 05, 2023 11:49 pm If you want to use a master sketch for positioning then you do not need Assembly4. It is redundant IMO. The master sketch in Assembly4 is typically used as a solver to constrain an assembly when the body links need additional degrees of freedom in order to simulate motion. It is placed in Model.
This sort of simulation is exactly what I want to make. I am not having trouble positioning parts on the model. What I am looking to do is positioning + sizing through the master sketch. For instance, draw a master sketch representing a crank and a connection rod in a piston engine. The workflow I have seen would use the master sketch in the Model part to determine the positioning of the parts as the crank turns. But the master sketch already has the information about how long the parts are and not just where they are.
ppemawm wrote: Wed Apr 05, 2023 11:49 pm I used your approach in the past before becoming a fan of Assembly4. Example here: viewtopic.php?p=313359#p313359 where you will note that the geometry is controlled by carbon copies of the master (see Picture 15,16,17). I no longer use this method for assemblies.

However, I do frequently use master sketches and carbon copies to control features in a single body.
The carbon copy tool in sketcher allows copying sketches only if they are in the same body (or part if you hold Ctrl) but the master sketch would be in the Model, thus in a different part and this is not allowed.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Sizing parts through master sketch in Assembly4

Post by Zolko »

OscarLazoA wrote: Thu Apr 06, 2023 1:43 am What I am looking to do is positioning + sizing through the master sketch. For instance, draw a master sketch representing a crank and a connection rod in a piston engine. The workflow I have seen would use the master sketch in the Model part to determine the positioning of the parts as the crank turns. But the master sketch already has the information about how long the parts are and not just where they are.
this is a recurrent request, but it's a logical impossibility: it creates circular dependencies (the assembly depends on the parts it contains, and the part depends on the master sketch in the assembly).

One way to solve this, but I don't know how much it has been investigated, is to use an external master-sketch (in a master-part for example) and link that into both the assembly and the parts you want to depend on it. You need to place datum points on the master-sketch, and import those points into the part and assembly from the linked master sketch. Now, these points can be used for construction.

Another use of such a master-part is that you can define there master-variables, that can be used in the parts/assemblies where you import it to. The safest is then to create local variables (in each part) and assign to them the values found in the master part, by:

Code: Select all

MasterPart#Variables.var_X
In such workflow, the MasterPart would be the construction skeleton of your assembly, containing all relevant info (sketches and variables). It works, but I don't know how much has been experimented with this ... and thus, how robust it is. I would suggest to keep the master-part and all parts and assemblies that include it in the same directory.
try the Assembly4 workbench for FreCAD — tutorials here and here
OscarLazoA
Posts: 9
Joined: Tue Apr 04, 2023 4:25 pm

Re: Sizing parts through master sketch in Assembly4

Post by OscarLazoA »

Zolko wrote: Thu Apr 06, 2023 7:54 am
One way to solve this, but I don't know how much it has been investigated, is to use an external master-sketch (in a master-part for example) and link that into both the assembly and the parts you want to depend on it. You need to place datum points on the master-sketch, and import those points into the part and assembly from the linked master sketch. Now, these points can be used for construction.

Another use of such a master-part is that you can define there master-variables, that can be used in the parts/assemblies where you import it to. The safest is then to create local variables (in each part) and assign to them the values found in the master part, by:

Code: Select all

MasterPart#Variables.var_X
In such workflow, the MasterPart would be the construction skeleton of your assembly, containing all relevant info (sketches and variables). It works, but I don't know how much has been experimented with this ... and thus, how robust it is. I would suggest to keep the master-part and all parts and assemblies that include it in the same directory.
I managed to make this sort of thing by using several files so that the DAG looks like

Code: Select all

master -> part -> assembly
with several instances of part. But I did this by copying and pasting the master sketch into the body of each part so that the copy is usable for construction through the external geometry tool in Sketcher. This seems rather unelegant to me though...

Wouldn't you agree that this sort of workflow is easier and more top-down? It solves a lot of geometry already for me, that I would otherwise have to figure out and type using formulas.
OscarLazoA
Posts: 9
Joined: Tue Apr 04, 2023 4:25 pm

Re: Sizing parts through master sketch in Assembly4

Post by OscarLazoA »

Zolko wrote: Thu Apr 06, 2023 7:54 am In such workflow, the MasterPart would be the construction skeleton of your assembly, containing all relevant info (sketches and variables). It works, but I don't know how much has been experimented with this ... and thus, how robust it is. I would suggest to keep the master-part and all parts and assemblies that include it in the same directory.
Here's my proof of concept.
Attachments
top_down_engine.zip
(115.46 KiB) Downloaded 40 times
Post Reply