Feature Hole improvements

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
JulianStirling
Posts: 61
Joined: Sun May 29, 2016 2:19 pm
Contact:

Feature Hole improvements

Post by JulianStirling »

Hi,

I am hoping to use some spare time to fix some issues I have with the Feature Hole tool. This is my first time actually developing rather than using FreeCAD so I want to discuss my plans, and confirm a couple of things.

Problems I want to address:
1. UI sometimes has dead space next to things you cant read
Screenshot_2019-09-05_19-21-14.png
Screenshot_2019-09-05_19-21-14.png (49.34 KiB) Viewed 5892 times
2. Lots of the screws have counterbore/clearance values that are not standard
3. Cannot set thread percentage (important so that an exported STEP has the correct drill size)
4. Tolerance class is in UI but appears unused. Personally I would remove thread class here. It seems that it is something for the technical drawing?
5. Weird updating behaviour (Sorry to not be more specific, I just know that at times the model doesn't seem to update when the settings do, I haven't pinned it down yet)
6. No way to add in other screw definitions, only hard coded ones are available

Things that confuse me:
1. There seems to be two sets of source code, one in Python one in C++. I think only the C++ code is in use?
2. There seems to be commented out code to trying to actually model the thread. This seems like a bad idea, it is not normal for CAD to model threaded holes as it is a lot of overhead for very little gain.

My plan (maybe not in this order)
1. Play with UI file
Screenshot_2019-09-05_19-32-11.png
Screenshot_2019-09-05_19-32-11.png (49.95 KiB) Viewed 5892 times
2. Make and class/struct for each which can contain all of their dimensions for things like clearance holes and counterbores etc. (similar to standards.py in the FeatureHole folder)
3/4. Change the Tolerance class into a thread percentage option (Probably be good to have 50%, 75% and custom in a drop-down?)
5. Nail down what is stopping things update
6. Make a way to load in extra screw definitions.

Does this seem like a sensible way forward?
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Feature Hole improvements

Post by RatonLaveur »

Awesome sir!

Incorrect counterbore depth has been a show stopper for me.

There's also a bug in there where if you select an iso thread then go back to a default/custom hole definition the tool returns a Thread Out of Range error all the time.

Some tools also are inaccessible or buggy when generating a custom def.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature Hole improvements

Post by chrisb »

There is somewhere a topic adressing 6. AFAICR the idea was to use a file similar to the tools in Path workbench.

Concerning2: Have a look at Fasteners. In these times of 3D printing it is sometimes desired to print a thread. So it would be good to be able to switch the representation.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Feature Hole improvements

Post by eivindkvedalen »

Hi,

I did the C++ implementation, please see my comments below.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm Hi,
1. UI sometimes has dead space next to things you cant readScreenshot_2019-09-05_19-21-14.png
This is probably a bug in the size hint implementation for the spin box. It might not consider the space take by the f(x) icon.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 2. Lots of the screws have counterbore/clearance values that are not standard
All values in the tables have been found in various public available tables, if I remember correctly. It might be that they are not very much used, though.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 3. Cannot set thread percentage (important so that an exported STEP has the correct drill size)
I think this is a calculated value, based on thread standard, so the actual hole in the model should be the correct drill bit size.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 4. Tolerance class is in UI but appears unused. Personally I would remove thread class here. It seems that it is something for the technical drawing?
The intention was to provide this information to a technical drawing module.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 5. Weird updating behaviour (Sorry to not be more specific, I just know that at times the model doesn't seem to update when the settings do, I haven't pinned it down yet)
The dependencies between the different parts were hard to get right. Please file a bug report if you can pin it down.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 6. No way to add in other screw definitions, only hard coded ones are available
This is a drawback yes. I decided to go with predefined values, because some also require some calculations. It might be that these can all be precalculated, but the table sizes might explode in size if one value depends on two or more other values. I haven't checked that.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm Things that confuse me:
1. There seems to be two sets of source code, one in Python one in C++. I think only the C++ code is in use?
Only the C++ version is used now.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm 2. There seems to be commented out code to trying to actually model the thread. This seems like a bad idea, it is not normal for CAD to model threaded holes as it is a lot of overhead for very little gain.
The intention was to provide this for creating models for 3D printing, as it is perfectly fine to print working threads.
JulianStirling wrote: Thu Sep 05, 2019 7:15 pm My plan (maybe not in this order)
1. Play with UI fileScreenshot_2019-09-05_19-32-11.png
2. Make and class/struct for each which can contain all of their dimensions for things like clearance holes and counterbores etc. (similar to standards.py in the FeatureHole folder)
3/4. Change the Tolerance class into a thread percentage option (Probably be good to have 50%, 75% and custom in a drop-down?)
5. Nail down what is stopping things update
6. Make a way to load in extra screw definitions.

Does this seem like a sensible way forward?
2 and 6 can be added together. If you find a way to have an external representation, there is no need to keep some standard in the code.

Feel free to ask me questions if you dive into this, although my response time may be long now due to other obligations.

Eivind
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Feature Hole improvements

Post by eivindkvedalen »

RatonLaveur wrote: Thu Sep 05, 2019 7:41 pm Awesome sir!

Incorrect counterbore depth has been a show stopper for me.

There's also a bug in there where if you select an iso thread then go back to a default/custom hole definition the tool returns a Thread Out of Range error all the time.

Some tools also are inaccessible or buggy when generating a custom def.
Please file a bug report where you describe in detail how to recreate your problems.

Eivind
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Feature Hole improvements

Post by RatonLaveur »

I'm not yet adept at bug reporting, I'm sorry for that. I can as a stopgap explain my qualm:

1. Create new file
2. Select PartDesign WB
3. Create Body
4. Create a sketch that you pad
5. Create a circular sketch (diameter 2 mm) on that pad
6. Use the Hole tool
7. Select Profile "ISO metric coarse profile" /other types of ISO profiles work
8. Tick "threaded"
9. Select Size "M2"
10. Go back to Profile and select "none"
11. Report View says "Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Thread size out of range"

Every time.
efyx
Posts: 280
Joined: Fri Sep 26, 2014 7:36 pm

Re: Feature Hole improvements

Post by efyx »

RatonLaveur wrote: Tue Sep 10, 2019 9:13 am 5. Create a circular sketch (diameter 2 mm) on that pad
Why not points? Circles are two times more clicks.
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Feature Hole improvements

Post by eivindkvedalen »

efyx wrote: Tue Sep 10, 2019 10:17 am
RatonLaveur wrote: Tue Sep 10, 2019 9:13 am 5. Create a circular sketch (diameter 2 mm) on that pad
Why not points? Circles are two times more clicks.
Vertices are not exported to the shape, so they can't be used. See https://forum.freecadweb.org/viewtopic. ... es#p154363

Eivind
JulianStirling
Posts: 61
Joined: Sun May 29, 2016 2:19 pm
Contact:

Re: Feature Hole improvements

Post by JulianStirling »

Hi Evind,
Thanks for replying. I take your point about printing threads. And the tolerance class (though I would have "unspecified" as the default option, as speccing tolerances where they are not needed pushes prices up.)

I think for thread percentages you misunderstood me when you said it was calculated. My point is that if I am tapping aluminium I will drill a smaller hole than if I am tapping steel or copper. Steel or copper I will drill a hole for a 50% thread engagement, for aluminium I will drill one for 75% engagement. In other situations other percentages are needed. The formula you have used is for 75% engagement.

I will play with how to best define screws in the code. I think something akin to a Python dictionary would be best, then you could have some standard ones and others defined by YAML. To be honest I don't really understand how the C++ and Python communicate in FreeCAD, is there a way to access a python class from C++ in FreeCAD? Or a good article explaining how the communicate?

Once this is done we should actually populate all the counterbore/countersink fields etc with values from DIN/ISO/ANSI standards and link to the standard so people know which standards have been implemented. This way it is clear what is being used.
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: Feature Hole improvements

Post by RatonLaveur »

I'd like to say today that I am really grateful for the hole tool in Freecad. I generally don't use it because it's "still not perfect" but it's clearly getting there. Today i needed to produce a prototype using an online prototyping service and thanks to the ISO definitions in FreeCAD the online tool was able to recognize every threaded hole from normal holes.
Hence I'm sure my prototype will come out fine. So thanks for that!
Post Reply