"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: 3441
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 post a test file. I threw a few bodies together and made some attachments. I added some sketch circles so you could see the (essentially blank) sketch, they are used for a reference so there is no geometry to see.
Attachments
Expo1.png
Expo1.png (390.07 KiB) Viewed 1416 times
expo1.FCStd
(94.44 KiB) Downloaded 24 times
freedman
Veteran
Posts: 3441
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'm working on BodyBuilder (BB) in two ways:
1) Making it a toolbar macro for ease of use.
2) Working on a 3D solver concept.

See the video; When I use the placement tools in BB, I am the solver :) . I'm thinking that if I make the adjustable strut a special combined object, place sketches at the ends and add adjustment code, this could be a 3D solvable attachment. I certainly have made the tools to move the objects, I would think that solving is just making a move and then determine if I am getting closer.
It's never that easy......

Wish I had more time to work on it.
Attachments
GIF solver1.gif
GIF solver1.gif (625.71 KiB) Viewed 1289 times
freedman
Veteran
Posts: 3441
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 a bunch of progress: You can see in the video I have created my own toolbar, I've never done icons prior so that was fun, the icons are in the macro. I changed the GUI of BodyBuilder (BB) to use the toolbar so it's much easier to use. Thanks Mario52 for giving me a good example of toolbars.

The image: I created a ball, then a knob and attached the two, then copy/paste with (include binding set) to make a few more knobs. Then put that in a Part Container and made a couple copies of the Part. So I made one binding and everything else is just a few keystrokes. You can see how I placed the knobs position with the control panel. The sketched bottom of the knobs have the same radius as the ball so the knobs slide over the surface as I use the Orbit tool to move them. Of coarse the macro needs to be running to keep the bindings. This took me about 1/2 hour to design, fun stuff.

I added pattern making to BB so with a few setups, arrays of bodies can be made. This will speed things along.

I started out to make a coronavirus but got bored and went for wild colors instead. I think it's cool looking.

I have some testing to do but I should be done in a week or so....
Attachments
knob2.FCStd
(184.17 KiB) Downloaded 22 times
GIF 5-2-2023 12-51-07 PM.gif
GIF 5-2-2023 12-51-07 PM.gif (426.19 KiB) Viewed 1183 times
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

Here is the macro. I would appreciate anyone trying this on other than a windows box.

The video: I select Sketch which has it's origin in the center of the block, then many Bodies. I click Add bind and all the selected Bodies are now attached to the block sketch. Once attached their positions can be placed with the adjustment dialog. Notice when objects are selected with the adjust dialog open, all selections change to the Body object of the selection.

I open and edit the Sketch in 3D view and then toggle the visibility of an object.

I have made the icon tool tips the instructions, we shall see how that works out.

Thank you for any feedback
Attachments
BodyBuilder1_3.FCMacro
(115.91 KiB) Downloaded 20 times
BodyBuilder_1_0.gif
BodyBuilder_1_0.gif (564.68 KiB) Viewed 1068 times
Last edited by freedman on Fri May 12, 2023 2:18 pm, edited 2 times in total.
freedman
Veteran
Posts: 3441
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'll post one more updated macro here and then put it on GIT. BodyBuilder1_0 was pretty flawed, here is an updated version, 1_2.

I added more power to the macro; Normally I used the edit fields to move the bound Body, I added the ability to move a sketch if selected. If multiple objects are bound to a sketch then moving that sketch moves all the objects. Also added Reverese Sketch.

Transparency now works on imported STEP files.

Attached a file also, I will post a video on the next post.
Attachments
BodyBuilder1_3.FCMacro
(115.91 KiB) Downloaded 25 times
Ring2_work1.FCStd
(469.22 KiB) Downloaded 22 times
Last edited by freedman on Fri May 12, 2023 9:47 pm, edited 2 times in total.
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

Edit: Found an issue with a checkbox edit, updating the macro to version 1_3.

Here is a video, it's pretty cool to see the power of attachment.

You can see that all the pin Bodies are bound to Sketch007 so as I move the sketch all the pins move.

After that I select the Bearing_screw assembly. The screw is bound to the bearing and the bearing is bound to Sketch002. I select some options in the dialog to control the copy/paste, I keep the binding and also change the orbital position by 72 degrees. The pasted Part copies (bearings bound to sketch002) sit on top of each other until the Sketch is moved in the X axis, this shows a cool looking placement as the adjustments are made. For the orbit to show or be noticed the object can't be at 0,0,0, there has to be some X or Y offset. You can imagine a space satellite, if it was at 0,0,0 there wouldn't be much of an orbit, only when there is some off-axis does it actually orbit.
Attachments
Copy_paste33.gif
Copy_paste33.gif (814.98 KiB) Viewed 952 times
freedman
Veteran
Posts: 3441
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 had an idea that took some time to ferment. I have the bindings and the controls but I just didn't know how to apply it . By adding a couple new properties and 3 lines of linkage code (to make things fast) I now have some kinematics.

The video:
I just got this working so I made a quick video. Simple simulations, YES!
We have 4 stairs that have bindings at the handrail. I have enabled sim at each of the rail connections so this locks the rotations with options to modify the angles and multiplier at the bottom of the dialog. The sim lock allows the user to change the angle of the binding body while not affecting the angle of the attached. Using Orbital rotation preserves the angles as the orbiting rotation occurs. You can see I'm working on a circular staircase as an example.

Anyone need a 10 axis robot arm, no problem. :)

The Multiplier (dialog bottom) allows me to input a gear ratio so instead of rail pieces I would just draw gears and apply the ratio.

I also did a lot of work on making patterns using Clones and copy/paste.

Looks like the dialog is getting too long. Hmm...

A few days of testing and I will get this to Git.
Attachments
Builder3_sim2.gif
Builder3_sim2.gif (932.74 KiB) Viewed 659 times
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

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

Post by freedman »

Been working on BodyBuilder and advanced simulations (pic) and advanced ideas. I wanted to do a piston engine and next a vehicle front suspension. Between those two complex systems I think that will cover just about anything.

I never really wanted to do the assembler thing, I wanted to assemble objects to do simulations. I'm hoping to do assembles in a high level, kind of like a high level language. I'm looking into a concept to load mechanisms that are functional, they just need to be hooked up. Once you get it hooked up you can modify the mechanism sketches and features to make yours.
For instance, in the pic the user would bring in a rod/piston/cylinder group, then target a crank sketch (for the rod) and a cylinder sketch on a block. At that point the piston, rod, cylinder would be functional if the crank turned.

There really aren't that many combinations of mechanical connections; for instance an arm, it either connects to something it moves in a path or something that turns or it pivots on an axis.
A gear turns another gear or a gear can move an arm, that's it.

I guess we will see how I do.
Attachments
Pistons.gif
Pistons.gif (937.65 KiB) Viewed 388 times
Post Reply