"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: 3440
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

OK, Git now has BodyBuilder4.1, some instructions, and an image of the dialog menus. I will do a couple videos of the basics.
https://github.com/Freedman-CB1/BodyBuilder

Thanks, edwilliams16 for the code that allows me to get Body selections from a 3D face selection.
Thanks, dtay for the matrix idea.

Here is an earlier discussion:
viewtopic.php?t=75597&start=10

Thanks all
freedman
Veteran
Posts: 3440
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 have made a few changes to BodyBuilder, all in the GUI and object selection area. Version 4.3
https://github.com/Freedman-CB1/BodyBuilder

I also did some testing with Clones and they seem to work just like a Body. That capability can help decrease file size and adds a lot of structure to a model with many identical shapes i.e. if you want to design a deck, all the deck plates could be clones so they can be copies but still be individually edited if needed.
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: Sat Mar 18, 2023 8:38 pm I have made a few changes to BodyBuilder, all in the GUI and object selection area. Version 4.3
https://github.com/Freedman-CB1/BodyBuilder
I just got an error when tried to run it with latest FreeCAD 0.21.0 weekly build:

Code: Select all

23:35:22  <class 'SyntaxError'>: ('unterminated string literal (detected at line 14)', ('/home/user/.FreeCAD/Macro/BodyBuilder.FCMacro', 14, 16, '__Requires__ = "Built on 21.', 14, 16))
There was no such issue with previous BodyBuilder 4.1.

N.B. Maybe it would be good to add extension to macro file name ("BodyBuilder.FCMacro") and not change that filename on each update.
: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: 3440
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 fixed it, forgot to commit, again. They should put the commit button at the top of page.
Thanks
Maybe it would be good to add extension to macro file name ("BodyBuilder.FCMacro") and not change that filename on each update.
I'm new to Git so I don't know how the updating is supposed to keep up with new version vs the old. I removed the rev number from the name so the file is always BodyBuilder. As I rev it with small changes the title bar is my way of showing the rev #. I'm not sure what the user should be doing if they want an old version. I have put little effort in Git, will do some reading.
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: Sat Mar 18, 2023 9:58 pm I fixed it, forgot to commit, again. They should put the commit button at the top of page.
Thanks
Maybe it would be good to add extension to macro file name ("BodyBuilder.FCMacro") and not change that filename on each update.
I'm new to Git so I don't know how the updating is supposed to keep up with new version vs the old. I removed the rev number from the name so the file is always BodyBuilder. As I rev it with small changes the title bar is my way of showing the rev #. I'm not sure what the user should be doing if they want an old version. I have put little effort in Git, will do some reading.
Thanks for hotfix! You may just edit macro file on GitHub like in text editor: https://docs.github.com/en/repositories ... ting-files

Also, I just created a pull request to fix extension name (*.macro :arrow: *.FCMacro): You may just merge it now to fix extension (but use "Squash and merge" in a "Merge pull request" button drop-down menu):
.
github-merge.png
github-merge.png (17.1 KiB) Viewed 1299 times
: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: 3440
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

After following this thread:
"The need for a default assembly workbench"
viewtopic.php?t=76799

I believe this could be a possible new Gui to code-up for PartDesign. Here is a procedure to make an assembly connection:

1) In the Tree, Select a Body and CTL select a Sketch (obviously from a different body). Click the new make attachment icon.

With the assembly engine running the Body origin would be aligned to the selected Sketch origin immediately. The next issue is rotating the attached Body so the user gets what they want.

2) Add 2 icons +View and -View, as the icons are clicked the Body will change to different rotations. The user would click these until they get the one they want. Once set the data will be saved in Properties.
Edit: If parts are designed using standard planes there are only approx. 12 rotation possibilities, all at 90 degree increments.

3)If the user needs some sort of offset there will be custom Properties in the property panel. This is where they do adjustments.

This is the simplest Assembly I can think of, so far....
demonlibra
Posts: 79
Joined: Tue Jan 21, 2020 1:11 pm

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

Post by demonlibra »

Is there are a simply demonstration video from begin how to use this macro?
freedman
Veteran
Posts: 3440
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

Maybe this will get you started. I turned the origins on so you can see the objects base placement. So, two Bodies placed randomly, I click on To Positioning and then to Edit Binding. I click the cylinder and then a sketch ( in another Body) to create a binding. I then show how to click the cylinder and remove the binding and properties, and then apply them once again. Then change to Positioning and move the cylinder around with binding constraints. Then switch the dialog back to it's minimal state.

As long as the macro runs the objects will be bound together.
Attachments
GIF 3-23-2023 4-08-44 PM.gif
GIF 3-23-2023 4-08-44 PM.gif (542.48 KiB) Viewed 1075 times
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

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

Post by Lonfor »

freedman wrote: Thu Mar 23, 2023 11:12 pm Maybe this will get you started. I turned the origins on so you can see the objects base placement.
If you can achieve that instead of bodies to have external files (their file name in the tree of course) for manipulation with "BodyBuilder", a statue will be erected in your honor. :)
Attachments
QHsDg8r.jpeg
QHsDg8r.jpeg (32.99 KiB) Viewed 1024 times
freedman
Veteran
Posts: 3440
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

Lonfor, that would be something for a more powerful assembler. Darn I really like the armor with the 3D guys on it.
My goals are like this:

1) Make BodyBuilder (BB) icon pop-up driven.

2) Make the BB core run as a resident macro i.e. the portion of the code (about 30 python lines) that keep objects attached. I tried this and it worked but I need more testing. BB only runs when required by callbacks so it's very low overhead. I did something similar here.
3) I want to get to sketch based manipulation. Adding a sketch with geometry that is read by BB, this will feed data to the Body Positioning variables. For instance; you draw a sketch of a circle, then an angled line with a circle on the end; when ran the Body (with all the attachments) would move the line angle and distance while rotating. The circle sizes would be the rotation speed, something like that. I think sketches would be perfect for the source of 2D sims.
Post Reply