Closed pierreporte closed 8 months ago
Hi,
There are 3 sub-issues:
1) Values: At this moment there are tables of static pre-calculated values. It save small amount of CPU time. This is implemented at MetricCoare1st.py. The values has been calculated exactly according the ISO 261 formulas in MetricCoarse_1st.ods. Look there. We can discuss if is it a best idea (pre-calculated values), or if could be better to calculate it at each run of the function.
2) Naming of the variables: The names of the variables are 'D' and 'd' and 'D1' and 'd1' so on. I think it is not the best for naming in SW and for users. I choose a little more descriptive naming of variables. We can discuss it and look for best naming variant.
3) More pitch values: At this moment I decide to do it "simple" just with one, the most coarse pitch (1st selection). In the future there could be great to add possibility to choose pitch. But for future, it will have impact to the GUI part, not to the core of the function.
I don’t think that pre-calculated values save that much computation time if they are used only a the creation of the thread object. When saved into a file, if the values are static, it doesn’t increase loading time. It is only the creation that is a little bit slower though unnoticeable to the eye, unless you programmatically create a lot of threads, but even then it may not be the biggest contributor.
Naming wasn’t part of the issue. I think that only nominal diameter, pitch, and drill diameters are required and can be named like this. Other values and tolerance are unneeded in my opinion (they are added on the drawing. Thread tolerances may be legitimate but not length tolerance.
As you say, priority is core feature. If you can figure out everything for Part, PartDesign, and TechDraw, the rest will be more straightforward. Then it will be ready for merging into FreeCAD.
1) Static vs. calculated values. May be You are right. I can change it. But pitch is something that is connected to the thread, for example M1-P0.25 / M10-P1 (if I remember well values)... List of D-P remains as static pairs in a table.
2) Naming is very important for the core function. Once the parameters (names) are finally set, all other modules (CNC path, TechDraw, ...) use it for their own purposes. At this moment any small change makes big problems and impacts on the things we can't imagine now. It is important to discuss it as soon as possible and make decision widely accepted. Please focus on it. Thanks.
For pitch, yes you need a table in any case. It’s worse than that because ISO 261 defines more than one fine pitch for most nominal diameters.
Hi, MetricCoarse1st.py is changed. Tables are name, D_nominal, pitch and D_drill. Values D, D1 and d3 are estimated according formulas. All values are fully object wrapped - methods 'getValue' type. This approach allows to add more types of threads to UI, I hope.
ISO 68-1 and ISO 68-2 define formulas for the normal triangular threads. Based on the nominal diameter and pitch (for metric threads) or threads per inches (for imperial threads), the formulas give all needed parameters. The drill diameter is not given but the formula is well known. The formula makes custom threads possible and easy.
For metric threads, pitches defined in ISO 261 could be considered as intervals. A custom threads between two values of the table would have the same pitch of the upper limit.
Needed information is given below.
Diagram
$D$ is the basic major diameter of internal thread (nominal diameter)
$d$ is the basic major diameter of external thread (nominal diameter)
$D_2$ is the basic pitch diameter of internal thread
$d_2$ is the basic pitch diameter of external thread
$D_1$ is the basic minor diameter of internal thread
$d_1$ is the basic minor diameter of external thread
$H$ is the height of fundamental triangle
$P$ is the pitch
$n$ is the number of threads per inch
$D_{\text{drill}}$ is the drill diameter
Metric formulas
$$H=\frac{\sqrt{3}}{2}P=0.866\ 025\ 404\cdot P$$
$$\frac58 H=0.541\ 265\ 877\cdot P$$
$$\frac38 H=0.324\ 759\ 526\cdot P$$
$$\frac{H}{4}=0.216\ 506\ 351\cdot P$$
$$\frac{H}{8}=0.108\ 253\ 175\cdot P$$
$$D_{\text{drill}}=D-P$$
Imperial formulas
The formulas are the same as metric but $P$ is replaced by $1''/n$.
Values are in inches.
$$H=\frac{\sqrt{3}}{2}P=0.866\ 025\ 404\cdot\frac{1''}{n}$$
$$\frac58 H=0.541\ 265\ 877\cdot\frac{1''}{n}$$
$$\frac38 H=0.324\ 759\ 526\cdot\frac{1''}{n}$$
$$\frac{H}{4}=0.216\ 506\ 351\cdot\frac{1''}{n}$$
$$\frac{H}{8}=0.108\ 253\ 175\cdot\frac{1''}{n}$$
$$D_{\text{drill}}=D-\frac{1''}{n}$$