"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!
cadcam
Posts: 273
Joined: Thu Apr 02, 2020 10:39 am

Re: Soon to release PartDesign Assembly

Post by cadcam »

As a person who hates (well dislikes) having to move the mouse to
hit fields is there anyway to set a shortcut to select individual offsets/rotations and then simply
rotate mouse wheel to adjust, or if problematic set something like <shift> LMB/<shift> RMB to move up/down through
the adjust options and <shift>MMB to adjust highlighted?

BW
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

As a person who hates (well dislikes) having to move the mouse
Me too.
What you see in the video (a couple posts back) is just what you want, I hover over the fields and use the scroll wheel.

I'm coding the final bit that keeps track when bindings are deleted and then we could have a hanging assembly that could be attached to another assembly. All the assemblies need to be scanned from their beginings so the trunk and branches are all built in order. You can't have a branch process prior to it's connected trunk.
cadcam
Posts: 273
Joined: Thu Apr 02, 2020 10:39 am

Re: Soon to release PartDesign Assembly

Post by cadcam »

Me too.
What you see in the video (a couple posts back) is just what you want, I hover over the fields and use the scroll wheel.
That is what inspired my question. I am not in front of a machine with FC on at present to check, but do I understand
the user has to select the field to be adjusted by clicking each time. e.g adjust overall view -> select body to be adjusted -> select field -> adjust value. In many situations, especially testing/trialing/checking fitting of components, the user can become involved with quite a lot of interaction between overall view and adjusting the position of an individual body (component). Having to breakoff to the menu could become quite 'intrusive' to the operation. [I know it is different to your normal layout, but could selectable representations of the available adjustments be overlaid on the 3d view when a body is selected, perhaps aiding the user choose the correct offset, rotation direction rather than having to remember which way x/y/z is now the overall model has been moved/spun?

I must admit I haven't looked at the code, but would it be possible to offer the option of displaying the interference of the body, being adjusted, with the assembly in 'realtime'? [Perhaps as a wireframe volume. Obviously if cpu allows it would be nice to display all interferences all the time, but if not possible an option to leave (possibly in a different colour) the wireframe of any remaining volumes when swapping bodies as a reminder to the user]

Really like the simplicity of the operation/setup, keep up the good ideas

BW
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

cadcam wrote
but do I understand the user has to select the field to be adjusted by clicking each time. e.g adjust overall view -> select body to be adjusted -> select field -> adjust value.
It's like this; select body to be adjusted -> hover the cursor over the field -> (no click) scroll mouse to adjust Up/Down. You could then hover the cursor over any other field and scroll, no click. I can't imagine it being much simpler.

It seems there are two modes when working in real-time, there is wanting a constrained or locked-in model so you can see the whole picture and then wanting a way to test objects and move them about. I can imagine having a lock button that places objects per the lock data, if unlocked the objects could be moved about for testing. The lock data is essentially the constraints. Would need a way to update locked data. Not sure...

The keyboard and RMB/LMB could be useful, to be able to select and move everything is much better for designing.
I know it is different to your normal layout, but could selectable representations of the available adjustments be overlaid on the 3d view when a body is selected, perhaps aiding the user choose the correct offset, rotation direction rather than having to remember which way x/y/z is now the overall model has been moved/spun?
I'm not that good with python;

Object selection could activate the Origin X and Y Axis, this would show the base of the object.

I'm still working on the basic core code, most all the user options will come later. I do want to keep it simple.
Thanks
cadcam
Posts: 273
Joined: Thu Apr 02, 2020 10:39 am

Re: Soon to release PartDesign Assembly

Post by cadcam »

Do you have a site where users can download a version to try/give feedback?
It's like this; select body to be adjusted -> hover the cursor over the field -> (no click) scroll mouse to adjust Up/Down. You could then hover the cursor over any other field and scroll, no click. I can't imagine it being much simpler.
Potentially, but I am always concerned about the time take for the user to refocus when moving the pointer, and associated tiredness after long periods pof use. Thus I was thinking that if the individual operations were accessible by shortcut, e.g. arx 'Assemble Rotate X axis', ary, arz, axz or positioning icons (arrows etc) adjacent to the body I would be concentrating on the visual placement rather than having to repeatedly refocus on which field in the menu I was hovering over [Keep the selection in a menu as an option!].

Again potentially alot of work, but displaying the angle and particularly offset adjacent to the body/vector could be a saver on eye-refocusing, e.g what happens when I move that body (.1,.. .15, ... .2mm)

Keep up the good work,
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

Do you have a site where users can download a version to try/give feedback?
The macro source is not available yet, I had core issues to get working.

I'm about done, just need some code clean-up. I got everything working and now we can make assemblies in PartDesign. This has been great fun!

When the gif video Starts I have selected the post (purple) and set it to transform, as I rotate the Post all the bodies move as one assembly because the macro updates all the bindings.

The macro allows you to select Bodies and bind them to Sketches. In the video the Bodies are all sketch attached to each other or to the main square plate. I use the dialog 'Rotate and Offset' to move the selected objects relative to the sketch binding. The button 'Edit Base Axis' rotates 90 degrees in 8 different axis again relative to Sketch normal.

The circular sketches are a concept I'm working on, if the sketch is a target binding location then by drawing multiple circles it makes for an easy selection and for an easy identifier.

I will post the macro in a few days with some short operation videos.
Attachments
4Good_PDA1.gif
4Good_PDA1.gif (801.73 KiB) Viewed 1604 times
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

It looks like I need to add another button to the dialog "Base feature axis change". I'll work on it.
I imported (from McMaster) an R8-Fly cutter, Taper chuck and a couple end mills to build an assembly. The STLs from McMaster have many different orientations so I will add a tool button to flip them about. My macro depends on the major axis to be in the Z plane for my rotation tools to work correctly.

My main goal for this project is to be able to open trays of objects so I can pick and choose what to add to the assembly. Imported STLs are a big part of that that I'm sure there is no standard on how they are created.

The video; I imported the parts and put this together in about an hour, really powerful stuff. You can probably see a repeated process of "Delete binding" and then a sketch selection that creates a new binding. You can see how I extended the sketch targets out from under the objects so they can be sketch selected.
Attachments
Machine tool1.gif
Machine tool1.gif (510.16 KiB) Viewed 1477 times
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Soon to release PartDesign Assembly

Post by Zolko »

freedman wrote: Thu Nov 24, 2022 5:19 am
aren't you reinventing the wheel? Isn't this more or less what asm4 does?
I have done what Zolko (the ASM4 creator) started with and then moved on (he said). I'm sure he found the restrictions too great working with Bodies and decided to put everything in a Part container and use LCS's for connections.
No, the point was to be able to do assemblies, and use them as sub-assemblies in another assembly. Is this something your tool does (nested assemblies) ?

Also, can you re-use a body multiple times in an assembly ?

I can understand that Asm4 doesn't fill all the needs, but wouldn't it be more productive if you improved an existing tool rather than inventing a new one from skratch ? As you can see in the history of the Asm4 repo, I'm quite open to merge other peoples code (well, it's not open-bar either)

I make assemblies directly in PartDesign with Bodies, I make assembly connections using origins, Body to Sketch.
what do you mean by "connections" ? There was a time a added AttachmentExtensions to Bodies (and Parts) and then could use the Part_Attacher to "connect" Bodies to other features of things (Sketcher but not only), which was quite good, but distroyed the possibility to do nested assemblies (because AttachmentOffset was used by Asm4 and the AttacherExtension).
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: Soon to release PartDesign Assembly

Post by ppemawm »

freedman wrote: Wed Jan 18, 2023 6:31 pm The video; I imported the parts and put this together in about an hour,
Thanks for the video, it helps to better clarify your process.

This seems to be the same as the method I use with Assembly4. When you create an Assembly4 Body you have a default LCS for use in an assembly. A Part container is not necessary or desired. Double clicking the Body takes you to PartDesign and the dialog to select the origin plane. The first sketch in the Body is then automatically placed at this default LCS origin. The key is to use this sketch to create the first assembly interface feature for a mating part. I then add LCS's to the sketches creating any other mating feature in the Body such as bolt holes, pilots, bores, etc. That way it stays fairly robust with parametric changes. If you do this with all bodies then it is a piece of cake to assemble.

The same process can be used with sub-assemblies except that the default LCS in the Assembly4 Model (Part) container is used to locate the sub-assembly in the top assembly. And, when you import step files into an Assembly4 Part container you also have an default LCS for assembly.

So, I am struggling to find an advantage or a meaningful difference with your approach since you will undoubtedly evolve to include all of the features that Assembly4 already includes. Even simple assemblies likely include bodies that must be able to move according to constraints. One advantage with your approach is that you do not have to create LCS's, but, they do add an extra level of control over assembly constraints by using attachment offset, variables, and Expressions.
"It is a poor workman who blames his tools..." ;)
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Soon to release PartDesign Assembly

Post by freedman »

Is this something your tool does (nested assemblies) Also, can you re-use a body multiple times in an assembly ?
I thought it would be easier to post a video of what I did for copy/paste. You should be able to make out the copy(CTL +C) and Paste, I just do a small placement offset for the new copy and any additional. All the bindings are copied.
wouldn't it be more productive if you improved an existing tool
I'm sure your right. I don't feel like my skills are up for that, but maybe.....

I'm not sure about nested assemblies, maybe the video explains.

I just kind of code along and look to find advantages in certain concepts, not sure I have a real plan like ASM4. I have thought about tearing out much of my GUI and make something very simple. I kind-of had to get this far to understand everything.

Oh! I don't use any attachments that FreeCAD has to offer, I modify the Placement of the Body.
Attachments
copy_paste.gif
copy_paste.gif (768.55 KiB) Viewed 1348 times
Post Reply