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 Dec 30, 2019 9:47 am After allot of trial and error, because of my inexperience with freeccad and A4, I managed to create a test model with A4.
wow, for a first result it's quite impressive, congratulations

OficineRobotica wrote: Mon Dec 30, 2019 9:47 am
  • sketcher uses point while asm4 uses coma in fields, and that creates alot of confusion , if I write 12,04 in a value field in the sketcher and hit enter i get a 120.4 dimension screwing the whole sketch. The use of coma/point across freecad should be consistent.
this is bad. Not sure how much of it depends on Assembly4 or on your personal settings. There is absolutely no instruction on this matter in the workbench, so if it is repeatable something should be done.

  • If I use "insert link to external part" > chose my model > decide to abbort by hitting cancel from the "place linked part" dilog, the link is created none the less with no mapping. For me, an unexperienced user about the inner working of the workbench this creates confusion. The creation of the link should be aborted when hitting cancel.
I understand you point, but when you do hit 'Cancel' it cancels the Asm4 placement, and you get a raw App::Link to your chosen target. Without any Ams4 placements. If you didn't actually want that, you can delete the created object. I don't say it's good, but it was intended to behave like that.

  • The use of shape binders at any point in the creation process will slow the animation of the model by allot. I mean the Part Design shape binders. I still have to dig in to the use of A4 axis/point/plane shape binders.
I don't know what to think of Shapebinders. I never use them, and I don't know what they're supposed to do and how they behave with Asm4. May-be worth a thread of its own ?

  • the thing that i would love the most would be some tweeks to the animation dilog, features and some visual tweaks. What i found my self needing allot is a minimum and maximum value for my Variables. For example , in my model , if i start the animation at a 0 value the two clamps colide. I need a minimum of 10 and a maximum of 100. I really think that the A2Plus animation dialog is really well done and i would love to see it in A4. The value slider is a life saver for checking the assembly for collisions.
I'll have a look, thank-you for your proposal
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: Mon Dec 30, 2019 3:47 pm Question:
How did you obtain the Clamp2 mirror of Clamp in the Model assembly? I have been using the Part > Mirror of the Body which is quite convenient, but it is a bit awkward. It kicks the mirror out of the Part which must then be returned via drag and drop resulting in a out-of-scope warning. You can then attach the Part with its mirror to the assembly LCS, but I am not so sure that is how Zolko would recommend it to be done.
App::Link allows to set a scale for the link, and when setting -1 on all axis, the part is mirrored ... but the constraints are not, the placement of the LCS is all wrong, therefore Assembly4 doesn't (yet) include the mirroring of linked objects.

One thing to try would be, when the need for a mirror of an App::Part is needed, to create another App::Part in the document of the original part for the mirror, and attach LCS to the correct — mirrored — locations. That way you could import either the part or it's mirror, both being in the same document. I didn't triy it so it might not work !
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 »

Thank you guys but I'm sure that my workflow has allot of bad practices like attaching LCS's to edges of geometry lol , still learning here. Unfortunatly I'm short of time after some long hours at work so I'l keep it short although I wanted to address more of the points of ppemawn and zolko.
ppemawm wrote: Mon Dec 30, 2019 3:47 pm Question:
How did you obtain the Clamp2 mirror of Clamp in the Model assembly? I have been using the Part > Mirror of the Body which is quite convenient, but it is a bit awkward. It kicks the mirror out of the Part which must then be returned via drag and drop resulting in a out-of-scope warning. You can then attach the Part with its mirror to the assembly LCS, but I am not so sure that is how Zolko would recommend it to be done.
I didn't use a mirror. I just inserted a new link of the clamp in the model assembly and parent it to the relevant LCS of the masterSketch. Then in the "place linked part" dilog i used rot x/y/z to orient the clamp in the desired direction. The clamp is not mirrored, is just rotated. I think it is different when one needs a actual mirrored part. I still have to try that and see the behavior
ppemawm wrote: Mon Dec 30, 2019 3:47 pm I notice that you are using a 'bottom-up' modelling approach for the assembly, i.e. all of the Parts are created at the global origin. You can only do this if all the drawings are available or if you know that all of the parts fit together beforehand. The alternative for a new assembly design is 'top-down' wherein each Part model is created in its proper location in the same file as defined by and external-referenced to a master sketch. It is the latter method that I am currently exploring with Assembly4 and about which I have much to learn as well.
I know, in fact i was inspired by your model and explanation of the "robotic leg" at apge 27 of this thread ...i think. What bothered me was the fact that using shape binders and sketches attached to lcs's created allot of overhead for the animation. I think that now , when the value of a variable is changed it triggers the recompute of the whole document ...and that is allot to recompute. So I decided to go bottom up because that model was just an exercise on understanding A4. I totally agree with you that being able to model "in place", top down is desirable and a dream for me. After all designing is a creative process.
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: Assembly 4 workbench

Post by OficineRobotica »

Zolko wrote: Mon Dec 30, 2019 8:11 pm
OficineRobotica wrote: Mon Dec 30, 2019 9:47 am
  • sketcher uses point while asm4 uses coma in fields, and that creates alot of confusion , if I write 12,04 in a value field in the sketcher and hit enter i get a 120.4 dimension screwing the whole sketch. The use of coma/point across freecad should be consistent.
this is bad. Not sure how much of it depends on Assembly4 or on your personal settings. There is absolutely no instruction on this matter in the workbench, so if it is repeatable something should be done.


I explained my self wrong here. All I wanted to say is that value fields of A4(ex inside the animation dialog) should use point instead of coma for decimals , this way the behavior is more consistent with the rest of FreeCad
I understand you point, but when you do hit 'Cancel' it cancels the Asm4 placement, and you get a raw App::Link to your chosen target. Without any Ams4 placements. If you didn't actually want that, you can delete the created object. I don't say it's good, but it was intended to behave like that.
I get it now, it's more of a core freecad thing than A4. We all can live with that.


  • the thing that i would love the most would be some tweeks to the animation dilog, features and some visual tweaks. What i found my self needing allot is a minimum and maximum value for my Variables. For example , in my model , if i start the animation at a 0 value the two clamps colide. I need a minimum of 10 and a maximum of 100. I really think that the A2Plus animation dialog is really well done and i would love to see it in A4. The value slider is a life saver for checking the assembly for collisions.
I'll have a look, thank-you for your proposal
Thank you. That would be great.
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
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 »

OficineRobotica wrote: Tue Dec 31, 2019 12:19 am I didn't use a mirror. i used rot x/y/z to orient the clamp in the desired direction. The clamp is not mirrored, is just rotated.
Zolko wrote: Mon Dec 30, 2019 8:35 pm App::Link allows to set a scale for the link, and when setting -1 on all axis, the part is mirrored
Thanks for the tips. I note that the Link > Scale > -1 mirrors only normal to the plane of the Attachment. More tools in the toolbox.
OficineRobotica wrote: Tue Dec 31, 2019 12:04 am ...using shape binders and sketches attached to lcs's created allot of overhead for the animation. I think that now , when the value of a variable is changed it triggers the recompute of the whole document ...
Zolko has changed this in V0.7.5 so that only the Model is updated by the Animator (https://forum.freecadweb.org/viewtopic. ... 40#p351420). I am trying a different approach with the same file: using a carbon copy of the master sketch in the Model in which the variable is defined for the animation. The master sketch is only for an arbitrary position of the linkages and sketch external referenced to shapebinders of the master sketch. So, we will see if animation performance with shapebinders is any better.
"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 »

vocx wrote: Sat Dec 21, 2019 3:23 am Use the proper function where needed.

Code: Select all

import libAsm4 as asm4

asm4.some_function()
asm4.SomeClass()
Done @v0.7.7. Was already in the development branch (with Asm4 because all workbenches are like Draft, Part...) This is a minor upgrade, but with plenty of small stuff so I decided to upload.

You can note that there is a "Help" entry now, with a plain HTML file in Resources (it's a dummy placeholder for now), so if you have inspiration of what would be helpful for newbies this could be a good place to make contributions. May-be this file could be merged with the Instructions ?

ppemawm wrote: Wed Dec 18, 2019 4:52 pm I notice that the Variables displayed in the property panel are listed alphabetically. If possible, can they be listed in the order they were created with the Assembly4 > Add Variable tool?
yes, I know, but I don't manage to change that. I have the feeling that it's actually a standard FreeCAD behaviour that cannot be altered.
try the Assembly4 workbench for FreCAD — tutorials here and here
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Assembly 4 workbench

Post by vocx »

Zolko wrote: Sun Jan 05, 2020 10:34 am Done @v0.7.7. Was already in the development branch (with Asm4 because all workbenches are like Draft, Part...) This is a minor upgrade, but with plenty of small stuff so I decided to upload.
...
There's still tons of small improvements that you could make to support the Python style that we want to push for in Draft, FEM, and other Python workbenches.

https://github.com/Zolko-123/FreeCAD_As ... BodyCmd.py

1. There's a ton of vertical whitespace in your files; you should probably cut some of this space. Only one empty line, or maximum two, should exist between lines of code.

2. There's the copyright missing in each file. As discussed in the other thread, it's best to include the text of the copyright in them. This is the best way to protect yourself against claims. Even if the source file is very basic, it should have the copyright text. See an example, Draft/drafttests/auxiliary.py

3. I'm not sure if all your files use Tabs for indentation, but I would suggest using 4 spaces instead of a Tab character. It's just more Pythonic this way. Tabs may not give you the right alignment, because in some cases they look like 4 spaces and in others they look like 8. Spaces gives you the most consistent spacing.

4. I would try to place the code in subfolders, which would be sub-modules under the main folder. This is what we are trying to change in Draft, which has a few huge files. We prefer the structure of FEM, which puts several functions under subdirectories and files, making it easier to change specific files.

5. We would prefer if you used Pythonic style, which means your files instead of being called newBodyCmd.py, had a name like new_body_cmd.py. Using CamelCase is mostly the C++ style that was used for historical reasons, but we would like to move gradually to a PEP8 style (see Python).

6. Take a look at my pull request #2824 where I show the new structure intended for Draft GUI commands. They are inside submodules. Object classes probably shouldn't be moved, but Gui commands, that is, those you register with Gui.addCommand() should be moved into directories, in your case, something like asm4_gui/. More details in #2823, and the links mentioned there.
Last edited by vocx on Wed Jan 08, 2020 6:16 pm, edited 1 time in total.
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
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly 4 workbench

Post by Zolko »

ppemawm wrote: Sun Dec 15, 2019 6:06 pm Until we get another of Zolko's excellent tutorials ...
See, hail hail, it arrived: I've started to make a tutorial for an assembly in 1 file with a master-sketch, and tried to do that in the master-sketch / top-down design way that you suggested some time back. The tutorial is not completely finished, but you can see the first part in the development branch of Assembly4. I'd be very happy if you could read it and give me feedback. Is i too detailed, not enough, what is missing, misleading ...
Last edited by Zolko on Fri Jan 10, 2020 11:12 am, edited 1 time in total.
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: Wed Jan 08, 2020 10:23 am I've started to make a tutorial for an assembly in 1 file with a ...master-sketch / top-down design way... I'd be very happy if you could read it and give me feedback.
Thank you for this tutorial demonstrating top-down design. It looks very good so far.

A few minor comments:
  • The title 'FreeCAD Assembly4 / Assembly without Solver' for use in top-down design is not quite accurate since the master sketch is indeed the "solver".
  • First image is not consistent with the others, e.g. Constraints folder shows a list of constraints not available in the latest revision of Assembly4(?).
  • Prerequisites: I would suggest that top-down design requires more than a basic knowledge of FreeCAD, but rather more of an intermediate, experienced working level.
  • Variables: It may be helpful to briefly explain why the particular Type is chosen. I only know what 'Float' is because I learned Fortran IV in the '60's. Maybe it is more common knowledge nowadays.
  • Variables: First step is to select Model in the Tree. Gets me every time.
  • Sketch: It would be helpful to explain why each constraint is chosen in this example. For instance, the angle constraint simulates rotation; the coincidence constraint, a pin connection; point-on-line, a slider, etc.
  • Animate Assembly: When exercising the master sketch it is important to choose the full range of Begin and End and a fairly large Step value to insure that there are no ambiguous constraints that could break the sketch. If the sketch breaks, try different constraints.
  • Create LCS: It would also be helpful to explain the purpose of the LCS and why it is attached as it is.
I will be interested to see how you relate the Parts to the master sketch, i.e. how each part is created 'in-context'. Do you suggest carboncopy sketches, sketch shapebinders, or simply, expressions to keep the part placement parametric. Also, should each Part placement be 0,0,0 or is it at the proper interface location of the mating part(s) which effects how the Part mating LCS's are defined?

I am still experimenting (struggling) with these two issues as I make the transition to Assembly4. I have been attaching Part sketches to the master sketch or its carboncopy or shapebinder rather than feature vertices, edges, or faces to avoid the topological renaming problem when making changes.

Also, I do not hide all the other parts when creating a new part in-context so as to avoid creating a part that interferes with its neighbors. I routinely use the Sketcher > Section view when creating the sketch to avoid confusion.
"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 »

Zolko wrote: Wed Jan 08, 2020 10:23 am The tutorial is not completely finished, but you can see the first part in the development branch of Assembly4
ppemawm wrote: Wed Jan 08, 2020 5:55 pm
  • The title 'FreeCAD Assembly4 / Assembly without Solver' for use in top-down design is not quite accurate since the master sketch is indeed
    the "solver".
OK

  • First image is not consistent with the others, e.g. Constraints folder shows a list of constraints not available in the latest revision of Assembly4(?).
I've updated

  • Prerequisites: I would suggest that top-down design requires more than a basic knowledge of FreeCAD, but rather more of an intermediate, experienced working level.
  • Sketch: It would be helpful to explain why each constraint is chosen in this example. For instance, the angle constraint simulates rotation; the coincidence constraint, a pin connection; point-on-line, a slider, etc.
you're right, but I don't pretend to give a course on top-down design, i wanted to present a way of using Assembly4 for top-down design, or rather the way I understood what top(down design can/should be.

  • Variables: First step is to select Model in the Tree. Gets me every time.
what do you mean ? For me, adding variables also works when nothing is selected.

  • Animate Assembly: When exercising the master sketch it is important to choose the full range of Begin and End and a fairly large Step value to insure that there are no ambiguous constraints that could break the sketch. If the sketch breaks, try different constraints.
  • Create LCS: It would also be helpful to explain the purpose of the LCS and why it is attached as it is.
good points

I will be interested to see how you relate the Parts to the master sketch, i.e. how each part is created 'in-context'. Do you suggest carboncopy sketches, sketch shapebinders, or simply, expressions to keep the part placement parametric. Also, should each Part placement be 0,0,0 or is it at the proper interface location of the mating part(s) which effects how the Part mating LCS's are defined?
I use a lot the variables. In stead of using the master sketch in every part and "extract" the value of a length from the master sketch, I add the length to the variables and use the variable length directly in each part where necessary. I'll upload the model file used for the tuto.

Also, I do not hide all the other parts when creating a new part in-context so as to avoid creating a part that interferes with its neighbors. I routinely use the Sketcher > Section view when creating the sketch to avoid confusion.
yes, I agree, I also show and hide parts quite dynamically. I'll update the tutorial.

Thank-you very much for your comments
Last edited by Zolko on Fri Jan 10, 2020 11:13 am, edited 1 time in total.
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply