Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

image-20240503-142242.png

Configuration file

{
  "Inputs": {
    "inputfileformat": "dwg",
      "script": {
        "scriptpath": "Script/Lisp.scr",
        "scriptformat": "scr",
        "scriptvariables": [{
            "name": "OutputFilePath",
            "value": "output/MyFile.dwg"
        }, {
            "name": "MYPOINT",
            "value": "0,0.10"
        }]
    },
    "templates": {
           "drawingtemplate": "templates/drawingtemplates/standardiso_mm.dwt",
           "drawingtemplateformat": "dwt"
    },
    "plugin": {
    	   "pluginfile": "LISPLOAD/Lisp/CLIRectangle.lsp",
    	   "pluginformat": "lsp",
    	   "pluginfolder": "CLIPlugin",
    }
  },
  "Outputs": {
    "outputfileformat": "dwg",
    "outputfilename": "MyFile.dwg"
  }
}

The configuration file maps the file locations and variables to be used on the Script.
The file is divide in Inputs and Outputs sections. this is the way the variables are organized. And it contains default parameters, but also variable could be created.

Inputs

Default parameters:

"scriptpath": "Script/Lisp.scr",
"scriptformat": "scr",

"templates": {
           "drawingtemplate": "templates/drawingtemplates/standardiso_mm.dwt",
           "drawingtemplateformat": "dwt"
    },

"plugin": {
    	   "pluginfile": "LISPLOAD/Lisp/CLIRectangle.lsp",
    	   "pluginformat": "lsp",
    	   "pluginfolder": "CLIPlugin",
    }

Outputs

Default parameters:

"outputfileformat": "dwg",
"outputfilename": "MyFile.dwg"

  • No labels