3
$\begingroup$

I've been playing around with with the old library archived package "Mechanical Involute Gears"

The package has some broken things, namely those having to do with utf8 and a = that should have been a ==, which I've modified and fixed, however I am now getting an error with the result of an example in the demonstration, and it's internal function.

This code:

Show[
    pictureMachiningCog[12, 20.\[Degree], 30, .3, 10],
    Graphics[{Hue[0.31],Thickness[0.01], Line[shapeCog[12, 20\[Degree],30, .3]]}]];

enter image description here

Should give this photo as a result, which when modifying $e$ in the following functions, which will give an undercut at the bottom of the gear tooth

shapeCog[z,\[Alpha],m,e]
ShapeFullCog[z,\[Alpha],m,e]
shapeCogCenter[z,\[Alpha],m,e]
compareDeports[z,\[Alpha],m,e1,e2]
shapeGear[z,\[Alpha],m,e]

All of these functions, when delving into the package files are related to the following function profildent[] which outputs the following errors, whenever $e$ is unequal $0$ or when $z$ is lower than the theoretical value that the other function minimalNumberOfCogs[20\[Degree]] spits out.

for example:

shapeCog[17, 25 \[Degree], 30, -0.1]

Part::partw: Part 1 of {} does not exist.

Part::partw: Part 2 of {} does not exist.

** Interfence1 ** (17,25 [Degree],-0.1)

Take::take: Cannot take positions 1 through 1 in {}.

I cant seem to find the error within the code.

in other functions, within the package, such as:

pictureMachiningCog[8, 20 \[Degree], 50, -0.4, 30]

result

The expected form is displayed like expected.

The problematic internal function below:

profilDent[z_, a_, m_, deport_:0] := 
  Module[{prof1, zlim, lp1, lp4,i,j,prof3,prof4,t,pr,pti,eqd},
    zlim = nombreDentsLimite[a] ;
    prof1 = rallongeProfil[profilDentDev[z,a,m,deport], m z/2 + m + m deport] ;
    If [ norme[prof1[[1]]] < z m/2-1.25 m + m deport,
        (* on est trop bas*)
        prof1 = Select[prof1, norme[#]>z m/2-1.25 m + m deport & ]
    ];
    (* puis on rallonge *)
    prof1 = Reverse[rallongeProfil[Reverse[prof1], z m/2-1.25 m + m deport]] ;
    If[ (z > zlim) && (deport == 0), 
        Printf["pas d'interfences"]; 
        profComplet = prof1,
       (* else *)
        eqd = Evaluate[devCercleGen[t,a,(-m+m deport/Cos[a]), m z (*Cos[a]*) ]];
        pr = ParametricPlot[Evaluate[eqd], {t,-3 Pi/z ,-.2/z}, 
            PlotPoints->20, DisplayFunction->Identity];
            prof3 = pr[[1,1,1,1]];
        prof4 = Select[prof3, ArcTan @@ (#-{-m Tan[a],m z/2-m})<(Pi/2-a 0.6)&];
        i=1; lp1=Length[prof1]-1;
        j=lp1; lp4=Length[prof4]-1;
        While[ Not[ pti == interSegments[ prof4[[i]],prof4[[i+1]],prof1[[j]],prof1[[j+1]] ] ], 
            If[i<lp4, 
                i++, 
                If[j>1,
                    j--;i=1,
                    Print["Pas d'interfence (",z,",",a,",",deport,")"]; 
                    Return[ profComplet = prof1 ] ;
            ]   ]
        ];
        Print["** Interfence1 ** (",z,",",a,",",deport,")"] ;
        profComplet = Reverse[faireListeXY[{Reverse[Take[prof1,-(lp1-j+1)]],pti,Take[prof4,-(lp4-i+1)]}]];
    ];
    Return[profComplet]
]

Are there better eyes than mine able to see the problems with the code?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.