Creating a rectangle
This sample shows how to run a job to open an existing drawing, add a rectagle with and save as the 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
(setq OUTPUTDWG "OutputFilePath")
(command "RECTANGLE" "3C" "0,0" "MYPOINT" "10,10")
(command "SAVEAS" "R32" OUTPUTDWG "Y")
(command "EXIT" "YES")
Line by line:
(setq OUTPUTDWG "OUTPUTFILENAME")
- This line set value to an internal variable receiving the file path.
OUTPUTFILENAME
- Is the placeholder that receives the value from the Configuration file.
OUTPUTDWG
- Is just a internal variable from the script receiving the filepath. OUTPUTFILENAME
could be used directly into SAVEAS command line.
(command "RECTANGLE" "3C" "0,0" "MYPOINT" "10,10")
- This line create a 3 point rectangle
POINT2
- is the placeholder that that receives the value from the Configuration file.
(command "SAVEAS" "R32" OUTPUTDWG "Y")
- This line saves as the file in the given path on OUTPUTDWG
variable.(command "EXIT" "YES")
- This line closes ARES Commander instance.
Environment package
For this sample, the environment package only requires the script.
As convention, we place the script on Script folder on the root of the compacted (.zip) folder.
Configuration file
{
"Inputs": {
"inputfileformat": "dwg",
"script": {
"scriptpath": "Script/CLIrectangle.scr",
"scriptformat": "scr",
"scriptvariables": [{
"name": "OutputFilePath",
"value": "output/MyFile.dwg"
}, {
"name": "MYPOINT",
"value": "0,0.10"
}]
}
},
"Outputs": {
"outputfileformat": "dwg",
"outputfilename": "output/MyFile.dwg"
}
}
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 value for one of the point for the rectangle creation
Inputs
Default parameters:
"scriptpath": "Script/CLIrectangle.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: