Tuesday, May 28, 2013

DPLOT Macros Save Time

Most of us have used DPlot at some point or another. Recently, I had a chance to use the extensive macro capabilities. I had FACET3D dump about 100 per building FN curves for a QRA in DPlot GRF format. Now I needed to add the customer criteria intolerable and acceptable curves, format as log-log, locate a legend, and save a PNG for the appendix. Below is what I came up with. The help file give lots of information on the various commands.

DPlot Macro 1.1a
Criteria
Directory(1)'last open
FileType(1) 'grf
ForFilesIn("*.grf")
  FileType(4) 'csv
  FileAppend("S:\_Projects\PATH to QRA\CLIENTCriteria.csv")
  FileType(1) 'grf
  ManualScale(0.9,,,,)
  Size(1,12,8,1)
  FileSaveAs(1,".grf")
  FileSaveAs("Portable Network Graphics",".png")
  FileClose()
NextFile

Directory(1) sets the working directory to the last file open directory. Just open the first file in the folder and close before running the macro.
ManualScale is nice in that you only need to set the bounds you want to explicitly set. I wanted the Xmin to start at 0.9 since all my data started at 1.

There are many more commands than these, but you can see it is possible to quickly format an folder full of DPlot files and dump images ready for the report. No intern required.

No comments:

Post a Comment