Assembly 4 workbench

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Assembly 4 workbench

Post by vocx »

Zolko wrote: Fri Nov 22, 2019 10:03 am If the screws don't follow the holes, the assembly is not parametric.
I guess it could be done with expressions. You'd need a way to calculate the new properties of the array to use those variables that you define.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Assembly 4 workbench

Post by ppemawm »

Zolko wrote: Thu Nov 21, 2019 12:41 pm I slightly modified the Asm4_LinkArray you had made to integrate better with Assembly4. It can now make arrays of fasteners also, in which case the fasteners are linked, thus when modifying the original fastener all its links are modified too.
Thank you for this feature. This is an nice addition to the Fastener tool which helps to facilitate top-down, in-context design using Assembly4.

The following model of an air motor prototype design by Ken Irwin (2011) is a example of the top-down work process I am trying to develop and refine. See the real deal at https://www.youtube.com/watch?v=C1oe3oULlD0 and several screen shots of my model below with a few comments about my modelling strategy.

This six-piston arrangement can function as a motor by supplying pressurized air to the center of the stationary axle.  The pistons do not rotate.  The eccentric bore in the ring gear is what causes the gear to turn.  A rotating valve provides air to each piston in turn.<br /><br />As you can see in the Model Tree all the Parts were created in the same file beginning with a Body that holds the master sketch(es) and carbon copy (toggled to construction lines).  Using Assembly4, a Part is then added for each component with a Body and a Edit&gt;Duplicate of the carbon copy for each of the features.  Each Body is then created in-place at its proper location in the assembly.<br /><br />The ring gear Pad was created using PartDesign&gt;InvoluteGear.  The gear involute sketch is attached to the outer diameter edge of the master sketch with a Concentric Map mode so that it will rotate about the Y-axis when the eccentric angle is changed.
This six-piston arrangement can function as a motor by supplying pressurized air to the center of the stationary axle. The pistons do not rotate. The eccentric bore in the ring gear is what causes the gear to turn. A rotating valve provides air to each piston in turn.

As you can see in the Model Tree all the Parts were created in the same file beginning with a Body that holds the master sketch(es) and carbon copy (toggled to construction lines). Using Assembly4, a Part is then added for each component with a Body and a Edit>Duplicate of the carbon copy for each of the features. Each Body is then created in-place at its proper location in the assembly.

The ring gear Pad was created using PartDesign>InvoluteGear. The gear involute sketch is attached to the outer diameter edge of the master sketch with a Concentric Map mode so that it will rotate about the Y-axis when the eccentric angle is changed.
Picture1.png (324.57 KiB) Viewed 3029 times
This is the master sketch which controls the design intent. It includes as a minimum the radial axes of each piston, the wrist pin locations, the piston bearing diameters, and the eccentric which rotates.  The piston bearing diameter is constrained tangent to the eccentric.<br /><br />The master sketch is created at an arbitrary angle of the eccentric position (e.g. 70 deg).  This angle can be changed and the sketch will update to a new angular position.  The sketch should be checked in small steps between 0-360 deg at this stage to insure valid solutions with the given constraints.<br /><br />A carbon copy of this sketch is used to create each feature of each body by adding the necessary construction detail.  In this manner, each body will remain in its proper position if the master sketch is changed (e.g. eccentric angle).
This is the master sketch which controls the design intent. It includes as a minimum the radial axes of each piston, the wrist pin locations, the piston bearing diameters, and the eccentric which rotates. The piston bearing diameter is constrained tangent to the eccentric.

The master sketch is created at an arbitrary angle of the eccentric position (e.g. 70 deg). This angle can be changed and the sketch will update to a new angular position. The sketch should be checked in small steps between 0-360 deg at this stage to insure valid solutions with the given constraints.

A carbon copy of this sketch is used to create each feature of each body by adding the necessary construction detail. In this manner, each body will remain in its proper position if the master sketch is changed (e.g. eccentric angle).
Picture2.png (233.3 KiB) Viewed 3029 times
To create the Assembly4, LCS's are attached to vertices or edges in the master sketch as shown in this screenshot.  This will avoid any topological issues if any  of the body features are modified.<br /><br />The LCS's for the fasteners are attached to the master sketch and offset in the sketch normal direction (Y-axis direction) as required using the Attachment Offset property.  Note that Arrays are used for the fasteners since they are all stationary and do not rotate.  This is a wonderful feature which saves much time and space in the Model Tree.
To create the Assembly4, LCS's are attached to vertices or edges in the master sketch as shown in this screenshot. This will avoid any topological issues if any of the body features are modified.

The LCS's for the fasteners are attached to the master sketch and offset in the sketch normal direction (Y-axis direction) as required using the Attachment Offset property. Note that Arrays are used for the fasteners since they are all stationary and do not rotate. This is a wonderful feature which saves much time and space in the Model Tree.
Picture4.png (160.99 KiB) Viewed 3029 times
This shows the master sketch solution at an angle of 150 deg with all rotating parts in their proper location.
This shows the master sketch solution at an angle of 150 deg with all rotating parts in their proper location.
Picture3.png (334.52 KiB) Viewed 3029 times
Model can be downloaded from https://www.dropbox.com/s/qlud995qng29f ... FCStd?dl=0

Any comments or questions are valuable since I am in the early stages of trying to develop this process using Assembly4 where it may make sense. In retrospect, I probably should have put the master sketch in the Model Assembly as Zolko recommends to avoid the dreaded "Links out of scope" warnings. I'll try that in my next learning project. EDIT: See also https://forum.freecadweb.org/viewtopic.php?f=24&t=41135

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18719 (Git)
Build type: Release
Branch: master
Hash: c021ff70debb106b27d03ed1707f4b05fcf385a6
Python version: 3.6.7
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
Last edited by ppemawm on Sat Nov 23, 2019 6:23 pm, edited 1 time in total.
"It is a poor workman who blames his tools..." ;)
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Assembly 4 workbench

Post by alonso_jamm »

After a little bit of research I found out that we could use the addExtension method to add the functionality of attachment to an array (similar to what we do with LCS).

For example, I used this line of code:

Code: Select all

App.ActiveDocument.array_part1.addExtension("Part::AttachExtensionPython", App.ActiveDocument.array_part1)
Then the polar array named "array_part1" had the ability to be attached just like a LCS. I attached the array to a LCS and after rotating and moving the LCS, the array would follow. So doing this give the ability to position an array in any direction.

The problem is that the attachment happens with one of the elements of the array (I think is the first element). That is, the attachment does not happen at the center of the polar array. Also, this method does not help on having a parametric distance between the center and the elements of the array. But I think it may be useful for positioning the array.
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Assembly 4 workbench

Post by alonso_jamm »

Zolko wrote: Fri Nov 22, 2019 10:03 am If the screws don't follow the holes, the assembly is not parametric.
I did some testing with the expression engine. I was able to make the array parametric. The screws follow the holes! I achieved this by creating expressions for the coordinates of the center of the array. I placed a LCS in the center of the pipe, and used that as reference. Then I
The steps I used were:
  1. Got the difference of the placements of the LCS called "CENTER" (This is the LCS considered as center of the array) and the LCS called "Hole" (the screw is attached to this LCS).
  2. I multiplied the resultant placement by the rotation of the LCS "Hole".
And that's it!

I attached the file
Attachments
test_LinkArray.FCStd
(155.54 KiB) Downloaded 66 times
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Assembly 4 workbench

Post by vocx »

alonso_jamm wrote: Fri Nov 22, 2019 11:41 pm ...

Code: Select all

App.ActiveDocument.array_part1.addExtension("Part::AttachExtensionPython", App.ActiveDocument.array_part1)
Then the polar array named "array_part1" had the ability to be attached just like a LCS. ...
Maybe this could be added to the code of Draft_Array itself.

Most Draft objects like lines, circles, rectangles, etc., are derived from Part_Part2DObject because they are supposed to be planar objects. Therefore, all these include the AttachExtension by default, so that they can be attached to faces and other planes. Sketches are also Part_Part2DObjects.

But Draft_Array isn't a planar object in general, as it can be used with any object, both 2D and 3D. The array is based on a Part_Feature so it doesn't include the AttachExtension by default.

I don't know whether it would be a problem to provide this property to all arrays. What is the consequence of a 3D body having an AttachExtension? Why don't all objects have this by default? Does this make the object "heavier", consuming more memory?
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
alonso_jamm
Posts: 77
Joined: Mon Nov 11, 2019 11:32 pm

Re: Assembly 4 workbench

Post by alonso_jamm »

vocx wrote: Sat Nov 23, 2019 1:57 am I don't know whether it would be a problem to provide this property to all arrays. What is the consequence of a 3D body having an AttachExtension? Why don't all objects have this by default? Does this make the object "heavier", consuming more memory?
I am not completely sure what are the consequences of adding an AttachExtension to all arrays. I am still having troubles in understanding completely what are extensions. But as far as I understand, AttachExtension adds the functionality of the Attacher::AttachEngine. And also I don't know if it makes an object "heavier" nor why it is not implemented by default on all objects. My guess is that it is not implemented in all objects because it is a relatively new feature.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

ppemawm wrote: Fri Nov 22, 2019 9:03 pm In retrospect, I probably should have put the master sketch in the Model Assembly as Zolko recommends to avoid the dreaded "Links out of scope" warnings.
yes, that was my first thought: you definitively should do that. But it won't get you rid of the Links out of scope, because that's a FreeCAD "bug" (feature: LCS are PartDesign::CoordinateSystem objects, and when used outside of a PartDesign::Body it complains. It works very well, but it complains.)

While I was sceptical about your idea of an assembly in a file, it is nice to be able to distribute it easily in 1 file.

Also: did you think about animating it ?

ECC_1Mb.gif
ECC_1Mb.gif (966.77 KiB) Viewed 2876 times
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

ppemawm wrote: Fri Nov 22, 2019 9:03 pm Any comments or questions are valuable since I am in the early stages of trying to develop this process using Assembly4 where it may make sense. In retrospect, I probably should have put the master sketch in the Model Assembly
There are 3 Sketches there:
  • Sketch_Master
  • Sketch001_CC
  • Sketch001_CC029
Are the later 2 CarbonCopies of the first ? Does that mean that all 3 sketches are solved ? But then, since they're mostly identical, the solver has to do the calculations 3 times. Or do I understand it wrong ?

There is a feature in Sketcher that allows to import external references. This means that you could solve the first sketch for all constraints, then import in your subsequent sketches only the vertices of the (solved) master sketch, and add geometries there. You may run into the topological naming issue, but it's much less bad for sketches than for 3D geometries.

Sketcher.png
Sketcher.png (63.32 KiB) Viewed 2833 times

EDIT: hold-on : there are actually tens of CarbonCopies of the master sketch, one in each part: are they all solved ? That would explain why it's so slow to update

EDIT 2: What I would try is to make the first master sketch (in the assembly Model) that solves the position of each wheel running inside the excenter, and then, outside the Sketch, at the root of the assembly Model, place 6 datum points on the centres of these 6 wheels: this is actually the only information that you need. And then, import these datum points into secondary sketches as needed. Thus, if/when the master sketch screws up with the topological naming, the secondary sketches will still be valid since they point to valid reference datum points. They will be geometrically messed-up but topologically valid: all you'll have to do is to correctly reposition the datum points.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Assembly 4 workbench

Post by ppemawm »

Zolko wrote: Sun Nov 24, 2019 9:03 am Are the later 2 CarbonCopies of the first ? Does that mean that all 3 sketches are solved ? But then, since they're mostly identical, the solver has to do the calculations 3 times. Or do I understand it wrong ?
All carbon copies are from the master sketch. Carbon copies of carbon copies is probably not the best practice. I duplicate the "master" carbon copy to avoid having to create a new carbon copy for each feature. It is simply a time saving while modelling. This has been my standard practice when using master sketches since introduction in V0.17.

I do not know if each carbon copy is solved, but it stands to (my) reason that each is solved as it is encountered in the model tree.
Zolko wrote: Sun Nov 24, 2019 9:03 am There is a feature in Sketcher that allows to import external references. This means that you could solve the first sketch for all constraints, then import in your subsequent sketches only the vertices of the (solved) master sketch, and add geometries there. You may run into the topological naming issue, but it's much less bad for sketches than for 3D geometries.
I generally (religiously) avoid external references in sketches unless they refer to another sketch. I'll try your suggestion with my next project. I do not know if external reference is any more robust than carboncopy which is simply based on expressions for the dimensions.
Zolko wrote: Sat Nov 23, 2019 9:35 pm While I was sceptical about your idea of an assembly in a file, it is nice to be able to distribute it easily in 1 file.
Building models in separate files or adding standard parts such as fasteners or .step objects and then creating an assembly file works fine if the assembly arrangement is already known.

My past design experience was with bespoke or one-off prototype turbomachines which usually started with the layout of a cross-section(s) of the assembly by the senior designer who fixes the arrangement and critical dimensions and interfaces. This layout (master sketch) was then used by the juniors detailers to create the drawings (models) for each component. In the CAD world, I do not see how the individual 3D models can be created out-of-context, thus the requirement to have all parts in the same file while creating the Part models and the assembly. That is the work process I am trying to develop with FreeCAD. So far, from my limited experimenting, Assembly4 is the only workbench that may facilitate this work process so far.
Zolko wrote: Sat Nov 23, 2019 9:35 pm Also: did you think about animating it ?
Thank you for the animation. I do have an animation by 'image-to-GIF or Microsoft video MP4, but the files were too large to attach. Unless it is an illusion it seems in your animation that the gear teeth rotate opposite to the eccentric at a different speed. Is this a anomaly with the animation or is there something amiss with my model?
Zolko wrote: Sun Nov 24, 2019 9:03 am What I would try is to make the first master sketch (in the assembly Model) that solves the position of each wheel running inside the excenter, and then, outside the Sketch, at the root of the assembly Model, place 6 datum points on the centres of these 6 wheels: this is actually the only information that you need. And then, import these datum points into secondary sketches as needed.
I'll give this a try in one of my next projects and report back. I assume you mean by "import" to use Sketcher external reference.

Now that we have Assembly4 and Link capability in V0.19 perhaps the process should evolve to:

1. Create master assembly file with the master layout (sketch).
2. Create first Part with Body in the assembly file referencing the master sketch for each feature.
3. Export Part with its link to the mastersketch to a separate file.
4. Delete(?) #2 and add external Part to the assembly file with a Link(?) so that there is an instance in the assembly file that facilitates in-context modelling of the the next part(s).
5. Repeat for each Part in the same sequence as one may assemble the actual machine.

So, I have some more experimenting to do with Assembly4.
"It is a poor workman who blames his tools..." ;)
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

new version 0.7.4: I added an animate command. It allows to easily move parts in an Assembly4 assembly, by setting a variable in the Variables entity. It's very basic, and the STOP button and SLEEP value don't work.
Asm4_Animate.png
Asm4_Animate.png (350.1 KiB) Viewed 2735 times
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply