hexagon logo

script problem - get highest point of each tooth of a gear

Hello there

I have a problem with a basic script. I don’t know how to create a basic script though.. so I thought maybe one of you guys could help me out.

First let me explain what I’m trying to do:
The part I’m scanning has an external gear (ø10.38mm) with 36 teeth. I use a linear open scan without probe compensation to take the points. The point density is 50/mm. After the scan I run a script that should fill another scan with the highest point of each tooth (36hits). From this scan I can then create a circle to evaluate the outer diameter and its roundness.
The problem I’m having is that sometimes the script works without any problems and other times I get some error messages (the error messages are attached below).

Thank you in advance!

This is the program code:
OPTION_TASTER/MAXKRAFT=0.12,NIEDRIGEKRAFT=0.019,HOHEKRAFT=0.101,AUSLÖSERKRAFT=0.04,
              TASTERGENAUIGKEIT=0.1,POSGENAUIGKEIT=0.1,ANZRÜCKMELDUNGEN=7,
              RÜCKFAHRGESCHW=0.4,SCANPUNKTDICHTE=50,
              SCANBESCHLEUNIGUNG=15,SCANVERSATZKRAFT=0.12,
              TASTMODUS=DFL,MANFEINTASTUNG=NEIN
            ZUWEISEN/V_TIP_DIAM=PROBEDATA("DIAM")
            BEWEGEN/SICHERHEITSEBENE
SCN_1138_1 =ELEMENT/SCAN,OFFENE_LINIE,ANZAHL DER MESSPUNKTE=1941,MESSPUNKTE EINBLENDEN=NEIN,ALLEPARAMANZEIGEN=NEIN
            MESS/SCAN
            BASIS_SCAN/GERADE,ANZAHL DER MESSPUNKTE=1941,MESSPUNKTE EINBLENDEN=NEIN,ALLEPARAMANZEIGEN=NEIN
            ENDESCAN
            ENDEMESS/
            BEWEGEN/SICHERHEITSEBENE
KR_1138_1  =ELEMENT/KREIS,KARTESISCH,AUSSEN,HÜLLKR,JA
            NENN/<0,0,3.125>,<0,0,1>,11.38
            MESS/<0.006,0.006,3.126>,<0,0,1>,11.403
            KONST/KREIS,BE,2D,SCN_1138_1,,
            AUSREISSER_ENTFERNEN/AUS,3
            FILTER/AUS,WPU=0
$$ NEIN,
            ---- Here I create a "dummy" scan that will be always skipped 
            ---- (see the GOTO command), but this scan will be manipulated and
            ---- filled with data by the script that follows, so it acts just as container
            ---- where we save the data
            GOTO/L1
SCN_SCRIPT_1=BASIS_SCAN/GERADE,ANZAHL DER MESSPUNKTE=149,MESSPUNKTE EINBLENDEN=NEIN,ALLEPARAMANZEIGEN=JA
            <-2.913,4.903,3.125>,<-0.073,5.703,3.129>,Schnittebenenvektor=0,0,1,Richtungsvektor=0,-1,0
            Anfangsvektor=0,0,1,Endvektor=0,0,1,STÄRKE=0,TASTERKOMP=NEIN,RELATIVBEWEGUNG=NEIN,ABSTAND=0
            FILTER/NULLFILTER,
            AUSFÜHRART=LERNEN
            BEREICHSGRENZE/EBENE,<0,0,0>,Ebenenvektor=0,1,0,Crossings=2
            MESSPKTART/VEKTOR
            NENNW._MODUS=MASTER
            ENDESCAN
L1         =SPRUNGMARKE/
$$ NEIN,
            ---- The scritp looks at the scan given under ARG1 (that may be also many scans 
            ---- too, listed all separated by "," - this migh be useful when star probes are used
            ---- the part may be orineted as rotation at any angle, but must be in XY!
            ---- Then he extracts the maximum diameter points from all tips in the
            ---- scan indicated under ARG2 (our container). We need to input the total
            ---- number of teeth under ARG3
CS1        =SKRIPT/DATEINAME= S:\200016_QUALITAETSMANAGEMENT\MESSRAUM_TECHNET\03_SCRIPTS\ALLGEMEIN\POLAREXTREMPUNKTE.BAS
            FUNKTION/Main,EINBLENDEN=JA,ARG1="SCN_1138_1",ARG2="SCN_SCRIPT_1",ARG3=36,,
            STARTSKRIPT/
            ENDESKRIPT/
            ZUWEISEN/V_ANZAHL=SCN_SCRIPT_1.NUMHITS
$$ NEIN,
            --- Here we just calculate circle
            --- so if form or runout is needed, use this circle
KR_1138_LS_1=ELEMENT/KREIS,KARTESISCH,AUSSEN,KLEINSTE_QUAD,JA
            NENN/<0,0,0>,<0,0,1>,11.38
            MESS/<-3349.186,11894.195,3.628>,<0,0,1>,24702.455
            KONST/KREIS,BE,2D,SCN_SCRIPT_1,,
            AUSREISSER_ENTFERNEN/AUS,3
            FILTER/AUS,WPU=0
            ZUWEISEN/NULL=0
            ZUWEISEN/EINS=1
KR_1038_LS_1=BENUTZERDEFINIERT/KREIS,ABHÄNGIG,KARTESISCH,AUSSEN,$
            NENNW/XYZ,<NULL,NULL,NULL>,$
            MESS/XYZ,<NULL,NULL,NULL>,$
            NENNW/IJK,<NULL,NULL,EINS>,$
            MESS/IJK,<NULL,NULL,EINS>,$
            RADIUS/(KR_1138_LS_1.D.THEO/2)-(V_TIP_DIAM/2),(KR_1138_LS_1.D.MEAS/2)-(V_TIP_DIAM/2)

Attached Files
Parents
  • For index = 1 To totalPts
                        Set Mypoint = Fcmd.GetHit(index, FHITDATA_CENTROID, FDATA_MEAS, FDATA_PART, "", PLANE_TOP)
                        If NOT Mypoint is Nothing then
                           MyPts(index+Offset).X=Mypoint.x
                           MyPts(index+Offset).Y=Mypoint.Y
                           MyPts(index+Offset).Z=Mypoint.Z
                           MyPts(index+Offset).PR=sqr(myPoint.x^2+myPoint.y^2)
                           MyPts(index+Offset).PA=CalcAngle(myPoint.x,myPoint.y)
                       End if
                Next index


    totalPts & Fcmd.NumHits would be the same value as long as only 1 scan is being passed into the script (looking at the PRG only 1 is being passed).
    If multiple scans were being passed the For loop should use Fcmd.NumHits (nunber of hits for that command).
    The Nothing is making sure a Mypoint was assigned a value from the Fcmd.GetHit method.
Reply
  • For index = 1 To totalPts
                        Set Mypoint = Fcmd.GetHit(index, FHITDATA_CENTROID, FDATA_MEAS, FDATA_PART, "", PLANE_TOP)
                        If NOT Mypoint is Nothing then
                           MyPts(index+Offset).X=Mypoint.x
                           MyPts(index+Offset).Y=Mypoint.Y
                           MyPts(index+Offset).Z=Mypoint.Z
                           MyPts(index+Offset).PR=sqr(myPoint.x^2+myPoint.y^2)
                           MyPts(index+Offset).PA=CalcAngle(myPoint.x,myPoint.y)
                       End if
                Next index


    totalPts & Fcmd.NumHits would be the same value as long as only 1 scan is being passed into the script (looking at the PRG only 1 is being passed).
    If multiple scans were being passed the For loop should use Fcmd.NumHits (nunber of hits for that command).
    The Nothing is making sure a Mypoint was assigned a value from the Fcmd.GetHit method.
Children
No Data