Assembly 4 workbench

Discussion about the development of the Assembly workbench.
project4
Posts: 197
Joined: Fri Jul 12, 2013 12:53 pm

Re: Assembly 4 workbench

Postby project4 » Tue Jan 12, 2021 6:15 am

schmidtjr wrote:
Mon Jan 11, 2021 10:56 pm
Can I attach a subassembly/part by more than one attachment point?
You can, if you have multiple LCSs in the subassembly.
For the sake of the example, lets say you attach a shaft attached to the 2 parts.
If the shaft have LCSs on both sides, so attach part A to LCS_1 and part B to LCS_2.
If you want to play with the attachment point to see how everything works when the spring is compressed/released, so change the attachment offset of one of the LCSs in the direction that should move.
You won't have the spring extract/compress visually, but the rest should work as you expect.

Regards,
Alex
jmcornil
Posts: 90
Joined: Mon Nov 02, 2020 9:16 am
Location: Versailles (France)
Contact:

Re: Assembly 4 workbench

Postby jmcornil » Tue Jan 12, 2021 9:41 am

Hello Zolko

Have you an idea about the problem I send in post https://forum.freecadweb.org/viewtopic. ... &start=871 ?

Thanks in advance
schmidtjr
Posts: 17
Joined: Sun Jan 03, 2021 7:27 pm

Re: Assembly 4 workbench

Postby schmidtjr » Tue Jan 12, 2021 10:59 am

Hi,
thanks @all,
project4 wrote:
Tue Jan 12, 2021 6:15 am
You can, if you have multiple LCSs in the subassembly.
For the sake of the example, lets say you attach a shaft attached to the 2 parts.
If the shaft have LCSs on both sides, so attach part A to LCS_1 and part B to LCS_2.
If you want to play with the attachment point to see how everything works when the spring is compressed/released, so change the attachment offset of one of the LCSs in the direction that should move.
You won't have the spring extract/compress visually, but the rest should work as you expect.

Regards,
Alex
Alex, I'm not sure if I got this right.
2 LCS in the subassembly are available. One at the top, one at the bottom. Those 2 are used in the subassembly for simulating the compression of the shock.
What you propose as a shaft is the thing that I've got as a sketch in the shock assembly, isn't it? I've got a sketch (a line) with a LCS at each side. part A is connected to LCS1, part B is connected to LCS2. By resizing the sketch line, I can simulate spring compression. Also visually, both parts are moving. But this is only inside the shock assembly.
The "bigger assembly" (the one that is using the shock) is now only aware of one of those attachment points and thus can't compress the shock or attach it in any way. And, based on Zolkos answer this is the only thing that's currently possible.

So, in order to solve my problem, I would need to make my "bigger assembly" aware of the single parts of the shock. I would need to recreate the "shock constraints" in the bigger assembly. This would result in making the shock assembly itself obsolete. That's not the best (especially in terms of multi-user part libraries), but that's what is currently possible and I can live with that, just need to know it :).

Or did you mean something different?

Kind regards,
Martin Schmidt
project4
Posts: 197
Joined: Fri Jul 12, 2013 12:53 pm

Re: Assembly 4 workbench

Postby project4 » Tue Jan 12, 2021 11:25 am

I'm not sure we understand each other.

I don't care how complex the sub-assembly is (the shock).
As long as the sub-assembly have the 2 LCSs available to the bigger assembly, it doesn't matter if the subassembly looks like a sock observer, a piston, a shaft or whatever... there is a body with 2 attachment points (LCSs) that the big assembly is using.

If you already have the 2 LCSs internally in the shock subassembly, you can export them to the outer world, so any change to the distance between the LCSs in the sub-assembly should be reflected to the outer world, thus to the main assembly.

You can also define new 2 LCSs for the subassembly that will be visible to the main assembly, but since you already have them inside, you should probably export them to have data consistence.

Hope it was a bit clearer, or I didn't understand what you mean :)
I don't have the Freecad available at the moment to prepare an example
User avatar
Zolko
Posts: 1252
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Postby Zolko » Tue Jan 12, 2021 11:53 am

jmcornil wrote:
Fri Jan 08, 2021 8:12 am
  • In the first file Simple_Ex_01, the basic Sketch is defined with an explicit length of 50mm for the side. If it is rotated by varying <Angle> from 0 to 360 in steps of 1, the speed is correct.
  • In the Simple_Ex_02 file I introduced a variable <Length> of value 50 and I use this variable to define the length of the side of the Sketch. This file was saved before any animation.

    Is it bad (forbidden) to use such a variable of the <Model>?
good catch ... hum, let's see ...

What I suspect is the following: the animation changes a variable (Angle in your example) in the Variables container, and updates the Ams4 Model. If that only changes some Placement properties in the assembly, all the geometries remain unchanged and only their position is changed, while if some variables are involved in the design of some geometry, that geometry is updated each time, even if it's for the exact same geometry.

We have seen a similar problem before: wen doing an assembly in 1 file, the animation was very slow, but when doing the exact same assembly with parts from an external file, the animation was very smooth.

So while it's not forbidden to do it, it seems unwise to abuse the Variables container when doing animations. Ideally, this would be documented somewhere ...
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Zolko
Posts: 1252
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Postby Zolko » Tue Jan 12, 2021 12:09 pm

schmidtjr wrote:
Tue Jan 12, 2021 10:59 am
2 LCS in the subassembly are available. One at the top, one at the bottom. Those 2 are used in the subassembly for simulating the compression of the shock.

So, in order to solve my problem, I would need to make my "bigger assembly" aware of the single parts of the shock. I would need to recreate the "shock constraints" in the bigger assembly. This would result in making the shock assembly itself obsolete.
yes

That's not the best (especially in terms of multi-user part libraries), but that's what is currently possible
well, what I would suggest here is the following: you can create the shock assembly in a single file, with 2 parts, one with the housing and one with the piston, make your assembly and test that it works in stand-alone. Then, in the upper assembly, you don't assemble the shock assembly but the 2 separet parts and attach them to the 2 LCS in the main assembly. This way, you have your library where you can create and test individual sub-assemblies, but also use them in higher level assemblies.

I agree that it's a sort-of workaround, and the proper solution is what we have called variant links: in this case, the main assembly can "pass" variables to the sub-assembly ... but this is not yet implemented. This question has been discussed before: https://forum.freecadweb.org/viewtopic.php?f=20&t=41136

project4 wrote:
Tue Jan 12, 2021 11:25 am
If you already have the 2 LCSs internally in the shock subassembly, you can export them to the outer world, so any change to the distance between the LCSs in the sub-assembly should be reflected to the outer world, thus to the main assembly.
I think schmidtjr would like to have it the other way: he would like the sub-assembly be aware of the positions of the 2 LCS in the main assembly, and that's not possible currently (and also by principle)
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
schmidtjr
Posts: 17
Joined: Sun Jan 03, 2021 7:27 pm

Re: Assembly 4 workbench

Postby schmidtjr » Mon Jan 18, 2021 8:20 pm

Hi
sorry for my late reply, just wanted to let you know, I did it exactly as Zolko proposed. It works. It's not perfect, but it's good enough for now :)

Thank you,
Kind regards,
Martin
Radiant64
Posts: 1
Joined: Tue Jan 19, 2021 8:11 am

Re: Assembly 4 workbench

Postby Radiant64 » Tue Jan 19, 2021 9:53 am

Hello,

After having read in the forums for a while, I finally registered just to be able to post in this thread. I recently reached a point in my projects where a need for proper assembly functionality was starting to emerge, and having investigated the options, I wanted to put in my thanks for the Assembly 4 workbench.

My technical and professional background is primarily as a self-taught software developer (for many years, within a lot of different domains including some 3D graphics), with some additional experience of doing graphical design work. I have very little experience of CAD software, though I have been dabbling with FreeCAD, BRL-CAD and OpenSCAD on a hobby basis over the past few years, finding each has its own merits and drawbacks. My dabbling has eventually converged on FreeCAD as the software that clearly has the highest potential, and I'm happily seeing that development really seems to be making strides recently (especially with realthunder's brilliant branch which seems to address a lot of annoyances I didn't even know I had, sometimes in ways I could never have thought of!). Between my background and the three main assembly workbenches on offer, Assembly 4 was the one that I found to be the most intuitive to work with. Let me elaborate on my thinking, in two points:

(These are just my immediate observations as an amateur with limited experience; I may very well be wrong about some things, feel free to inform me if so.)

  • Simplicity. Not to be confused with "it's easy to click around and apparently make things happen the way I think I want them", but as in, I immediately understand the model, and can start constructing things in a structured manner. With Assembly 3, which is the other workbench I've given a proper try, I found the geometry-constraint-solver approach to require much more deliberation, since it works by subtracting DoF from an initially completely unbound system. This results in the actual attachment of parts to each other almost emerging as a pure side effect of constraining the model, instead of being the starting point like in Assembly 4. Transcribed to programming concepts, based on my understanding I would say that the Assembly 3 model roughly corresponds to a declarative paradigm, where you describe the relationship of objects, and the functionality is then emergent from the relationships described. It can be a powerful and elegant approach to certain problems (it is notably prevalent in build systems, like make), but it is sometimes very hard to understand and debug, because the flow is implicit rather than explicit.
  • Austerity. Assembly 4 seems to add little to the existing data model in FreeCAD, instead implementing assembly functionality by tying together existing FreeCAD features in new ways. That means there is little new one has to learn as a new user, if one is already familiar with the features in question. As a software developer I also think this is great, because it makes it a rather minor addition from a programming point of view, meaning it will likely be easier to maintain and adapt than would be a large system with lots of code. I also like that it doesn't add any dependencies on a solver for example, since external dependencies can be a real pain from both maintenance and distribution points of view.
And finally, I found the origin story to be a really inspiring read! It was a pleasure to be able to follow Zolko's initial suggestion, into him learning to implement it himself, and then finally to the release of a new workbench.

As for problems, I've managed to run into a few so far, the biggest being that changing the file and folder structure of an assembly will break it and require lots of manual fixing. It's not a complaint, given how there are currently no facilities in FreeCAD for separating the logical and physical aspects of different documents. It does make me think, however: What if documents themselves could be expressed symbolically as "links", and not be equivalent to actual physical files? Then restructuring a project would require only updating the document "links", after which everything else would continue working as before. It would require the introduction of some sort of "meta-document" concept though; or what I would think of as more in line with a "project" (which seems(?) to be a term that's used interchangably with "document" in FreeCAD today). An additional benefit to that approach would be that it could introduce the possibility to add grouping of documents to the tree view, which seems like it would be highly beneficial in a project with a few hundred documents or more. Any thoughts on this?
User avatar
Zolko
Posts: 1252
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Postby Zolko » Tue Jan 19, 2021 8:36 pm

Radiant64 wrote:
Tue Jan 19, 2021 9:53 am
I wanted to put in my thanks for the Assembly 4 workbench.
...
And finally, I found the origin story to be a really inspiring read! It was a pleasure to be able to follow Zolko's initial suggestion, into him learning to implement it himself, and then finally to the release of a new workbench.
thank-you for your kind words. It was indeed a surprise that the initial idea transformed into a proper workbench.

As for problems, I've managed to run into a few so far, the biggest being that changing the file and folder structure of an assembly will break it and require lots of manual fixing.
...
Any thoughts on this?
you're right that this is something that needs to be adressed sometimes, but I wouldn't yet know the best/good way to do it. A brute-force solution could be to select parts in an assembly, select the "Create sub-assembly from parts" function, which would create a new document, insert the links into this document at their curent Placement, remove the original parts, and insert the new sub-assembly ... except that the new document would not be saved thus it would not be possible to link into it ... and also this would loose all attachments between parts, and they would need to be re-created.

So ... no luck for now
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Zolko
Posts: 1252
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Postby Zolko » Thu Feb 11, 2021 12:02 pm

Hello,

Lately I've been doing actual design, and in the process I've discovered many little annoyances with this workbench. I've written some of it down in the Issues section, in order to remember them, and so others can also writhe their comments and wishes :

https://github.com/Zolko-123/FreeCAD_Assembly4/issues

This also means that I'll make a new version available sometimes soon (hopefully), so I'd invite you to have a look at the Issues list, and insert your own as you may see fit.


LaserCutter_Cantilever.PNG
LaserCutter_Cantilever.PNG (265.44 KiB) Viewed 314 times
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here