AutoXchange 2020 Technical Documentation

JSON Setting Variables

Setting Variables

AutoXChange will work with variables added by the user in their DWG, DXF or DGN files. Variables can start and end with either three dollar signs or three percent signs - $$$ or %%%, so “%%%variable%%%".

There are no corresponding normal parameters to this section. Variables can only be set via the JSON file.

AutoXChange will replace the variable name in the file with the text defined in the JSON parameters, with the exception of four special variables:

Variable    Defined Value
dwgspec    Name of the DWG or DXF File
dgnspec Name of the DGN File
sysdate Current date
systime Current date and time

Note: The DWG, DXF or DGN file names will be just the drawing name with no path but with an extension.

The variables can be three parameters: the text value, a text prefix and a font size. The default for the Font Size is whatever was used in the original text string. It is not recommended that this be changed in normal usage. If the prefix is defined it will be output immediately before the value and will be output in its entirety exactly as defined. So, if you want a semi-colon, for instance, after the prefix, add a semi-colon to the end of the prefix.

The variables dwgspec, dwfspec, and dgnspec will output the name of the input file with no file path (but including the file extension). The default prefix for this variable is “This drawing is originated from drawing “. If you want no prefix for these file-dependent variables then you need to define a blank string for the prefix (“prefix”: “").

The system variables sysdate and systime use the time format defined for the strftime function. This is detailed in strftime. The default time specification for systime is “%d-%b-%Y %H:%M:%S”. The default date specification for sysdate is “%d-%b-%Y”. To change the format just set the “Value” to the new time and date specification (“value”: “%Y-%m-%d %r” would give something like “2020-05-17 02:56:02 pm”).

Multiple line values may be defined using /P for the new line character.

The sample below sets the contents of various variables:

[
  {
    "Variables": {
      "title": {
	      "value": "This is the title/PIt has four lines/PThree/PFour"
	  },
      "noprefix": {
	      "value": "The Data goes here"
	  },
      "prefix": {
	      "prefix": "The Prefix: ",
	      "value": "The Data"
	  },
      "username": {
	      "value": "AX2020 Documentation"
	  },
      "sample": {
	      "value": "This is a sample"
	  },
      "dwgspec": {
	      "prefix": "Drawing: "
	  }
	}
  }
]

This results in the following variable substitutions: Variable Substitutions

Last updated on 17 May 2020
Published on 17 May 2020