From b21cf693f10c583741ce0c6cf1de30588bbb0352 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 23 Dec 2024 20:46:26 -0300 Subject: [PATCH] feat(PD): ISO tyre valve threads --- src/Mod/PartDesign/App/FeatureHole.cpp | 38 ++++++++++++++++++- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 1 + .../PartDesign/PartDesignTests/TestHole.py | 5 +++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index 616b17305f..d259e1145c 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -72,7 +72,7 @@ namespace PartDesign { const char* Hole::DepthTypeEnums[] = { "Dimension", "ThroughAll", /*, "UpToFirst", */ nullptr }; const char* Hole::ThreadDepthTypeEnums[] = { "Hole Depth", "Dimension", "Tapped (DIN76)", nullptr }; -const char* Hole::ThreadTypeEnums[] = { "None", "ISOMetricProfile", "ISOMetricFineProfile", "UNC", "UNF", "UNEF", "NPT", "BSP", "BSW", "BSF", nullptr}; +const char* Hole::ThreadTypeEnums[] = { "None", "ISOMetricProfile", "ISOMetricFineProfile", "UNC", "UNF", "UNEF", "NPT", "BSP", "BSW", "BSF", "ISOTyre", nullptr}; const char* Hole::ClearanceNoneEnums[] = { "-", "-", "-", nullptr}; const char* Hole::ClearanceMetricEnums[] = { "Medium", "Fine", "Coarse", nullptr}; @@ -527,6 +527,30 @@ const std::vector Hole::threadDescription[] = { "3 3/4", 95.250, 5.644, 0.0 }, { "4", 101.600, 5.644, 0.0 }, { "4 1/4", 107.950, 6.350, 0.0 }, + }, + /* ISO Tyre valve threads */ + // ISO 4570:2002 + // Ordered as the standard + { + { "5v1", 5.334, 0.705, 0 }, // Schrader internal + { "5v2", 5.370, 1.058, 0 }, // Presta cap + { "6v1", 6.160, 0.800, 0 }, // Presta body + { "8v1", 7.798, 0.794, 0 }, // Schrader external + { "9v1", 9.525, 0.794, 0 }, + { "10v2", 10.414, 0.907, 0 }, + { "12v1", 12.319, 0.977, 0 }, + { "13v1", 12.700, 1.270, 0 }, + { "8v2", 7.938, 1.058, 0 }, + { "10v1", 9.800, 1.000, 0 }, + { "11v1", 11.113, 1.270, 0 }, + { "13v2", 12.700, 0.794, 0 }, + { "15v1", 15.137, 1.000, 0 }, + { "16v1", 15.875, 0.941, 0 }, + { "17v1", 17.137, 1.000, 0 }, + { "17v2", 17.463, 1.058, 0 }, + { "17v3", 17.463, 1.588, 0 }, + { "19v1", 19.050, 1.588, 0 }, + { "20v1", 20.642, 1.000, 0 }, } }; @@ -1484,6 +1508,10 @@ void Hole::onChanged(const App::Property* prop) HoleCutType.setEnums(HoleCutType_BSF_Enums); ThreadFit.setEnums(ClearanceOtherEnums); } + else if (type == "ISOTyre") { + ThreadClass.setEnums(ThreadClass_None_Enums); + HoleCutType.setEnums(HoleCutType_None_Enums); + } bool isNone = type == "None"; bool isThreaded = Threaded.getValue(); @@ -2381,7 +2409,13 @@ TopoDS_Shape Hole::makeThread(const gp_Vec& xDir, const gp_Vec& zDir, double len ); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p1, p2).Edge()); - mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p2, p3).Edge()); + if (threadTypeStr == "ISOTyre") { + gp_Pnt crest = toPnt((RmajC + (Pitch / 32)) * xDir + Pitch / 2 * zDir); + Handle(Geom_TrimmedCurve) arc1 = GC_MakeArcOfCircle(p2, crest, p3).Value(); + mkThreadWire.Add(BRepBuilderAPI_MakeEdge(arc1).Edge()); + } else { + mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p2, p3).Edge()); + } mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p3, p4).Edge()); mkThreadWire.Add(BRepBuilderAPI_MakeEdge(p4, p1).Edge()); } diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 6851b18ce2..a9666682fa 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -70,6 +70,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->ThreadType->addItem(tr("ISO/BSP pipes"), QByteArray("ISO")); ui->ThreadType->addItem(tr("BSW whitworth"), QByteArray("Other")); ui->ThreadType->addItem(tr("BSF whitworth fine"), QByteArray("Other")); + ui->ThreadType->addItem(tr("ISO tyre valves"), QByteArray("Other")); // read values from the hole properties auto pcHole = getObject(); diff --git a/src/Mod/PartDesign/PartDesignTests/TestHole.py b/src/Mod/PartDesign/PartDesignTests/TestHole.py index cc4c16786e..a7af5d0194 100644 --- a/src/Mod/PartDesign/PartDesignTests/TestHole.py +++ b/src/Mod/PartDesign/PartDesignTests/TestHole.py @@ -309,6 +309,11 @@ class TestHole(unittest.TestCase): "3", "3 1/4", "3 1/2", "3 3/4", "4", "4 1/4", ], + 'ISOTyre': [ + "5v1", "5v2", "6v1", "8v1", "9v1", "10v2", + "12v1", "13v1", "8v2", "10v1", "11v1", "13v2", + "15v1", "16v1", "17v1", "17v2", "17v3", "19v1", "20v1", + ], } allowed_types = self.Hole.getEnumerationsOfProperty("ThreadType") for type_index, thread_type in enumerate(thread_types.keys(), 1):