Assembly 4 workbench

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

OficineRobotica wrote: Mon Jan 13, 2020 7:58 am -when attaching LCS_pivot to LCS_1002 , if the selection is made in the 3d view , the attachment will be " LCS_1002:Z " . That is: the attachment is mapped to a single axis of LCS_1002 . The axis that one happens to click when trying to select LCS_1002 in the 3d view
you're right, I'll add a comment

-on my system, the Fx button inside the attachment dialog is replaced with a green, unclickeble button, and that prevents setting up the attachment offset.
again, you're right: this happens when creating the attachment mode, but if you edit the attachment mode a second time you do have the f(x) button. Hum, this seems like a FreeCAD bug, dunno if it should be mentioned.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: Assembly 4 workbench

Post by OficineRobotica »

Zolko wrote: Mon Jan 13, 2020 2:02 pm

WOOOOW.... I don't know what kind of magic you have done in the last update of the addon but to me the animation speed seems doubled. :shock: Big THANK YOU.

This is the video tutorial that I am currently working on. I have some questions on what are the best strategies to be used in the assembly(and modeling) and I could really use some informed opinion from you guys. For that I will open a "Help on using freecad" thread so we can discuss it there before publishing the tut.

phpBB [video]

hexa1.png
hexa1.png (396.54 KiB) Viewed 4989 times
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

OficineRobotica wrote: Wed Jan 15, 2020 9:55 am WOOOOW.... I don't know what kind of magic you have done in the last update of the addon but to me the animation speed seems doubled. :shock: Big THANK YOU.
I don't know from which version you updated, but I've recently changed that instead of updating/recomputing the entire document it only does so now on the Model. May-be that help, cool

This is the video tutorial that I am currently working on.

phpBB [video]
WOOOOW.... :-) this is awesome. Am I guessing right that you don't actually solve for the length of all 6 legs, but you position the top table and automatically adapt the length (and directions) of the 6 legs ? Which in itself is already a challenge, and could be used to do an interaction matrix between the 6 DOF of the table and the 6 legs. And by inverting that interaction matrix you could use it for small-scale direct command of the 6 legs (small scale to be in the linear range of that inversion).

I'm really impressed.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: Assembly 4 workbench

Post by OficineRobotica »

Zolko wrote: Wed Jan 15, 2020 11:19 am
Am I guessing right that you don't actually solve for the length of all 6 legs, but you position the top table and automatically adapt the length (and directions) of the 6 legs ? Which in itself is already a challenge, and could be used to do an interaction matrix between the 6 DOF of the table and the 6 legs. And by inverting that interaction matrix you could use it for small-scale direct command of the 6 legs (small scale to be in the linear range of that inversion).
You are absolutely correct. The top table positioning drives the position/orientation of the 6 legs. In fact, one of my problems was setting up the expressions needed for the top table orientation. In the attachment tab there is a angle value and axis values that i still need to wrap my head around of how they interact with each other. I searched for pitch yaw roll input fields , like those in the mapping mode tab but i couldn't find it. Perhaps I am missing something.

As for the positioning of he piston extension needed for a certain movement , with this setup , would be enough to setup a axis between the 2 attachment points of a piston (top and bottom) > then read the positioning of LCS0 of the pistonExtension along that axis ....aaand voila . One could directly drive a hexapod from inside Freecad's interface in real time :shock: I'm already imagining ways of how can one export the linear values in realtime from freecad to a com interface and a arduino :D . Wishful thinking.

Oh...and user request. It would be nice if you could implement a extra way of adding LCS's. That is:
-select geometry on a body(face/edge/vertex etc)
-create a new LCS
-the LCS name pop up dialog should have a check box named "create independent positioning"
-the LCS reads the positioning and orientation chosen in the mapping dialog but it isn't bound to that geometry. Instead it creates a independent positioning relative to LCS0 of the Part. It is basically a faster way of adding an LCS at the root of the part but witbought the hassle of inserting manually the x/y/z offsets. That would speed up allot the creation process if one needs to add extra LCS's and doesn't remember from the top of they r head some horizontal/vertical measure of features. Also enforces the good practice of not attaching to actual geometry.

That feature i see myself using all the time.
Thank you and thumbs up.
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

@OficineRobotica this is a very inspiring demo you did there. Its really a lot of fun (and a steep learning curve) to explore the new possibilities of FreeCAD with Assembly4 now operational in the normal V0.19 release. Did you get all this into a single file?
OficineRobotica wrote: Wed Jan 15, 2020 5:58 pm In the attachment tab there is a angle value and axis values that i still need to wrap my head around of how they interact with each other. I searched for pitch yaw roll input fields , like those in the mapping mode tab but i couldn't find it. Perhaps I am missing something.
From the very first time I used Assembly4 I loved the RotX, RotY, RotZ buttons in the Placement Dialog. I think this should be included into the core GUI elements like in all Property fields dealing with angles. For anything but single axis rotations the 1Axis/Angle mode is imho totally useless. Also instead of a a single click to rotate 90deg about X in those dialogs you need to multi-click the rotatation axis from 0/0/1 to 1/0/0 and then click and type the angle.

To your feature request. I also find myself modyfying the mapped LCS rather often. But I seem to take more time to struggle with the "Attachment Offset" properties. Initially I had hoped I could mofiy those settings with the "Transform" function interactively. But I did not get this to work, somehow. Currently I am typing numbers interatively all the time. Mouse wheel does not help a lot when scrolling mm-wise for distances of 1000mm or more.
Maybe there is a better way and I just do not see it?
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: Wed Jan 15, 2020 11:19 am ...ping
OficineRobotica wrote: Wed Jan 15, 2020 5:58 pm ...ping
Taking a cue from @OficineRobotica ingenious adjustable clamp https://forum.freecadweb.org/viewtopic. ... 90#p356671, this is a similar although much simpler example of using Assembly4 for top-down design and animation. The drawings for this adjustable clamp engineered by J. Galba (2012) can be found at http://www.inventorwizard.nl/blueprints/index.html.

An assembly master sketch is used to define design intent, controlling dimensions, and constraints among the various parts. All parts were created in the same file at their proper location for an arbitrary clamp opening specified by the Assembly4> Variables.

Assembly4 was used to assemble all of the parts including fasteners and imported .step files for the commercially available retainers.  Note that the Model includes a copy of the master sketch which is used to properly constrain the assembly so that it can be animated.<br /><br />Since the clamp is symmetrical about the XZ plane, Part &gt; Mirror was used for the fasteners to conveniently place them on the far side.
Assembly4 was used to assemble all of the parts including fasteners and imported .step files for the commercially available retainers. Note that the Model includes a copy of the master sketch which is used to properly constrain the assembly so that it can be animated.

Since the clamp is symmetrical about the XZ plane, Part > Mirror was used for the fasteners to conveniently place them on the far side.
Picture4.png (217.89 KiB) Viewed 4749 times
These are all the parts as created during the top down modelling.  It is only necessary to create one of any duplicate parts as these can be added during the Model assembly.<br /><br />The master sketch and its Sketcher &gt; CarbonCopy was placed in a Part &gt; Body for convenience.  Each part was then created from sketches based on modified carbon copies of the master sketch and linked by Sketcher &gt; External geometry to locate each in its proper position.<br /><br />Part &gt; Mirror was used for the Part004_elbow which is convenient, but it does trigger an out of scope warning requiring that the mirror be drag and dropped back to its Part container.<br /><br />Imported .step files are placed in an Assembly4 &gt; Part container which defines their local LCS.
These are all the parts as created during the top down modelling. It is only necessary to create one of any duplicate parts as these can be added during the Model assembly.

The master sketch and its Sketcher > CarbonCopy was placed in a Part > Body for convenience. Each part was then created from sketches based on modified carbon copies of the master sketch and linked by Sketcher > External geometry to locate each in its proper position.

Part > Mirror was used for the Part004_elbow which is convenient, but it does trigger an out of scope warning requiring that the mirror be drag and dropped back to its Part container.

Imported .step files are placed in an Assembly4 > Part container which defines their local LCS.
Picture1.png (180.3 KiB) Viewed 4749 times
This is the master sketch with all its constraints and the Assembly4 &gt; variable used to control the opening of the clamp.  The distance variable along the length of the threaded rod was used rather than the actual clamp opening so that the rotation of the rod and lever could be more easily done with the Animator.<br /><br />A point on point constraint simulates a pinned connection at all the joints and a point on line where the rod and nut are located, simulates a slider or translation constraint.  The horizontal constraint at the clamp opening construction geometry insures that the clamp jaws remain perpendicular to simulate clamping as the opening is changed.
This is the master sketch with all its constraints and the Assembly4 > variable used to control the opening of the clamp. The distance variable along the length of the threaded rod was used rather than the actual clamp opening so that the rotation of the rod and lever could be more easily done with the Animator.

A point on point constraint simulates a pinned connection at all the joints and a point on line where the rod and nut are located, simulates a slider or translation constraint. The horizontal constraint at the clamp opening construction geometry insures that the clamp jaws remain perpendicular to simulate clamping as the opening is changed.
Picture2.png (225.21 KiB) Viewed 4749 times
This image shows all of the LCS's used to locate the fasteners, retainers, the threaded rod, and lever handle.  All other parts are linked to the Model &gt; LCS0 since their local LCS's are controlled by the master sketch which is attached to the LCS0.<br /><br />The LCS's for the fasteners were attached to hole edges which is against my usual practice of attaching only to the master sketch.  This was necessary because when attached to the sketch there were some openings in the master sketch which renumbered edges and verticies causing the assembly to fail.  <br /><br />The hole edges turned out to be more stable although not entirely robust for certain clamp positions most likely due to ambiguous sketch constraints.
This image shows all of the LCS's used to locate the fasteners, retainers, the threaded rod, and lever handle. All other parts are linked to the Model > LCS0 since their local LCS's are controlled by the master sketch which is attached to the LCS0.

The LCS's for the fasteners were attached to hole edges which is against my usual practice of attaching only to the master sketch. This was necessary because when attached to the sketch there were some openings in the master sketch which renumbered edges and verticies causing the assembly to fail.

The hole edges turned out to be more stable although not entirely robust for certain clamp positions most likely due to ambiguous sketch constraints.
Picture3.png (249.72 KiB) Viewed 4749 times
The assembly was easily animated using the Assembly4 &gt; Animator as shown in the GIF video.  Note that the rod and lever rotation was simulated by defining a rod LCS angle as a function of the thread distance variable (e.g. one rotation = 1 mm).<br /><br />Note also that one of the fastener supports is swapping locations for certain distances for some unknown reason that I was not able to sort out without likely making changes to the master sketch.
The assembly was easily animated using the Assembly4 > Animator as shown in the GIF video. Note that the rod and lever rotation was simulated by defining a rod LCS angle as a function of the thread distance variable (e.g. one rotation = 1 mm).

Note also that one of the fastener supports is swapping locations for certain distances for some unknown reason that I was not able to sort out without likely making changes to the master sketch.
video_clamp4.gif (836.65 KiB) Viewed 4749 times


I am not able to attach the file due to copyright restrictions but any comments or questions are welcome.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19127 (Git)
Build type: Release
Branch: master
Hash: ec18f070d13b195d946c3d955d8c21b2e60550e2
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)
"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 »

OficineRobotica wrote: Wed Jan 15, 2020 5:58 pm Oh...and user request. It would be nice if you could implement a extra way of adding LCS's. That is:
...
-the LCS reads the positioning and orientation chosen in the mapping dialog but it isn't bound to that geometry. Instead it creates a independent positioning relative to LCS0 of the Part.
What about a button called "Release" that would insert the LCS into the assembly but without any mapping or attachment, and still retain the latest position where the LCS was ?

I'm thinking about the same function for links:

catman wrote: Thu Jan 16, 2020 3:54 pm To your feature request. I also find myself modyfying the mapped LCS rather often. But I seem to take more time to struggle with the "Attachment Offset" properties. Initially I had hoped I could mofiy those settings with the "Transform" function interactively.
yes, I know, but there is nothing I can do about it. The explanation is the following: The "Transform" function applies to the Placement property of an object, but Assembly4 alreadu uses that Placement property (with its ExpressionEngine) to position the linked part in the assembly. You still can use the Transform function, and while you're in that tool it overrides the Placement property, but as soon as you exit the UI the ExpressionEngine kicks in and sets the Placement properties values.

The solution would be that an App::Link would have an Attachment property with an additional AttachmentOffset, and a Placement property that would be the sum of the Attachment and the AttachmentOffset. This is how some FreeCAD objects — Sketch, LCS... — behave. Thus, the Transform tool could be applied to the AttachmentOffset, and it would do what you want.

But that would need some internal core changes to App::Link. May-be this is something to keep in mind for v0.20. Currently, either you place a linked part manually (and then the Transform tool also works) or by attaching it to an LCS. And with the (next) "Release" button you could switch between the two.
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: Thu Jan 16, 2020 5:53 pm The LCS's for the fasteners were attached to hole edges which is against my usual practice of attaching only to the master sketch.
Did you use the function "Hole LCS" for that ? It was done for exactly that reason. Although I agree that it's not entirely satisfactory, but one can imagine that fasteners are only inserted when the design is close to be finalised and thus less subject to the topo-naming issue.
try the Assembly4 workbench for FreCAD — tutorials here and here
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Assembly 4 workbench

Post by catman »

Zolko wrote: Fri Jan 17, 2020 11:50 am What about a button called "Release" that would insert the LCS into the assembly but without any mapping or attachment, and still retain the latest position where the LCS was ?
Maybe you are talking about two different things

a) a new workbench icon for a "Release" command. A selected LCS would be "released" of its current attachment, e.g. it would be set to the Model origin + AttachmentOffset. As it would not forget that coordinates, it could be re-attached by pressing "Release" again. Since the mapping placement it in the "Placement" property and it is locked to the user.

b) A modified "Create New LCS" dialog, for example like this
"Cancel" "OK" "OK/Map..."
The "OK/Map" should mean that beside the naming a new dialog will open where the mapping of the LCS to other LCS can be done. Default selected button would be the "OK/Map.."

Do you have a specific use case in mind where the "Relase" toggle would be useful?

Zolko wrote: Fri Jan 17, 2020 11:50 am yes, I know, but there is nothing I can do about it. The explanation is the following: The "Transform" function applies to the Placement property of an object, but Assembly4 alreadu uses that Placement property (with its ExpressionEngine) to position the linked part in the assembly. [...]
I am sorry, I have to correct my question (in bold). I am not sure if that changes your answer..
catman wrote: Thu Jan 16, 2020 3:54 pm I also find myself modyfying the mapped Geometry (not LCS) rather often. But I seem to take more time to struggle with the "Attachment Offset" properties. Initially I had hoped I could mofiy those settings with the "Transform" function interactively. But I did not get this to work, somehow. Currently I am typing numbers interatively all the time. Mouse wheel does not help a lot when scrolling mm-wise for distances of 1000mm or more.
Maybe there is a better way and I just do not see it?
Indeed I got the behaviour you described. After the transform tool was working interactively it snapped back to the old position after closing the tool. Very helpful to learn why that was.

I am not sure I fully understood your answer. I got that currently (V0.19 (Dec12)) it works like this

Code: Select all

 ThePartPosition  = Property/Placement       +  AttachmentOffset.
 ThePartRotation = Property/Placement_Rot * AttachmentOffset_Rot
                                       /\                                           /\
                                        |                                            |___ manually editing only
                                        |____ Transform Tool input And Assembly4LinkMapping input
In a future solution the new situation for App:Link would be like this

Code: Select all

 //App:Link special handling
 ThePartPosition  = Property/Placement(          Attachment      + AttachmentOffset).
 ThePartRotation = Property/Placement_Rot (  Attachment_Rot * AttachmentOffset_Rot)
                                       /\                                           /\                         /\
                                        |                                            |                          |___ TransformTool input ends up here
                                        |                                            |____ Assembly4LinkMapping input
                                        |____ Transform Tool input
Now App:link could you give Assembly4 access to the new Attachment variable. When App:Link get called with updates from the Transform tool it could redirect them to the AttachmentOffset variable (thus change in code required).

Maybe your answer only applied to LCS, because handling of LCS and Linked Geometry is different in Assembly4. After a new LCS you are in the standard FreeCAD MapMode dialog. After new a new Geometry link you have your own Assembly4 dialog. I can see that you store the rotations in the Placement property. The same dialog is invoked by the "Move a Part in the Assembly" Button.

Did you think about adding Transform buttons to the Mapping Dialog? Maybe that could be not only a workaround but a good long term solution to get rough positioning done in one go. (neither need of manual editing not a transform tool) It would be a bit more complex that rotary, because it would not cyle but I could see several useful ways to solve it.
With push buttons. One press gives one increment. Precise and repeatable positioning is possible, but the GUI is a bit cluttered and you click for longer distances quite a bit.

Code: Select all

                            Step            |       Increment
 "Reset"      "+X"  "+Y"  "+Z"  | "1k" "100" "  1" " 0.1" 
                   " -X"   " -Y"   " -Z"  | 
With Toggle Buttons and the mouse. Enabling "X"(left click) would move the part with the mouse in X until left click. Keys like Shift, Ctrl, Alt could be utilized to change speed or a "snap to even increments" mode. "Reset" and "X0" etc are pushbuttons to reset a single axis or all. By enabling X and Y at once, the same could work for moving on the XY plane.

Code: Select all

  "Reset"      "X"         "Y"        "Z" 
                    "X0"       "Y0"      "Z0"                   
A very powerful usecase of this feature would be in architecture. Suppose you have constructed a house and want to put in furniture from a libray. You only would need one LCS per room in your model. Then for each furniture model you select the room and place it on the floow (xy plane) in the same dialog. Using the "Move a Part in the Assembly" you can re-arrange with the same GUI.
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: Fri Jan 17, 2020 11:56 am Did you use the function "Hole LCS" for that ? ...fasteners are only inserted when the design is close to be finalised and thus less subject to the topo-naming issue.
Yes I did...a very useful tool. Thanks for that.

When articulating mechanisms, I have found that any attachments to edges, faces, and verticies can sometimes fail. Even attachments to sketches are not entirely immune if the master sketch has a wide variation in geometry. This can usually be traced to ambiguous constraints that give multiple solutions. This can sometimes be solved by changing the constraint strategy. Safest bet is to verify the master sketch first before creating any features and then check sketches as they are created over the full range of motion while using relatively small step values.
"It is a poor workman who blames his tools..." ;)
Post Reply