First steps: Bearing Workbench

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
matthiaswm
Posts: 35
Joined: Wed Nov 18, 2020 11:41 am
Location: Düsseldorf, Germany

First steps: Bearing Workbench

Post by matthiaswm »

After a bit of hacking around (this is my first Python project), I thought I let you know about my little Roller Bearing Workbench:

https://github.com/MatthiasWM/FreeCAD_BearingsWB

It's not much yet, but it has a little database attached with 400 quite common ball bearings.

To improve the way the database is queried, I want to write a Task Panel next, but my Qt knowledge is quite minimal and the Qt Creator seems quite scary. Pointers, links, and general suggestions always appreciated.
FreeCAD_0_20_and_Bwb6Table_py.png
FreeCAD_0_20_and_Bwb6Table_py.png (182.85 KiB) Viewed 1291 times
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: First steps: Bearing Workbench

Post by jnxd »

matthiaswm wrote: Fri Aug 05, 2022 8:16 pm To improve the way the database is queried, I want to write a Task Panel next, but my Qt knowledge is quite minimal and the Qt Creator seems quite scary. Pointers, links, and general suggestions always appreciated.

FreeCAD_0_20_and_Bwb6Table_py.png
I would advise you to make a mock up for the "task panel". At best, someone would be able to write you the UI files and implementation. At worst, you get one step closer to understanding Qt yourself because now you have a project.
My latest (or last) project: B-spline Construction Project.
User avatar
bensay
Posts: 202
Joined: Wed Dec 22, 2021 8:14 pm
Location: Danmark
Contact:

Re: First steps: Bearing Workbench

Post by bensay »

matthiaswm wrote: Fri Aug 05, 2022 8:16 pm To improve the way the database is queried, I want to write a Task Panel next, but my Qt knowledge is quite minimal and the Qt Creator seems quite scary. Pointers, links, and general suggestions always appreciated.
I'd be happy to give you a quick introduction to how the UI system works. This is not on expert level but sure should be enough to get a lot of starting off knowledge. This will probably require a lot of talking back and forth, so talking on a chat forum would surely be easiest. I got Discord and can be added as bensay#5141 and there is also the FreeCAD Discord server https://discord.gg/mTmcn7msqv where you should be welcome to ping me.
User avatar
matthiaswm
Posts: 35
Joined: Wed Nov 18, 2020 11:41 am
Location: Düsseldorf, Germany

Re: First steps: Bearing Workbench

Post by matthiaswm »

Thanks for the offer to get the UI stuff going. I was able to fiddle out a few things already, but I will get back to you when needed.
Haavard
Posts: 217
Joined: Wed Feb 17, 2021 10:48 pm

Re: First steps: Bearing Workbench

Post by Haavard »

Is this something that can perhaps be merged with the fasteners workbench?
User avatar
matthiaswm
Posts: 35
Joined: Wed Nov 18, 2020 11:41 am
Location: Düsseldorf, Germany

Re: First steps: Bearing Workbench

Post by matthiaswm »

Haavard wrote: Mon Aug 08, 2022 9:58 am Is this something that can perhaps be merged with the fasteners workbench?
That was actually my first intuition, and some of my code is based on what I found in the Fastener workbench source. For the time being, I decided to start new workbench, so that my commits don't disturb the Fastener repo. When the Bearings WB is getting mature, and the community prefers a merge, it would be an easy thing to do and I would of course support that.
Haavard
Posts: 217
Joined: Wed Feb 17, 2021 10:48 pm

Re: First steps: Bearing Workbench

Post by Haavard »

matthiaswm wrote: Mon Aug 08, 2022 1:41 pm That was actually my first intuition...
Cool! This is a nice move towards a more complete freecad toolbox :)
Will checkout this workbench the next time i use a bearing in a part.
User avatar
matthiaswm
Posts: 35
Joined: Wed Nov 18, 2020 11:41 am
Location: Düsseldorf, Germany

Re: First steps: Bearing Workbench

Post by matthiaswm »

Ok, I have a question:

I am using the "App::PropertyEnumeration" for the bearing Designation because it provides a neat list of enumeration. Because the list is quite large with 400+ options, I only show those to the user that make sense in the context.

When I use `obj.Designation = [ "608", "612", ... ]` to change that list, it does not update until I deselect the property and result it. I would like to update it immediately though. Is there a way?

My current workaround removes the entire property and adds it again with the new set of choices, which works, but seems ugly:

https://github.com/MatthiasWM/FreeCAD_B ... gs.py#L101
User avatar
matthiaswm
Posts: 35
Joined: Wed Nov 18, 2020 11:41 am
Location: Düsseldorf, Germany

Re: First steps: Bearing Workbench

Post by matthiaswm »

I released a v0.0.3. If anyone likes to try it, simply click on a new document, then the bearing symbol in the bearing WB, the select the bearing. The Property dialog will show the designation. Click on it, and you will get a choice of similar bearings.

Likewise, change any of the diameters or the width, and the WB will try to find the matching Designation. If there is none, the user can still choose a similar bearing from the Designation pulldown menu.

Code: Select all

https://youtu.be/wVlp09tWLBE
Post Reply