Variables (Advanced Text Capabilities) |
www.CAD6.com |
Malz++Kassner CAD6 supports "variables" which are values globally defined for the current drawing. They consist of a name and a plain text value. The value may contain references to other variables and Attributes, as well as Statements.
BasicsA variable has to be enclosed in tilde characters ~ (Ansi 126) to be evaluated in texts or statements respectively, e.g. ~Variable~. The text Price: ~Price~ Euro
contains a variable named "Price". If the variable "Price" exists it is evaluated, i.e. the string "~Price~" is replaced by the value or the content of the variable "Price". For example, if the variable has the value 29.95 the following text is created: Price: 29.95 Euro
If a text contains a variable that does not exist then this variable cannot be evaluated. In such a case the variable is replaced by the text (***UNDEFINED***). For the example above the resulting text would be: Price: (***UNDEFINED***) Euro
To output the explicit tilde character please use \~.
Custom VariablesDrawings can contain any variables that can be used throughout the drawing. These variables can be defined by means of the Edit > Edit Variables command. Add a colon to the variable's name to access the variable's comment instead of its value.
ExampleCode sequence in the text to access the variable's value: File Version: ~Version~
Possibly displayed text: File Version: 6.2.0
Code sequence in the text to access the variable's comment: Comment: ~Version:~
Possibly displayed text: Comment: Released 2024-01-12
Drawing VariablesFixed drawing variables always exist and are automatically initialized by CAD6. They cannot be changed by the user.
The following fixed drawing variables are available: ~%A0~ or ~%a0~ Name of the author who created the drawing ~%A1~ or ~%a1~ Name of the author who last saved the drawing ~%A2~ or ~%a2~ Name of the author who is just working with the drawing ~%N0~ or ~%n0~ File name of the serial printing database (including path) ~%N1~ or ~%n1~ Title of the serial printing database ~%N2~ or ~%n2~ Number of data records for serial printing ~%N3~ or ~%n3~ Current data record for serial printing ~%D0~ or ~%d0~ Creation date of the drawing ~%D1~ or ~%d1~ Last saved date of the drawing ~%D2~ or ~%d2~ Current date ~%D3~ or ~%d3~ Current year (1999, 2000, ..) ~%D4~ or ~%d4~ Current month (01..12) ~%D5~ or ~%d5~ Current day of month (01..31) ~%D6~ or ~%d6~ Current hour (00..23) ~%D7~ or ~%d7~ Current minute (00..59) ~%D8~ or ~%d8~ Current second (00..59) ~%P0~ or ~%p0~ Number of pages ~%P1~ or ~%p1~ Total number of sheets in multiple sheets printing mode ~%P2~ or ~%p2~ Current sheet number in multiple sheets printing mode ~%P3~ or ~%p3~ Page number (this object lies in) ~%P4~ or ~%p4~ Width of the page (this object lies in) in [mm] ~%P5~ or ~%p5~ Height of the page (this object lies in) in [mm] ~%P6~ or ~%p6~ Width of the page (this object lies in) in [inch] ~%P7~ or ~%p7~ Height of the page (this object lies in) in [inch] ~%P8~ or ~%p8~ Comment of the page (this object lies in) ~%S0~ or ~%s0~ Scale of the active coordinate system ~%S1~ or ~%s1~ Output scaling factor (as entered in printing dialog) ~%S2~ or ~%s2~ Output scaling factor (as defined by page scaling) ~%S3~ or ~%s3~ Output rotation angle (as defined by page rotation) in [deg] ~%S4~ or ~%s4~ Length unit of the active coordinate system ~%S5~ or ~%s5~ Line unit of the active coordinate system ~%S6~ or ~%s6~ Angle unit of the active coordinate system ~%V0~ or ~%v0~ First dimension value (in any type of dimension) ~%V1~ or ~%v1~ Second dimension value (only in a coordinate dimension) ~%X0~ or ~%x0~ File size in KB (in memory) ~%X1~ or ~%x1~ Number of objects in the drawing ~%X2~ or ~%x2~ Number of internal blocks in the drawing ~%X3~ or ~%x3~ Number of used external blocks ~%X4~ or ~%x4~ Number of used bitmaps ~%X5~ or ~%x5~ Number of used external references ~%Z0~ or ~%z0~ File name of the drawing (including path) ~%Z1~ or ~%z1~ Title of the drawing ~%Z2~ or ~%z2~ Topic of the drawing ~%Z3~ or ~%z3~ Comment on the drawing ~%Z4~ or ~%z4~ File name of the drawing (without path) ~%Z5~ or ~%z5~ File name of the drawing (without path and extension)
ExampleCode sequence in the text: Page ~%p3~ of ~%p0~
Possibly displayed text: Page 1 of 16
Database RequestsDatabase requests are only available if the user has opened the corresponding database by means of the command Library > Databases and serial printing is active. Each cell of the database is considered to be a (virtual) variable which can be evaluated by means of a database request.
A database request has one of the following forms: ~%[DatabaseName]ColumnNumber,RowNumber~ Gets the content of the cell in column ColumnNumber (starting with 1) and row RowNumber (starting with 1) of the database titled DatabaseName. ~%[DatabaseName]"ColumnName",RowNumber~ Gets the content of the cell in the column titled ColumnName and row RowNumber (starting with 1) of the database titled DatabaseName. ~%[DatabaseName]ColumnNumber,"FindText"@FindColumnNumber~ Gets the content of the cell in column ColumnNumber (starting with 1) and the row that contains the string FindText in column FindColumnNumber (starting with 1). ~%[DatabaseName]ColumnNumber,"FindText"@"FindColumnName"~ Gets the content of the cell in column ColumnNumber (starting with 1) and the row that contains the string FindText in the column titled FindColumnName. ~%[DatabaseName]"ColumnName","FindText"@FindColumnNumber~ Gets the content of the cell in the column titled ColumnName and the row that contains the string FindText in column FindColumnNumber (starting with 1). ~%[DatabaseName]"ColumnName","FindText"@"FindColumnName"~ Gets the content of the cell in the column titled ColumnName and the row that contains the string FindText in the column titled FindColumnName. ~%[DatabaseName]ColumnNumber,(UniqueID)~ Gets the content of the cell in column ColumnNumber (starting with 1) from the row containing the ID UniqueID of the database titled DatabaseName. ~%[DatabaseName]"ColumnName",(UniqueID)~ Gets the content of the cell in the column titled ColumnName from the row containing the ID UniqueID of the database titled DatabaseName.
If ColumnName, FindText, or FindColumnName starts with an asterisk ‘*’, the search method will be case-insensitive, partial match. If not, the search method will be case-sensitive, complete match. To use the double-quote character inside quoted names or texts, please use \". The same applies to parentheses and brackets if the text is delimited by those.
If the database request is used within a text or dimension that is linked to another object by means of its LinkedID member, the unique ID inside the brackets can be omitted and the application will automatically use LinkedID instead.
In order to access the default internal database of the current database, use an asterisk '*' only as database name. To access another internal database, use an asterisk followed by the internal database's name, e.g. "*Partslist1".
ExampleCode sequence in the text: ~%[Products]"Description","53790"@"Part No"~
Possibly displayed text: Switch, Shape C, small, black
Explanation: Technically, the application uses the database titled "Products". In this database, it first searches for a column titled "Part No" (i.e. a column containing exactly the phrase "Part No" in its top cell). In that column, it searches for a cell containing the text "53790". Once found, it stores the row number where it found that cell. Then, it searches for a column titled "Description" (i.e. a column containing exactly the phrase "Description" in its top cell) and takes the content of the cell in this column and the row previously stored. In plain English: The application searches for the description of the product with part number 53790.
Serial Printing FieldsSerial printing fields are only available if the user has opened the corresponding database by means of the command Library > Databases and serial printing is active. Each cell of the database is considered to be a (virtual) variable which can be evaluated by means of a serial printing field.
Serial printing fields have one of the following forms: ~%#ColumnNumber~ Gets the content of the cell in column ColumnNumber of the current serial print database’s entry. ~%"ColumnName"~ Gets the content of the cell in the column titled ColumnName of the current serial print database’s entry.
If ColumnName starts with as asterisk ‘*’, the search method will be case-insensitive, partial match. If not, the search method will be case-sensitive, complete match.
ExampleCode sequence in the text: ~%"Name"~
Possibly displayed text: Smith
Explanation: The application uses the column titled "Name" (i.e. a column containing exactly the phrase "Name" in its top cell) of the database selected for serial printing, and returns the column content of the row currently selected by the user (or the serial printing process).
Object PropertiesObject properties are variables allowing to access properties of specific objects by means of their unique ID.
The following object properties are available: ~*p0(UniqueID)~ Surface area in square millimeters (if available, otherwise 0). ~*p1(UniqueID)~ Perimeter / length in millimeters (if available, otherwise 0). ~*p2(UniqueID)~ Dimension number (if available, otherwise empty string). ~*p3(UniqueID)~ Text in the object (if available, otherwise empty string). ~*p4(UniqueID)~ X-coordinate in internal millimeters, i.e. relative to the page's center and non-scale-dependent (if available, otherwise 0). ~*p5(UniqueID)~ Y-coordinate in internal millimeters, i.e. relative to the page's center and non-scale-dependent (if available, otherwise 0). ~*p6(UniqueID)~ Surface area in square units, formatted according to the text's active coordinate system (if available, otherwise 0). ~*p7(UniqueID)~ Perimeter / length in square units, formatted according to the text's active coordinate system (if available, otherwise 0). ~*p8(UniqueID)~ X-coordinate in units, formatted according to the text's active coordinate system (if available, otherwise 0). ~*p9(UniqueID)~ Y-coordinate in units, formatted according to the text's active coordinate system (if available, otherwise 0). ~*p10(UniqueID)~ Library / file / bitmap name (if available, otherwise empty string). ~*p11(UniqueID)~ Block / group name (if available, otherwise empty string). ~*p12(UniqueID)~ Block / group comment (if available, otherwise empty string). ~*p13(UniqueID)~ Block scaling (if available, otherwise 1). ~*p14(UniqueID)~ Page name. ~*p15(UniqueID)~ Page comment (if available, otherwise empty string). ~*p16(UniqueID)~ Layer name. ~*p17(UniqueID)~ Layer comment (if available, otherwise empty string). ~*p18(UniqueID)~ Pen name. ~*p19(UniqueID)~ Pen comment (if available, otherwise empty string). ~*p20(UniqueID)~ Line type. ~*p21(UniqueID)~ Line width in millimeters. ~*p22(UniqueID)~ Line color. ~*p23(UniqueID)~ Fill color.
If the object property is used within a text or dimension that is linked to another object by means of its LinkedID member, the unique ID inside the brackets can be omitted and the application will automatically use LinkedID instead. If the unique ID is omitted and the text or dimension is not linked to another object, the application will use the top-level object (block or group) in which the text or dimension resides.
Starting with Version 2019.1, all texts, names, variables, and attributes are Unicode-enabled. In memory, they are stored in UTF-16 format, in the CAD6 file format in UTF-8 format.
|
CAD6studio Release 2024.2 - Copyright 2024 Malz++Kassner® GmbH