Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This sample shows how to run a job to open an existing drawing, attach an image and saves the drawing as PDF. In this case the output file is a PDF mapped on the configuration file.
Also a position of the rectangle will be passed as a parameter to the script by adding a variable to the configuration file.

Script

Code Block
(command "_-IMAGE" "_ATTACH" "SOURCEIMG" (list 0.0 0.0 0.0) 1.0 0.0)
(command "_-PRINT" "_NO" "Model" "" "PDF" "OUTPUTPDF" "_NO" "_YES")
(command "EXIT" "YES")

...

(command "EXIT" "YES") - This line closes ARES Commander instance.

 

Environment package

For this sample, the environment package requires the script and the image to be attached.

As convention, we place the script on Script folder on the root of the compacted (.zip) folder.

...

Configuration file

Code Block
{
  "Inputs": {
    "inputfileformat": "dwg",
      "script": {
        "scriptpath": "scripts/PrintPDF.scr",
        "scriptformat": "scr",
        "scriptvariables": [{
            "name": "OUTPUTPDF",
            "value": "output/MyFile.pdf"
        }, {
            "name": "SOURCEIMG",
            "value": "images/Graebert.png"
        }]
    }
  },
  "Outputs": {
    "outputfileformat": "pdf",
    "outputfilename": "output/MyFile.pdf"
  }
}

The configuration file maps the file locations and variables to be used on the Script.
For this sample we are providing the output file path, location where the file will be saved, and the location of the image to be attached.

Inputs

Default parameters:

Code Block
"scriptpath": "scripts/PrintPDF.scr",
"scriptformat": "scr",

...

Code Block
{
  "name": "SOURCEIMG",
  "value": "images/Graebert.png"
}

Outputs

On output session the output files are declared so the server can locate it and place on the download link in the Job result page.

...