10.000 circle measurement reporting

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

  • 10.000 circle measurement reporting

    Hi All,

    I have a measurement with 10.000 auto circles. It takes ages to generate a measurement report with csv or txt for all the TP and roundness. Anyone a better idea to program this? With auto circles I can generate all the circles, so that is not the problem..

    Cheers!

  • #2
    You could write out the results to your .csv file using file I/O commands as you go maybe? Sequence would be something like this...
    1. Open file for output
    2. Measure auto-circle
    3. Report TP
    4. Report circularity
    5. Write values to file
    6. Measure next auto circle
    7. ...
    8. Repeat as necessary
    9. ...
    10. Close file
    That way you could set the output to NONE for all of your dimensions and you shouldn't have to wait for a report to generate - which I assume is what is taking the time. Even if you choose to still create a report, you won't have to wait for your csv file as it will be ready as soon as PC-Dmis hits the FILE/CLOSE command.
    Neil Challinor
    PC-DMIS Product Owner

    T: +44 870 446 2667 (Hexagon UK office)
    E: [email protected]

    Comment


    • NinjaBadger
      NinjaBadger commented
      Editing a comment
      Time consuming / labor intensive for 10,000 dimensions however.

      Basic scripts to a .csv file execute extremely quickly. Your idea of setting the dimension to 'None' is a good idea however.

      I have a script somewhere where I incorporated the ability to perform different options depending on the output setting.

      I'll have a look for it.

    • MihaelR
      MihaelR commented
      Editing a comment
      The output to csv by basic would be nice. Making all the write lines would take much time I am afraid

  • #3
    Originally posted by MihaelR View Post
    Hi All,

    I have a measurement with 10.000 auto circles. It takes ages to generate a measurement report with csv or txt for all the TP and roundness. Anyone a better idea to program this? With auto circles I can generate all the circles, so that is not the problem..

    Cheers!
    Is this for Legacy or ExactMeasure/FCF type dimensions?
    Applications Engineer
    Hexagon UK

    Comment


    • #4
      Xactmeasure is the one I need

      Comment


      • #5
        Ah the script I have one deals with legacy. I may add in Xact at some point but not right now.
        Applications Engineer
        Hexagon UK

        Comment


        • #6
          Could you share the script with legacy? I'll do it with legacy then as I don't have other solutions

          Comment


          • #7
            NinjaBadger do you still have that script?

            Comment


            • #8
              Just dug this up from the archives!

              Save it in a text document with a .bas extension.


              Code:
              Sub main()
              
              
              '================== SETTINGS=======================
              
              
              
              '===== SAVE SETTINGS
              
              'Save format - Data will be saved in a delimited text format (i.e. ".CSV", ".DAT", ".XYZ")
              'Note - you can specify the delimiter for a text file format below (.csv will open eaisly into Excel)
              Dim saveFormat
              saveFormat = ".csv"
              
              'Specify the delimiter For Text reports
              Dim delim
              delim = ","
              
              'Save Location - This is the root directory For reports - reports will be saved In Sub-folders based On program Name
              Dim savePath
              savePath = "C:\CMM Files\CSV_Files"
              
              
              
              '===== Report Name Settings (File Name will be generate In this order ProgName_UID_DateTime depending On settings)
              'At Least ONE of the items below MUST be Set To True
              
              'This will use the Pc-Dmis file Name (without the .prg extension)
              Dim useProgName
              useProgName = True
              
              'This will use the assignment specified below in the file name
              Dim useUID
              useUID = True
              
              'This will be In the following format YYYYMMDDHHMMSS i.e. 20140828113912 (which equates To 11:39:12 On 28 Aug 2014)
              Dim useDateTime
              useDateTime = True
              
              
              '===== DIMENSION Output SETTINGS (Open Script In NOTEPAD With Courier New font To display table correctly)
              
              'Output Mode (Stats=0/Report=1/Both=2/All=3)
              
              '                           _____________Script Setting___________
              '                          | Stats  |  Report  |  Both   |  All  |
              '                   Stats  |    x   |          |    x    |   x   |
              'PC-Dmis Setting    Report |        |     x    |    x    |   x   |
              '                   Both   |    x   |     x    |    x    |   x   |
              '                    None   |        |          |         |   x   |
              
              Dim myOutputMode
              myOutputMode = 2
              
              
              'Outtol Only
              Dim outTolOnly
              outTolOnly = False
              
              
              'Dimensions With Tols only (i.e Don't Output Position Axis)
              Dim dimWithTolOnly
              dimWithTolOnly = False
              
              
              'Either Print '0' Or blank "" For untollerenced True position axis dimensions
              Dim useBlanks
              useBlanks = True
              
              
              
              'Unique ID - specify an PC-Dmis ASSIGNMENT Name which will contain a Unique Identifier
              'This could be a serial number Or combination of part/date/time etc
              'This will appear In the file And can be used In the file Name (see above)
              'If left blank/empty i.e. "" only date time will be recorded In the file
              Dim myUID
              myUID = "SERNUM"
              
              
              '=================End OF SETTINGS==================
              
              
              
              'Declare objects
              
              Dim pcapp As Object
              Set pcapp = createobject("pcdlrn.application")
              Dim pcpart As Object
              Set pcpart = pcapp.activepartprogram
              
              
              
              Dim cmds As Object
              Dim cmd As Object
              
              Set cmds = pcpart.commands
              
              
              Dim sAxis
              Dim sFeatRef
              Dim sUnits
              Dim dNom
              Dim dMeas
              Dim dPlus
              Dim dMinus
              Dim dDev
              Dim dOutTol
              Dim dBonus
              Dim dMax
              Dim dMin
              
              
              
              
              
              
              '======== COLLECT DIMENSIONS To ARRAY
              
              Dim dimcom As Object
              
              'This flag will ultimately be Set depending On combination of PC-Dmis setting And Script Setting
              Dim outputFlag
              outputFlag = False
              
              'This value represents the PC-Dmis setting
              Dim dimOutPut
              dimOutPut = 0
              
              Dim skipCom
              skipCom = True
              
              Dim UIDExists
              UIDExists = False
              
              Dim arrDims() As String
              ReDim arrDims(0)
              Dim repcount
              repcount = 0
              
              For Each cmd In cmds
              
              'Dim dimcom As Object
              
              If cmd.isflowcontrol Then
                  If cmd.typedescription = "Assignment" Then
                      
                      If cmd.flowcontrolcommand.getleftsideofexpression() = myUID Then
                          UIDExists = True
                          
                      End If
                  End If
              End If
              
              
              
              If cmd.isdimension Then
              
              Set dimcom = cmd.dimensioncommand
              
              'Check If Output required (stats/both/report etc) And Set flag accordingly
              If dimcom.id <> "" Then
              dimOutPut = dimcom.outputMode
              
              '(Stats=0/Report=1/Both=2/None=3)
                  Select Case dimOutPut
                      Case 0
                          Select Case myOutputMode
                              Case 0
                              outputFlag = True
                              Case 1
                              outputFlag = False
                              Case 2
                              outputFlag = True
                              Case 3
                              outputFlag = True
                          End Select
                          
                      Case 1
                          Select Case myOutputMode
                              Case 0
                              outputFlag = False
                              Case 1
                              outputFlag = True
                              Case 2
                              outputFlag = True
                              Case 3
                              outputFlag = True
                          End Select
              
                      Case 2
                          Select Case myOutputMode
                              Case 0
                              outputFlag = True
                              Case 1
                              outputFlag = True
                              Case 2
                              outputFlag = True
                              Case 3
                              outputFlag = True
                          End Select
              
                      Case 3
                          Select Case myOutputMode
                              Case 0
                              outputFlag = False
                              Case 1
                              outputFlag = False
                              Case 2
                              outputFlag = False
                              Case 3
                              outputFlag = True
                          End Select
                  End Select
              
              End If 'End Output mode
              
              'Identify DIMENSION Type (Location / Position / Other)
              
              If dimcom.id <> "" Then 'Not a LOC Or POS Axis
              
                  cmdID = cmd.id 'store the current Dim ID
                  
                  sFeatRef = GenerateFeatureRef(cmd)
                  
                  If dimcom.units = 0 Then
                      sUnits = "Inch"
                  Else
                      sUnits = "mm"
                  End If
                  
                  If dimcom.axisletter <> "" Then
                      skipCom=False
                  Else
                      If instr(1,dimcom.parent.typedescription,"Position",1) Then
                          skipCom=True
                      Else
                          skipCom=True
                      End If
                  End If
              Else
                  skipCom=False
              End If
              
              'Check For other conditions (OutTolOnly And dimWithTolOnly)
              
              If outputFlag = True Then 'required
                  If skipCom = False Then 'Not a Dim header
                      
                          If outTolOnly = True Then
                          'MsgBox(cdbl(format(dimcom.outtol,"0.000000")))
                              If cdbl(format(dimcom.outtol,"0.000000")) = 0 Then
                                  skipCom=True
                                  Else
                                  skipCom = False
                                  MsgBox("out tol")
                              End If
                          End If
                          
                          If dimWithTolOnly = True And dimcom.istrueposaxis Then
                              If cdbl(format(dimcom.plus,"0.000000")) = 0 And cdbl(format(dimcom.minus,"0.000000")) = 0 Then
                                  skipCom=True
                              End If
                          End If
                      
                      
                  
                  End If 'dimtype = skip
              End If ' Output flag
              
              'MsgBox(dimcom.parent.typedescription & "__OF=" & outPutFlag & "__DimType= " & dimtype)
              
              
              If outputFlag = True Then 'required
                  If skipCom=False Then'Not a Dim header Or excluded because outtol Or Pos Axis
                  sAxis = dimcom.axisletter
                  
                  'sUnits = "units"
                  dNom = format(dimcom.nominal,"0.000000")
                  dMeas = format(dimcom.measured,"0.000000")
                  
                  'This deals With printing either '0' Or blanks "" For True Pos Axis
                  If useBlanks = True And cdbl(format(dimcom.plus,"0.000000"))=0 And cdbl(format(dimcom.minus,"0.000000"))=0  Then
                  dplus = ""
                  dMinus = ""
                  Else
                  dPlus = format(dimcom.plus,"0.000000")
                  dMinus = format(dimcom.minus,"0.000000")
                  End If
              
                  dDev = format(dimcom.deviation,"0.000000")
                  dOutTol = format(dimcom.outtol,"0.000000")
                  dBonus = format(dimcom.bonus,"0.000000")
                  dMax = format(dimcom.max,"0.000000")
                  dMin = format(dimcom.min,"0.000000")
              
                  ReDim preserve arrDims(repcount)
                  arrDims(repcount) = cmdid & delim & sFeatRef & delim & sAxis & delim & sUnits & delim & dNom & delim & dPlus & delim & dMinus & delim & dMeas & delim & dDev & delim & dOutTol
                  repcount = repcount + 1
              
                  End If 'dimtype = skip
              End If ' Output flag
              
              
              
              End If ' End Dim command
              
              
              
              Next 'Next cmd
              
              
              
              
              
              'Generate file Name based On settings
              
              Dim repType
              
              'Establish If excel Or text report
              If instr(1,ucase(saveFormat),"XLS",1) Then
                  repType = "Excel"
              Else
                  repType = "Text"
              End If
              
              'Get the part prog Name (without the .prg file extension) this may al;so be used As part of the file Name
              Dim repFolder
              repFolder = left(pcpart.Name,len(pcpart.Name)-4)
              
              'Create header array - this will be written To the file first before the dimensions array
              Dim arrHeader() As String
              ReDim arrHeader(6)
              
              arrHeader(0) = repFolder
              arrHeader(1) = ""
              arrHeader(2) = format(now(),"dd/mm/yyyy - hh:nn:ss")
              
              'Get the Unique ID (If it exists/is required)
              If UIDExists = True Then
                  Dim myvar As Object
                  Set myvar = pcpart.GetVariableValue(myUID)
                  UIDVal = myvar.stringvalue
                  arrHeader(3) = UIDVal
              Else
                  arrHeader(3) = ""
              End If
              
              arrHeader(4) = ""
              arrHeader(5) = ""
              arrHeader(6) = "Dim Id" & delim & "Feat Ref" & delim & "Axis" & delim & "Units" & delim & "Nominal" & delim & "Plus Tol" & delim & "Minus Tol" & delim & "Measured" & delim & "Deviation" & delim & "Out Tol"
              
              Dim repName
              
              If useProgName Then
                  repName = repFolder
              End If
              
              If useUID Then
                   If repname = "" Then
                   repName = UIDVal
                   Else
                   repName = repName & "_" & UIDVal
                   End If
              End If
              
              If useDateTime Then
                   If repname = "" Then
                   repName = format(now(),"YYYYMMDDHHNNSS")
                   Else
                   repName = repName & "_" & format(now(),"YYYYMMDDHHNNSS")
                   End If
              End If
              
              Dim fullRepPath
              
              fullRepPath = savepath & "\" & repFolder
              Dim fso As objects
              Set fso = createobject("scripting.filesystemobject")
              If Not fso.folderexists(fullRepPath) Then
                  Dim ofolder
                  Set ofolder = fso.createfolder(fullRepPath)
              End If
              
              fullRepPath = savepath & "\" & repFolder & "\" & repName & saveFormat
              
              
              
              'Generate the report
              
              If repType = "Text" Then
                  createTextFile(fullRepPath,arrDims,arrHeader)
              Else
                  createExcelFile()
              End If
              
              
              
              End Sub
              
              
              
              Sub createTextFile(ByVal fullname As String, ByRef arrDims() As String, ByRef arrHeader() As String)
              
              
              'Given a valid path And an array this creates a text file report
              
              If Not ubound(arrDims) < 0 Then
                  Open fullname For Output As #1
                  For i = 0 To ubound(arrHeader)
                      Print #1, arrHeader(i)
                  Next i
                  For i = 0 To ubound(arrDims)
                      Print #1, arrDims(i)
                  Next i
                  Close #1
              End If
              
              
              
              End Sub
              
              
              '_____________________________________________________________________________________
              
              Function GenerateFeatureRef(ByVal cmd As Object) As String
              
              If cmd.isdimension Then
                tmpID = cmd.dimensioncommand.feat1
              
                If cmd.dimensioncommand.feat2 <> "" Then
                  tmpID = tmpId & " - " & cmd.dimensioncommand.feat2
                End If
                If cmd.dimensioncommand.feat3 <> "" Then
                  tmpID = tmpId & "/"  & cmd.dimensioncommand.feat3
                End If
                GenerateFeatureRef= tmpID
              Else
                GenerateFeatureRef= ""
              
              End If
              
              End Function
              
              '_____________________________________________________________________________________
              Applications Engineer
              Hexagon UK

              Comment


              • MihaelR
                MihaelR commented
                Editing a comment
                Thanks! So we need to dimension the circles in order to get the output right? It worked for me, however, is there a way to output the circles XYZD without dimensioning? The reason is that pcdmis tends to go slower if you have more elements in your routine. It is not 10k holes, but I have already 40k holes what needs to be measured..

            • #9
              are you measuring them and then dimensioning? If you dimension each after measuring you will allowing pcdmis to output while the machine is moving to the next location.
              If dimensioning all at the end the cmm will just sit there waiting.
              Just a thought.

              Comment


              • #10
                What kind of part is this with 10.000 holes?
                PC-DMIS CAD++ 2o22.1 SP4

                Comment


                • MihaelR
                  MihaelR commented
                  Editing a comment
                  It is a round disc and all the circles are in the same pattern in kind of pcd's. I have the xyz coordinates and I import them in pcdmis with import-csv. Due to the big amount of circles I need to split them in segments of 5k circles.

              Related Topics

              Collapse

              Working...
              X