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 exports with Pack and GO to bundle the drawing together with its related files. In this case the output file is a ZIP mapped on the configuration file.

Script

Code Block
(command "_-IMAGE" "_ATTACH" "SOURCEIMG" (list 0.0 0.0 0.0) 1.0 0.0)
(command "SAVE")
(command "PACKANDGO" "C" "OUTPUTZIP")
(command "EXIT" "YES")

Line by line:

(command "_-IMAGE" "_ATTACH" "SOURCEIMG" (list 0.0 0.0 0.0) 1.0 0.0) - This line fires the command IMAGE adding the image from SOURCEIMG.

SOURCEIMG - Is the placeholder that receives the image path from the Configuration file.

(command "SAVE") - This line saves the file as requiered by PACKANDGO command.
(command "-PACKANDGO" "C" "OUTPUTZIP") - This line exports the drawing and related files with PACKANDGO command.

OUTPUTZIP- Is the placeholder that receives the location path to save the ZIP file from the Configuration file.

(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/IMGPnG.scr",
        "scriptformat": "scr",
        "scriptvariables": [{
            "name": "OUTPUTZIP",
            "value": "output/MyFile.zip"
        }, {
            "name": "SOURCEIMG",
            "value": "images/Graebert.png"
        }]
    }
  },
  "Outputs": {
    "outputfileformat": "zip",
    "outputfilename": "output/MyFile.zip"
  }
}

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/IMGPnG.scr",
"scriptformat": "scr",

Custom variable

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.

Default parameters:

Code Block
"outputfileformat": "zip",
"outputfilename": "output/MyFile.zip"

Resources:
Environment:

View file
nameImage_PacknGo.zip

Configuration file:
View file
nameIMG_PnG_Config.txt