macro or script to autorun PCD2Excel

  • Filter
  • Time
  • Show
Clear All
new posts

  • macro or script to autorun PCD2Excel

    Does anyone know how to write a script or macro to auto generate a report at the end of my program?

    I know I can use
    But, I don't want to be able to click on anything. I don't know where to start with writing this Marco or script but if anyone had any tips or pointers that would be helpful or even examples. I can work with that and figure it out. Just need a starting point.

    My objective is to have the machinist start the part and do nothing else and just have the report auto generate at the end of each program. Create an excel sheet with all the information that PCD2Excel would generate. I simply just want to eliminate the process of clicking on the button.

  • #2
    On newer versions of the software (I'm guessing 2015 and later - can't remember when this feature as added) there is an option to output to Excel. That's under File - Printing - Report Window Print Setup. The third tab is titled Excel. I'm pretty sure that uses PCD2Excel to create the output. If not, it is practically the same. That will auto output the report the way you described.

    If you need to get fancier and use variables to assign special file names or paths for each execution, you can insert a print report command at the end of your measuring routine and put variables in those fields as needed.


    • Adam.rgbsi
      Adam.rgbsi commented
      Editing a comment
      Yes, I'm aware of this. I just want to for the report to be automatically generated in an excel report once the program reaches the end. I was told this can be achieved by making a script or macro. But I'm not sure how to go about this since I'm still new to PCDMIS

    • Cris_C
      Cris_C commented
      Editing a comment
      Adam.rgbsi, I'm not quite sure what you are looking for.

      I read: "My objective is to have the machinist start the part and do nothing else and just have the report auto generate at the end of each program. Create an excel sheet with all the information that PCD2Excel would generate. I simply just want to eliminate the process of clicking on the button."

      Using the built in Excel Report output will do that. If you select either the 'Append' or the 'Auto' output option, the software will automatically output a report to an excel document after each execution without the operator needing to click or typing anything. 'Append' will keep adding the data to one long excel file. 'Auto' will create a new Excel file for each part appended with a sequence number. There is also a 'Prompt' option if you want a Save-as window to open up, but I'm guessing that is more operator interaction than you want.

      If you want to automatically change the file name or file location for each report, that is where you can use variables in your measuring routine and use a print report command. You can probably even find examples in this forum of people doing that inside a loop.

      You may also consider going to Insert - Report Command - Excel Form Report. That lets you create custom excel reports. However, I haven't found a lot of documentation on how to use it.

      It is true that you can do this with custom scripts but getting the measurement data from each type of report command can be a lengthy ordeal, especially if your measuring routine uses a lot of XactMeasure or GeoTol report commands. And you may need to update this script in the future if new features are added to the software. I think a few people here had a hard time upgrading from 2020R1 to a later version because the new GeoTol commands were not compatible with their custom scripts. If you really want to get into that the folks here can help you, but you may want to consider simpler options first.

  • #3
    So... you want to add this line to each of your programs, but don't want to do it manually?
    PC-DMIS CAD++ 2o22.2 SP2


    • Adam.rgbsi
      Adam.rgbsi commented
      Editing a comment
      So my boss made it seem like it was way more complicated than it really was. Cris_C mentioned above what is needed and it was what my boss wanted. I'm still new to Pc-Dmis so I wasn't aware that it was this simple.

  • #4
    Bit late to the thread, but if you were on an older version and had to use the PCD2XL wizard, then you could use the path above but simply add a flag on the end

    ...PC-DMIS 2018 R2 64-BIT\EN\PCD2EXCEL.EXE /A
    Applications Engineer
    Hexagon UK


    • #5

      we use a script instead of the built-in pcdmis facilities to generate an excel report (it is doable).

      I can't give you this script because there are too many company-specific adjustments in there and above all that the script has 1700 lines (very extensive, not for beginners)

      long story, little gain:
      it's not really any better than the normal excel report, you can just set a few captions and move the measured values in the excel file.
      Lots of effort and maintenance time (which the boss probably won't give you), for little extra benefit.
      Even if you create something like that, you're probably the only one who can maintain it and it's always your fault if it doesn't work.

      I can therefore only advise you against it
      on the other hand, learning a programming language doesn't make you dumber, even if it's just 'basic'.

      (if you really want to do that
      1.) look up how to create an excel file with basic, visual basic or a 'macro' and write data into a cell (excel helpfile mostly).
      2.) look up how to extract pcDMIS data from a feature or dimmension, you can find everything for this in the pcDMIS help file
      many examples of this online too)‚Äč


      • Adam.rgbsi
        Adam.rgbsi commented
        Editing a comment
        Oh wow I wasn't expecting this. Thank you for pointing me towards where I should start on learning a programming language as this will only help me grow.

    • #6
      Just a note that PCD2Excel.exe is being phased out. The report output excel (and newer FORM output) are updated with the newer dimension types while PCD2Excel is not updated to support them (SIZE, GEOMETRIC TOLERANCE).


      Related Topics