threadlib
threadlib copied to clipboard
Add threads for PG electrical thread
This patch adds support for PG-standard threads used in electrical boxes.
I based the specs on these images:
Tested with the internal thread of a PG16 socket as that is all I have
Hi polyfloyd. Thanks for your contribution! It looks fairly complete. I am currently abroad without access to a computer having OpenSCAD until next week. I‘ll have a closer look at it when I‘m back.
Ok, I did some tests today. Starting with tests/test.scad.
Rendering as is (type = "M12x0.5"), I get 3 volumes (the nut, the bolt, the surrounding space):
Using type = "PG16" instead, we get 34 volumes. That does not sound right. Also, we get this "may need repair" warning. This could be related to an "inside is outside" problem because of the order the profile is designed. I'm sure this is fixable.
I'm more worried about the missing gap between internal and external thread. Looking at the specs you posted above, I actually cannot see how large it is supposed to be. But without such a gap, the external- and internal threads will lock (except in lucky cases, where the external thread is a bit larger than it should and the internal one is a bit smaller).
Do you have more specs available than posted above? Usually, threads specify "classes" where they define those gaps (higher class => smaller production tolerances => smaller gaps).
There is indeed an issue with the volumes. I tried to find out why this is but I could not :(
The issue seems to occur with outer thread when rendering a bolt. The commit I pushed seemed to at least render slightly better but it is still problematic.
I looked around and found another dimensions table that has this footer:
Those are probably the tolerances for the threads.
I am in doubt as to whether the inner thread is being produced correctly, as it now seems to overlap with the outer thread. Will look again when I have some more time...
Volumes seem correct, now. PG16 bolt alone => 2 volumes. PG16 nut => 2 volumes. Nut + bolt, also 2 volumes. The last one is not what we want (3). But this is because of the missing gap. There is still the warning, though (in all three cases). I can't see why.
Regarding clearance drill: That's for a hole without threads where the bolt fits through.
Alright! Not sure what went wrong the first time and how I ended up with working thread anyway.
I have started reasoning about the calculation from scratch and have it working now :) Inner and outer threads look like the schematic and there is a little gap in between the nut and bolt.
Picture looks correct, now, nice. How did you define the gap?
The gap is based on the r parameter from the diagram. The internal and external threads both respectively add and substract r/2 from the diameter
Hi @adrianschlatter, were you able to review my changes?
Hi @polyfloyd.
Now, test.scad nut+bolt do not render at all. I get this:
I identified two problems:
- Overlap: For OpenSCAD to correctly combine two bodies ("union"), they need to have (a little) overlap. Just touching is not enough. When I increase the support diameter a little, the parts render.
- No overlap: Apparently, OpenSCAD is not too happy when subsequent windings of the thread overlap. In your definition, the pitch (1.411 mm) is less than the height of the thread cross section (2x0.7085 mm = 1.417 mm). This causes the parts to become non-simple and throws the warning "object may not be a valid two-manifold"
Please check again. I added some margin on both the support diameters and the the thread extension. It now extends 0.7021mm so 0.7021*2=1.4042 < 1.411 mm. I still get the same error and am not sure where it is caused by now :S
@adrianschlatter: Is there any news about this PR?
I created a model with a PG7 thread and was able to connect it to a purchased cable gland. Please add this great extension to this great library.