/
Pack and Go

Pack and Go

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

(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.

image-20240509-161834.png

Configuration file

{ "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:

"scriptpath": "scripts/IMGPnG.scr", "scriptformat": "scr",

Custom variable

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:

Resources:
Environment:
Configuration file:

Related pages