NUMBEROUTTOL seems to not be working as it should

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NUMBEROUTTOL seems to not be working as it should

    It seems as though I am unable to see any numeric value actually assigned to NUMBEROUTTOL in my program. When a value is assigned to NUMBEROUTTOL, it is actually reading the previous program run instead of the current program. My program is set to update report during execution.

    The script I have has the note below at the beginning of it, I wonder if the original script would work better, would anyone have it available?

    Code:
    Sub Main()
    
    'this *.bas is a simple, modified version of the outtol.bas whose author I do not know
    'if any one knows the author credit them here
    '
    'craig
    
    Dim objApp As Object
    Set objApp = CreateObject("PCDLRN.Application")
    Dim objPart As Object
    Set objPart = objApp.ActivePartProgram
    Dim objCmds As Object
    Set objCmds = objPart.Commands
    Dim objCmd As Object
    Dim objDimCmd As Object
    Dim lngOutTol As Long
    lngOutTol = 0
    Dim lngTotalMeas As Long
    lngTotalMeas = 0
    Dim objOutTol As Object
    Set objOutTol = objPart.GetVariableValue("NUMBEROUTTOL")
    Dim objTotalMeas As Object
    Set objtTotalMeas = objPart.GetVariableValue("TOTALMEASURED")
    
    
    For Each objCmd In objCmds
        If objCmd.IsDimension Then
            If objCmd.Type <> DIMENSION_START_LOCATION And _
            objCmd.Type <> DIMENSION_END_LOCATION And _
            objCmd.Type <> DIMENSION_TRUE_START_POSITION And _
            objCmd.Type <> DIMENSION_TRUE_END_POSITION Then
            Set objDimCmd = objCmd.DimensionCommand
                If objDimCmd.OutTol > 0 Then
                lngOutTol = lngOutTol + 1
                End If
            lngTotalMeas = lngTotalMeas + 1
            End If
        End If
    Next objCmd
    
    objOutTol.LongValue = lngOutTol
    objtTotalMeas.LongValue = lngTotalMeas
    objPart.SetVariableValue "NUMBEROUTTOL", objOutTol
    objPart.SetVariableValue "TOTALMEASURED", objtTotalMeas
    
    End Sub
    Mnfctr: Hexagon,
    Model: Global B Perf,
    Hardware: Control FBII,
    Software: PcDmis CAD 2010MR3
    PH10MQ, TP20, Leitz equipped

  • #2
    Maybe it depends on the moment when you execute this script in your programm ?

    Comment


    • #3
      Another programmer modified this for me. This needs to be at the end of your program and needs to used with code that I have at the end of the start template I have here. I use to set up print options for our CMM operators (lathe, mill, EDM operators). The VB file and the start template are there.
      Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
      Contura Calypso 5.4

      Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

      Comment


      • #4
        Originally posted by JEFMAN View Post
        Maybe it depends on the moment when you execute this script in your programm ?
        Yes it does now seem to, but it didn't previously and was updating.

        I am using it as such:

        Features

        measure critical dimensions

        run outtol script (was checking whole program)

        save critical dimensions (adding errors to file name is there are any)

        measure non critical dimensions

        save non critical dimensions (adding errors to file name is there are any)
        Mnfctr: Hexagon,
        Model: Global B Perf,
        Hardware: Control FBII,
        Software: PcDmis CAD 2010MR3
        PH10MQ, TP20, Leitz equipped

        Comment


        • #5
          Duane,

          I don't see any code in your template program that actually needs to be there in order for the outtol script to work, am I missing something? It all seems to be about recording time, works orders, operators, operator instructions.

          Ps) I have added near the begginning of the program 'Assign\Numberouttol = 0 ' so that DMIS knows the variable exists before it is used by the program.

          Code:
          PART NAME  : start metric
          REV NUMBER : 
          SER NUMBER : 
          STATS COUNT : 1
           
          STARTUP    =ALIGNMENT/START,RECALL:,LIST=YES
                      ALIGNMENT/END
          $$ NO,
                      Time tracking beginning of program
                      ASSIGN/TM2=SYSTEMTIME("HH':'mm':'ss")
                      ASSIGN/S2=RIGHT(TM2,2)
                      ASSIGN/M2=MID(TM2,3,2)
                      ASSIGN/H2=LEFT(TM2,2)
                      ASSIGN/H2S_B=(H2)*3600
                      ASSIGN/M2S_B=(M2)*60
                      ASSIGN/TO_SC_2=(H2S_B)+(M2S_B)+(S2)
          WORKORDER  =COMMENT/INPUT,NO,FULL SCREEN=NO,
                      '
                      Enter the work order number. Enter the 
                      number using a period instead of a slash.
                      
                      '
                      ASSIGN/PART=STR(GETTEXT(191,1,{FILEHEDR}))
                      ASSIGN/DATE=SYSTEMDATE ("MMddyyyy")
                      ASSIGN/TIME=SYSTEMTIME ("HHmmss")
                      ASSIGN/FILESTORE="U:\CMM_reports\customerfoldername\_"
                      ASSIGN/FILENAME=WORKORDER.INPUT + "_" + PART + "_" + DATE + "_" + TIME + ".RTF"
                      ASSIGN/VAL_FILE=FILESTORE + FILENAME
          CLOCKNUMBER =COMMENT/INPUT,YES,FULL SCREEN=NO,
                      'Employee clock number'
                      COMMENT/REPT,
                      WORKORDER.INPUT
                      
                      MODE/MANUAL
                      LOADPROBE/TIP5
                      TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
                      FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;MEAS,NOM,TOL,DEV,OUTTOL, , 
                      MOVESPEED/ 60
                      TOUCHSPEED/ 2
                      PREHIT/2
                      RETRACT/2
                      COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                      
                      
                      Instructions here
                      
                      
                      
          COMMENT1   =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                      Do you want to see the set up picture?
                      IF/COMMENT1.INPUT == "NO"
                      GOTO/SKIP_PIC
                      END_IF/
           
          SKIP_PIC   =LABEL/
                      COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                      
                      
                      
                      Program code here
                      
                      
                      COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                      
                      
                      Please Review the results before the print 
                      options are querried
                      
                      
          RESTART1   =LABEL/
          C2         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                      'ENTER CORRECT NUMBER TO PRINT TO YOUR CHOICE
                      
                      TO PRINTER ONLY = 1
                      TO FILE ONLY= 2
                      NO PRINT = 3
                      '
                      IF/C2.INPUT<>1 AND C2.INPUT <>2 AND C2.INPUT <>3
                      COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                         INPUT NOT VALID!!
                      GOTO/RESTART1
                      END_IF/
                      IF/C2.INPUT == 1
                      GOTO/PRINTONLY
                      END_IF/
                      IF/C2.INPUT == 2
                      GOTO/FILEONLY
                      END_IF/
                      IF/C2.INPUT == 3
                      GOTO/NOPRINT
          PRINTONLY  =LABEL/
                      IF/C2.INPUT == 1
          PRINTME    =LABEL/
                      PRINT/REPORT,EXEC MODE=END,$
                        TO_FILE=OFF,AUTO=1,$
                        TO_PRINTER=ON,$
                        TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                        REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                        PREVIOUS_RUNS=KEEP_INSTANCES
                      GOTO/ENDLINE
                      END_IF/
          FILEONLY   =LABEL/
                      IF/C2.INPUT == 2
          CS2        =SCRIPT/FILENAME= F:\USERS\CMMUSER\CMM_PROGRAMS(PCDMIS)\OUTTOL.BAS
                      FUNCTION/Main,SHOW=YES,,
                      STARTSCRIPT/
                      ENDSCRIPT/
                      IF/NUMBEROUTTOL > .1
                      GOTO/PRINTME
                      END_IF/
                      PRINT/REPORT,EXEC MODE=END,$
                        TO_FILE=ON,OVERWRITE=VAL_FILE,$
                        TO_PRINTER=OFF,$
                        TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                        REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                        PREVIOUS_RUNS=DELETE_INSTANCES
                      GOTO/ENDLINE
                      END_IF/
          NOPRINT    =LABEL/
                      GOTO/ENDLINE
                      END_IF/
          ENDLINE    =LABEL/
          $$ NO,
                      Time tracking end of program
                      ASSIGN/TM1=SYSTEMTIME("HH':'mm':'ss")
                      ASSIGN/S1=RIGHT(TM1,2)
                      ASSIGN/M1=MID(TM1,3,2)
                      ASSIGN/H1=LEFT(TM1,2)
                      ASSIGN/H2S_A=(H1)*3600
                      ASSIGN/M2S_A=(M1)*60
                      ASSIGN/TO_SC_1=(H2S_A)+(M2S_A)+(S1)
                      ASSIGN/EL_SEC=(TO_SC_1)-(TO_SC_2)
                      ASSIGN/EL_MIN=(EL_SEC)/60
          FPTR       =FILE/OPEN,C:\DATA\TIME.TXT,APPEND
                      FILE/WRITE_BLOCK,FPTR,EL_MIN
                      FILE/WRITELINE,FPTR," "
                      FILE/CLOSE,FPTR,KEEP
                      LOADPROBE/TIP5
          Mnfctr: Hexagon,
          Model: Global B Perf,
          Hardware: Control FBII,
          Software: PcDmis CAD 2010MR3
          PH10MQ, TP20, Leitz equipped

          Comment

          Related Topics

          Collapse

          Working...
          X