"BodyBuilder", a PartDesign macro for assembling bodies

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

ppemawm, thanks for the explaining. I thought about using only the first sketch but I use a different approach than some, maybe many, not sure. Here is a video; In the start of it I click on different sketches, the coords XY show in the dialog.
I then open sketch075 and see it's origin, then I open sketch076 and use my sketch origin mover. I enable the (sketcher only) tool and select the vertex I placed, the sketch origin moves to that vertex.

I get a few advantages from doing things this way,
1) because the Body origin is always binded to the Sketch origin there is no chance for TNP, no attachment to fail, no LCS needed.
2) I get to rotate about the center of a sketch, that makes life easy.
3) I see where my binded object is located by the sketch cross-hairs.

I especially like the sketch coords readout when doing flat panel work. I get easy to read direct center coordinates where objects will be placed in PartDesign just by clicking on the sketch, all relative to the 0,0 origin.
Attachments
sketch_usage.gif
sketch_usage.gif (650.44 KiB) Viewed 1693 times
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

Here is my new PartDesign tool. What I thought I wanted was an assembly tool, during the software design what I found was the assembly was just a small part of the tool, what I really wanted was a tool for easy to do positioning and Body manipulation. To do that the Body needs a place to reference from which is the binding connection to something.

I will change the title of the post after a while, the tool name is "BodyBuilder", this seems fitting since it builds Bodies into a design.

The macro binds the Body origin to the selected Sketch origin, then you can manipulate the Body position. To make a bind the Body has to be selected in the 3D. While in "Builder Edit" mode, selection of anything besides a Sketch will change the selection to the Body.

Here is a simple video, I will do more of them to explain many of the features.

In the picture the three menus are shown. Left: Default-small.............MIddle: Builder edit...........Right: Sketcher editing

I attached the file from the video.

I don't have much time for instructions right now but I will do them.

All comments are welcome especially anything visual.
Attachments
GIF_basic_binding.gif
GIF_basic_binding.gif (505.96 KiB) Viewed 1526 times
peg_hole1.FCStd
(57.09 KiB) Downloaded 29 times
menu.png
menu.png (230.2 KiB) Viewed 1526 times
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by freedman »

Thought I would try a test. Started a windmill, this is 15 minutes of work: The file is 2meg so I can't post. BodyBuilder doesn't use clones or Links (currently) but I don't seem to care as long as I can model quickly. My goals are to organize bodies into a parametric model and when I have it the way I want it, put all the stuff in a Part container, then move to the next aspect of the project.

I created one blade and did a copy/paste with checkbox "Paste with binding" and then set the orbit angle of each blade. In the start of the video you can see I click on a few blades, notice the Orbital "Z" which is around the center piece. You can also see that each blade is rotated to 22 degrees, it's local Rotation. All this data is very easliy set and it is stored with each Body.

The macro is fast, all the blades (Bodies) bindings are recalculated as the windmill spins.
Attachments
GIF_colorwheel.gif
GIF_colorwheel.gif (569.07 KiB) Viewed 1450 times
Last edited by freedman on Mon Feb 27, 2023 10:00 pm, edited 1 time in total.
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by freedman »

Just wanted to go over some of the data (pic) used in BodyBuilder. You can see the list of added Properties I used, as a test I crossed out the adjustments for the dialog. The Conx_LInk is for future use so that leaves 2 pieces of data. The Conx_BindTo is the name of the sketch the body is connected to and the Conx_Level is a variable assigned to build the assembly in the correct order.

Recalculation of the objects position (assembly) occurs by callbacks from FreeCAD.
The root of the macro works like this, In a loop:
Set level compare to 20, find a Body with a Conx_BindTo, if level compare equals Conx_Level then match the Body origin to the sketch origin.
Increase the level compare and do again.
Do all the above until you run out of compare values.

My point is that by adding a little code and a couple variables, PartDesign could have it's own assembly.

I know there are already a few Assemblers but I wonder if there is a piece missing in the Assembly system. Is there a place for an App. like BodyBuilder, an easy and fast way to assemble a bunch of Bodies into Parts. Once Bodies are placed in a Part container they keep their positions. If the user is building a large system then use those Parts in a full Assembler. Just thinking about stuff......
Attachments
reduced.png
reduced.png (93.07 KiB) Viewed 1343 times
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by onekk »

Probably the only thing that is missing to have a good framework added to FreeCAD is a way to set easily set reference points on precise location of a solid.

once you have a stable way to describe where as example the center of another solid face should be connected to another solid face it is a matter o setting simply a bunch if relations between faces.

But this is not feasible until TNP is solved.

The key is to managed a bunch of relationships between complex objects, not only placements, as maybe center of mass or other relevant engineering things.

But as you could see it is not as simple as it could seem.

If you limit to few objects a in a simple file it is not too hard, but probably FreeCAD need also something more advanced.

Some talking has to be done, but probably for the next iteration, as many evolutions are subject to have decent TNP mitigation in place and working.

Regards.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by freedman »

I made some changes to BodyBuilder and fixed a couple things. Here is a link.
https://github.com/Freedman-CB1/BodyBuilder

Also if anyone is interested I have made upgrades to my Anti-TNP tool. Here is a link:
https://github.com/Freedman-CB1/Wiptopo61

I use these two very powerful macros. They have fixed most all the problems with Standard FreeCAD. To me this shows how stable FreeCAD really is and with just a few fixes the program will be outstanding.

Thank you developers
app4soft
Posts: 78
Joined: Sat Feb 25, 2023 6:23 pm
Location: Ukraine
Contact:

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by app4soft »

freedman wrote: Wed Mar 01, 2023 6:32 pm Also if anyone is interested I have made upgrades to my Anti-TNP tool. Here is a link:
https://github.com/Freedman-CB1/Wiptopo61
Anti-TNP tool is not included in linked repo.
:idea: Commissions Open! https://bmc.link/app4soft/commissions
Making 2D/3D CAD with FreeCAD, LibreCAD & SolveSpace apps.
YouTube: https://youtube.com/@app4soft
BMC: https://buymeacoffee.com/app4soft
Patreon: https://patreon.com/app4soft (all FREE)
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by freedman »

There now, forgot to commit.
Thanks
last_not_used_login
Posts: 76
Joined: Sun Feb 05, 2023 12:47 am

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by last_not_used_login »

@freedman
Hi,
Your tool looks good.
could you add some instruction how to install you macro?
freedman
Veteran
Posts: 3436
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Releasing "BodyBuilder", a PartDesign macro for assembling bodies

Post by freedman »

It's not in the add-ons.

It looks like this should work:
1) In Github, select Raw
2) highlight a small portion of the code text
3) Right click in the text and then use Select all
4) Copy to clipboard Ctl+C
5) Either paste in a text file or paste in FreeCAD new macro.
6) The new text file needs to be in the Macro directory and have extension .FCMacro
Post Reply