New Assembly 4?

Discussion about the development of the Assembly workbench.
dan-miel
Posts: 375
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

New Assembly 4?

Post by dan-miel »

Updated March 11, 2019
To cover assembly 4 topics, a new thread called Assembly 4 workbench has been started and is hosted by @Zolko at:
https://forum.freecadweb.org/viewtopic.php?f=20&t=34806

Please do not post here.

Thank you. Dan.

Assembly 4 is based on the idea of placing parts in an assembly by using the LCS, Local Coordinate Systems (called Csys in Catia V5) of the parts where as A2plus and Assembly 3 uses constraints to place the parts. The idea was Introduced by Zolko who felt the rebuild times would be less than using constraints because constraints require mathematical solver processing time whereas the LCS is built into the part.

Zolko: Statement from Feb. 24,2019
"Assembly 4, was assembly without solver, you can download it below, to be extracted into ~/.FreeCAD/Mod. It's not as sophisticated as A2+ or A3, but it allows to assemble hundreds of parts quite easily. It's more like a proof-of-concept actually.
Asm4 "https://github.com/Zolko-123/FreeCAD_aw ... 4_v0.3.zip

In order to use Assembly 4 you must use realthunder's Asm3 AppImage. App::Link is only available with that (or your self-compiled LinkStage3 branch)
Asm3 available here: https://github.com/realthunder/FreeCAD_ ... 3/releases


Step by step instructions:
  • take a piece of paper, draw your boxes (yes, I'm not kidding)
  • decide what are the functional elements of your boxes (corner, middle-point, hole ...)
  • once that's done, fire-up FreeCAD (but really only after you have done the previous points !)
  • new document → new part → new sketch → draw sketch such as where you would want the previously decided reference points to be. If necessary, make several sketches
  • save your document as asm_2boxes
  • new document → new part → new body → new sketch → draw a rectangle of approximate size → extrude that rectangle → save document as box 1
  • create some LCS where you think you want your previously decided reference points to be
  • repeat for box 2
  • in asm_2boxes, insert box1, place according to the LCS
  • repeat for box 2
  • now that you know how your boxes are going to actually be assembly this way, modify them. Create new LCS if necessary. Don't design any details until you're satisfied with the way the boxes fit together.
  • swap between assembly and part to check that you are going into the right direction
  • Go into more detail of the boxes' design, and, if necessary, create a new (second) body, which is going to be your real part.

Original post starts here::::

Quotes are from the assembly3 preview Thread.
Zolko wrote: Sun Feb 24, 2019 10:50 am
there are 3 new WBs for assembly

chrisb wrote: Sun Feb 24, 2019 1:52 pm
I know of Assembly3 and A2Plus. Which is the third one?

Zolko wrote: Fri Mar 24, 2019 7:33pm
Assembly 4, was assembly without solver, you can download it here, to be extracted into ~/.FreeCAD/Mod. It's not as sophisticated as A2+ or A3, but it allows to assemble hundreds of parts quite easily. It's more like a proof-of-concept actually
[/quote] Here is the link https://github.com/Zolko-123/FreeCAD_a ... _v0.3.zip

Hi all
Another Assembly work bench seems available. I downloaded the files and started the workbench. I have attached a picture of the Icons and a dialog box that showed when I clicked on the "Insert a external part" icon. There is a read me file in the Assembly 4 directory but I haven't had a chance to read it yet. This all I know about Assembly 4.
I found this information by reading posts in the "Assembly3 preview" thread. The posts are dated Feb 24 through March 1 2019.
Dan
Last edited by dan-miel on Mon Mar 11, 2019 10:24 am, edited 4 times in total.
User avatar
Zolko
Veteran
Posts: 2166
Joined: Mon Dec 17, 2018 10:02 am

Re: New Assembly 4?

Post by Zolko »

nice, thank-you

dan-miel wrote: Sat Mar 02, 2019 1:09 pm I have attached a picture of the Icons and a dialog box that showed when I clicked on the "Insert a external part" icon.
In order to insert a part into an assembly, 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
  • save
  • close
  • re-open
Yes, this is unprofessional, but I don't know how to do better, all suggestions are welcome. This is not as elegant as A2+ does (when inserting a file it shows a dialog to open a file), but it's similar to the way SolidWorks behaves (the file needs to be in memory, although you can save a file and it will be seen as such). You can use the provided example assembly to experiment with this workbench
try the Assembly4 workbench for FreCAD — tutorials here and here
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: New Assembly 4?

Post by catman »

@Zolko Thanks for this great effort. I found your approach a very valuable addition on how to setup reusable parts and simply their use in larger assemblies. Hopefully that approach will be part of a future unified assembly solution in FreeCAD.

I have not known about the "Map Mode" before. It took me a while to find out that 'MapMode' is accessed via the property dialog of applicable FreeCAD objects. It is a very useful feature, I think. And its absolutely essential in working with Assembly4. Maybe its a good idea to include a screenshot on where to select it in the Readme.md file. Also I find that the Dialogs fully allow to work without using the macros at all.

I am sorry for the long text, but I can offer some feedback and thoughts after starting to use your Assembly4 workbench for a small project. Maybe some will be considered useful.

Its quite fascinating to find a best-practice approach for working with this new tool. As you wrote in another thread there is a bit more effort to define the (multiple) ICS for each part. However, by using the MapMode feature its very easy and quick to attach a new ICS to a geometrical feature. The complexity is more with the rotations. Whatever orientation you would choose at a single part, it gets difficult to keep both ICS of mateable parts aligned to each other. This even more when reusing parts designed some time ago or designed by other people. I found more often that not I had to correct ICS rotation to match parts correctly.
The dialogs dialogs are a terrific help to select matching ICS between parts. Probable I am using too many of them: for many holes I have one ICS for each side. For each thread threre should be one ICS for the matching screw, That adds up. So the best feature of the dialog is the "Show" button, where you can quickly find out which two ICS belong together.
For the rotation matching there are multiple choices: in the ICS parameters, in the parts parameters or in the Constraint parameters? All is possible and all works. But I am not aware of benefits and risks of each choice, so I ended up in a mess. In some places I had changes in two places :?. If there is no strong indication for a case-by-case decision (currently I do not care), I would opt for a 'default' enforced by a dialog, e.g. in the Constraint parameters. Also usually these changes are 90° steps only. So a dialog with "+90°" button for each axis should cover 90% of the cases and speed things up a lot.

Another aspect is how to structure the project in respect to files. Should I have have a seperate FreeCAD file for each part that should be attachable to other parts? From a production point of view it could be sensible that any item has a file that is manufactured as a single piece. Items that are (statically) connected to one larger item (e.g. screwed/welded,glued together etc) would go to a separate file. That is a bit of a change to what the newest FreeCAD tree extensions would have suggested before: make a big part tree with all parts of a complex component in a single file.
I am aware that everyone still can do whatever he/she pleases, of course. The interesting question is, however, considered the restrictions imposed by Assembly4 is there a best-practice way that works for reuse and can scale even for large projects?
Currently I think your approach of the example to use "assembly files" is the most natural approach. That are normal FreeCAD files that contain your "Model" strcuture, but no own geometry. The file may contain a sketch (only if any dynamic linkage is required) and multiple linked files with constraints. You example is exactly like this, except I would have expected that the sketch with the hexagon would be in a higher leve file "asm_engine.fxstd". For a mid size project this approach uses really 'a lot' of files. If indeed all have to be open with Assembly4 this is going to be really interesting to work with the top hierarchy "asm_xxx" files :? .
With so many files I guess one would set up a folder hierarchy on disk. But is that a good idea with Assembly4 (or Assembly3)? What is about changing the structure during development or renaming the folders? Wouldn't that break the whole assembly? Probably at this early stage of development using folder hierarchies is not a good idea... ;)

Finally,I find that LCS axes rendering is a bit strange, at least in my default FreeCAD installation. I am not aware of any settings to modify it. The LCS axes extend far beyond every screen edge. In a "ams_xxxx-fcstd" file I find all these red/green/blue lines quickly clutter the screen.
To switch them off is not as easy as it seems: you have to open each imported part and manually "space" every visibilty. This repeats down to the lowest hierarchy level. I keep switching off the whole part. It get ennerving only when I want to make a clean screenshot for documentation. I am still looking for a good way to get rid of all of them in one go.
I guess its quite tricky to recursively switch off each ICS of an imported part. I am not sure if a macro can do that. But when ICS are becoming a common item to use it would be useful to have a quick toggle feature (like the "space" visibilty toggle) to show/hide them as needed and also some settings to change the size. Not sure what would be a useful way to do it, set a fixed size per project (e.g. 20mm) or a relative size from the screen viewport. I guess there is some experimentation required. If someone knows how to change the size seeting by python please post.


Interesting times working with FreeCAD this 2019. Seems to me V0.19 has the potential to a game-changing release :-)
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: New Assembly 4?

Post by catman »

There is some problem with renaming items. After chaning the label of an ICS or a linked part the "Move" button dialog dos not work as intended. A renamed LCS does appear with its true name but not its new label. It can be selected, but does not work. Also a renamed part can not be properly moved to a different LCS.

Maybe somewhere real name and label gets mixed up.

How to reproduce
- Open the example ams_Bielle
- add Screw_CHC as new part
- Select new part and press Move Button. With "Show" you can switch between LCS_0 and LCS_Sketch. Select "LCS_Sketch" and press OK
- rename LCS_Sketch -> LCS_Sketch001
- Recompute
- Select again and press Move Button. Note "LCS_Sketch" does not show the new label
- With "Show" you can once switch "LCS_0", but not back to "LCS_Sketch". Press OK
- Rename back to "LCS_Sketch", Recompute and try again. Now it works again.
triplus
Veteran
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: New Assembly 4?

Post by triplus »

Zolko wrote: Mon Feb 18, 2019 10:26 am hello,

I have created a new WorkBench for this solution, called Assembly 4 (I didn't start this numbering war but I will not loose it :-) ).
Great. Are there any tutorials already made available for Assembly 4? Would be great if you would create one for:
Zolko wrote: Fri Feb 08, 2019 10:09 pm
triplus wrote: Wed Feb 06, 2019 8:46 pm All your examples are basically too complex to base an initial discussion on them.
I don't understand: I tried to provide some simple examples, made from just 4 parts, were they too complex ? Did you try to open them ?

Can you demonstrate such use case in Assembly 3 build?
  • take a piece of paper, draw your boxes (yes, I'm not kidding)
  • decide what are the functional elements of your boxes (corner, middle-point, hole ...)
  • once that's done, fire-up FreeCAD (but really only after you have done the previous points !)
  • new document → new part → new sketch → draw sketch such as where you would want the previously decided reference points to be. If necessary, make several sketches
  • save your document as asm_2boxes
  • new document → new part → new body → new sketch → draw a rectangle of approximate size → extrude that rectangle → save document as box 1
  • create some LCS where you think you want your previously decided reference points to be
  • repeat for box 2
  • in asm_2boxes, insert box1, place according to the LCS
  • repeat for box 2
  • now that you know how your boxes are going to actually be assembly this way, modify them. Create new LCS if necessary. Don't design any details until you're satisfied with the way the boxes fit together.
  • swap between assembly and part to check that you are going into the right direction
  • Go into more detail of the boxes' design, and, if necessary, create a new (second) body, which is going to be your real part.
Thanks.
User avatar
Zolko
Veteran
Posts: 2166
Joined: Mon Dec 17, 2018 10:02 am

Re: New Assembly 4?

Post by Zolko »

catman wrote: Tue Mar 05, 2019 3:44 pm For the rotation matching there are multiple choices: a dialog with "+90°" button for each axis should cover 90% of the cases and speed things up a lot.
nice, I'm working exactly on that. Should be ready in 1-2 days

Another aspect is how to structure the project in respect to files. Should I have have a seperate FreeCAD file for each part that should be attachable to other parts? From a production point of view it could be sensible that any item has a file that is manufactured as a single piece.
that's how it's done in all other CAD systems, so that was my default choice. Now, with FreeCAD and Asm4 you could actually have several Models in 1 file, not sure if that has advantages. I would opt for a Darwinian approach: let's see what survives

With so many files I guess one would set up a folder hierarchy on disk. But is that a good idea with Assembly4 (or Assembly3)? What is about changing the structure during development or renaming the folders? Wouldn't that break the whole assembly? Probably at this early stage of development using folder hierarchies is not a good idea...
directory structure is what I have in mind, and it works with Asm4. But yes, changing the names of directories will break the assembly ... as it should. And yes, you should test and stress the system with many hierarchical levels, so we can sort out the mess. I'm especially worried what happens with symbolic links and / and \ separators !

Finally,I find that LCS axes rendering is a bit strange, at least in my default FreeCAD installation. I am not aware of any settings to modify it.
you can't yet. Yes, that's a very nasty bug, but considering that 2 month ago there was no coordinate system at all in FreeCAD we came a long way. My preferred choice would be that LCS have a fixed size w.r.t. the screen, and that datum planes have fixed (and user-settable) sizes w.r.t. the object geometries.

catman wrote: Tue Mar 05, 2019 5:44 pm There is some problem with renaming items. After chaning the label of an ICS or a linked part the "Move" button dialog dos not work as intended.
yes, that's a known bug, renaming objects (LCS or Links) is not supported currently. Please choose carefully the name at creation time, and then live with that.

thank-you for testing and reporting.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2166
Joined: Mon Dec 17, 2018 10:02 am

Re: New Assembly 4?

Post by Zolko »

catman wrote: Tue Mar 05, 2019 3:44 pm For the rotation matching there are multiple choices: a dialog with "+90°" button for each axis should cover 90% of the cases and speed things up a lot.
done. Can you please replace the previous ~/.FreeCAD/Mod/Assembly4/placeLinkCmd.py file by the one attached here ? There are 3 new buttons Rot X, Rot Y, Rot Z that should do exactly that. If it works as expected, I'll update the documentation and make a v0.4

PS: if someone feels like helping, it would be very much appreciated. I've reached my level of incompetence.
Attachments
placeLinkCmd.py
(20.44 KiB) Downloaded 98 times
try the Assembly4 workbench for FreCAD — tutorials here and here
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: New Assembly 4?

Post by catman »

Zolko wrote: Tue Mar 05, 2019 6:50 pm
catman wrote: Tue Mar 05, 2019 3:44 pm For the rotation matching there are multiple choices: a dialog with "+90°" button for each axis should cover 90% of the cases and speed things up a lot.
nice, I'm working exactly on that. Should be ready in 1-2 days
You made my day! :D
Maybe some more feedback fresh from today. I am becoming convinced that its a waste of time to plan ahead for LCS orientation on matable joints. I am getting a 4 Level hierarcy already with a rather simple sub system. That already is enough to either get lost or spend ages to plan ahead in order not to get lost :(. So I feel its more fluent to just get good in adaptation.
A new thing is that I kept running into the one-axis limit. That means I would need to turn a part 90°x, then -90z (i.e matrix concatenation). No way to do that manually with only one axis and angle. To do this in a dialog should be possible. I guess its not too difficult from the math side (just a few rotation matrices) but its more difficult from the usability side. Maybe you should plan your dialog to include an "Advanced..." button. In a later stage that could open another dialog where one can just add rotations about single axes over time and return the final result upon closure of the dialog. That could be a reusable dialog to other places where rotations need to be right-multiplied. In order to realize a live update one could copy the current matrix and convert that back to Euler on each user input.

Zolko wrote: Tue Mar 05, 2019 6:50 pm that's how it's done in all other CAD systems, so that was my default choice. Now, with FreeCAD and Asm4 you could actually have several Models in 1 file, not sure if that has advantages. I would opt for a Darwinian approach: let's see what survives

directory structure is what I have in mind, and it works with Asm4. But yes, changing the names of directories will break the assembly ... as it should. And yes, you should test and stress the system with many hierarchical levels, so we can sort out the mess. I'm especially worried what happens with symbolic links and / and \ separators !
Unfortunately other systems already are in that usability nightmare to change filenames after they have been used in an assembly by a special system. I have no idea on how to do this better, but to find a different approach for FreeCAD would be a really be a masterpiece.

I would not have expected people are using symlinks for cad files. You should not have a problem with hardlinks and they are a better solution for a user. Maybe its something to point out in the documentation. The seprator issue - isn't there an abstraction layer for that in FreeCAD internal libraries? Some of the gurus here should have advice on that.

Zolko wrote: Tue Mar 05, 2019 6:50 pm
catman wrote: Tue Mar 05, 2019 3:44 pm Finally,I find that LCS axes rendering is a bit strange, at least in my default FreeCAD installation. I am not aware of any settings to modify it.
you can't yet. Yes, that's a very nasty bug, but considering that 2 month ago there was no coordinate system at all in FreeCAD we came a long way.
:cry: Well. Good to know. Thanks
Zolko wrote: Tue Mar 05, 2019 6:50 pm My preferred choice would be that LCS have a fixed size w.r.t. the screen, and that datum planes have fixed (and user-settable) sizes w.r.t. the object geometries.
I think that needs to be trialed and errored a bit. The guys most affected would be the architects, I guess, because they are hughe structures with 10th of meters but often need to work in small corners. If screen relative is used and you zoom lets say to check out how a new balcony fence fits into in the overall architecture, you might see only a red/green/blue blob for the balcony. My projects have very different sizes, but within the projects usually stay in the same range, so both should work fine.
Zolko wrote: Tue Mar 05, 2019 6:50 pm yes, that's a known bug, renaming objects (LCS or Links) is not supported currently. Please choose carefully the name at creation time, and then live with that.
The problem with that is that its not easy to find out the old LCS names. I have similar effects with renaming of linked objects, the bug seems to effect those as well. Maybe its an idea to disable to "Enter a new Name" edit box in the dialog as long as the bug is there. It does not prevent manual renaming, but at least it would not urge you to do it. The effects is a bit hard to track down, because there is no obvious connection to the renaming. Is that a bug in FreeCAD base or in realthunders extensions?
Zolko wrote: Tue Mar 05, 2019 6:50 pm thank-you for testing and reporting.
Great. Was not use if it was really useful (because TLDR ;) )
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: New Assembly 4?

Post by catman »

Zolko wrote: Tue Mar 05, 2019 9:43 pm done. Can you please replace the previous ~/.FreeCAD/Mod/Assembly4/placeLinkCmd.py file by the one attached here ? There are 3 new buttons Rot X, Rot Y, Rot Z that should do exactly that. If it works as expected, I'll update the documentation and make a v0.4
Work great! Real productivity boost. This alreay achieves what I had described in my last post (yours was posted while I was typing). So one could make several rotations and then save the final result. Its really worth to keep that function resuable.
Maybe you want to add a static text line to tell what the buttons do, i.e. match LCS orientaion in constraints (when I am not mistaken on where this takes effect?).

BTW, I noted one disadvantage to make changes in the constraints: when I want to do "dynamics" like your pistons, you are changing parameters in the constrains in a loop, right? If so, then this gets really difficult, if the initial angles are not (0/0/0, [0,0,1]) but something arbitrary. You would need something like in your dialog to put a axis rotation on top of that. Is there another good option for making changes? I am a bit lost because sometimes I can change orientation almost everywhere and sometimes the system overwrites them. Sometimes the values are in blue (no idea what that means).
I'm afraid I am a bit stuck due to the renaming bug, because many links in my do not work properly. Guess its time to restart fresh..

What is your vision for the workflow? From a user p.o.v. I could imagine your dialog in 3 places
[*]on the source part, e.g. your screw to set the interface LCS interactively by rotating and moving (or even selecting a vertex). Basically most is already in the MapMode dialog, but its not really efficient.
[*]on the target part to put down the receiving interface LCS in the same way
[*]when actually moving/attaching parts, as the current dialog.

Do you think is makes sense to include lateral movement as well? Or would that overload the dialog and make things worse?



The Python file you sent me, does that contain the full dialog and the math functions?
Zolko wrote: Tue Mar 05, 2019 9:43 pm PS: if someone feels like helping, it would be very much appreciated. I've reached my level of incompetence.
Mr. Peter would be impressed with you. :D

I will try what I can, but I am still fighting FreeCAD basics. :oops:
User avatar
Zolko
Veteran
Posts: 2166
Joined: Mon Dec 17, 2018 10:02 am

Re: New Assembly 4?

Post by Zolko »

catman wrote: Tue Mar 05, 2019 11:05 pm BTW, I noted one disadvantage to make changes in the constraints: when I want to do "dynamics" like your pistons, you are changing parameters in the constrains in a loop, right?
it's probably possible to do it that way, but I do it by rotating an LCS in the assembly: a "skeleton" sketch is attached (by MapMode) to that LCS, and the moving parts are attached to those. The dynamics is done by changing the value of a (standard) attachment parameter of the (moving) LCS. The AttachmentOffset in the constraint is meant be static, even though you could use it in other ways.

I am a bit lost because sometimes I can change orientation almost everywhere and sometimes the system overwrites them. Sometimes the values are in blue (no idea what that means).
every object in FreeCAD has a Placement property. This placement can either be assigned by parameters, or by a mathematical formula evaluated by the ExpressionEngine: in this case it's blue, and when you change it manually it gets overwritten as soon as you quit the dialog box.

What is your vision for the workflow? From a user p.o.v. I could imagine your dialog in 3 places:
  • on the source part, e.g. your screw to set the interface LCS interactively by rotating and moving (or even selecting a vertex). Basically most is already in the MapMode dialog, but its not really efficient.
  • on the target part to put down the receiving interface LCS in the same way
  • when actually moving/attaching parts, as the current dialog.
my initial idea was for (very) large assemblies, designed by different people. This is a different use-case than an assembly made in a single file, which is reserved, in practice, to a single designer doing all steps of the design, from parts to the final assembly.

So the workflow was supposed to be distributable: imagine an assembly made from 2 parts (yes, OK, it's not "very" large in this case, it's for illustration purposes), designed by 2 different people, and the assembly done by a third person, with Part2 attached in the assembly to an LCS in Part1 (a sister part). In this case, the person doing the assembly cannot change the LCS in Part1 or Part2, so if Part2 is wrongly oriented his only choice is to re-orient Part2 in the assembly using the constraint that belongs to the assembly, meaning your point #3. And even if the assembler could ask his colleague doing Part2 to change the orientation of the LCS in Part2 (if it's the same person for example), then all other instances of Part2 in other assemblies would also be affected, forbidding usage of re-usable parts libraries. So definitively point #3

The Python file you sent me, does that contain the full dialog and the math functions?
all my Python commands are nearly self-contained: only the expression building and decoding is in a separate library file (libAsm4). As for the math, that's the beauty of this: there is none. Or, rather, it's all built-in right at the core of the FreeCAD App::Placement object.
try the Assembly4 workbench for FreCAD — tutorials here and here
Locked