Substitutions
Substitutions are used in the Data Table, Sawing Table, Material Table, Lay, Mark, NC Prepare, DXF Export, Numbering and Smart Leader plug-ins. That is, wherever you need to insert some properties of drawing objects into the text. Substitutions are a system similar to AutoCAD fields. The substitution shows A>V>C> programs where to paste the part information in the text. For example, you need the title of the part to contain the line "Part No. 1, Layer Chipboard", where 1 is the name of the part, and Chipboard is the name of the part layer. Then you use two substitutions in the calculation settings: "Part No.%name%, Layer %layer%". And the program will substitute for each part the name of the part where %name% is written and the part layer, so where %layer% is written.
You can always insert the substitutions into the program settings using the insertion substitution dialog. But you can not open a dialog, but write a substitution yourself. Therefore, it makes sense to figure out how to write your own permutations.
If you cannot set up substitutions yourself, then contact technical support or Telegram-chat. Small consultations are provided free of charge.
Writing substitutions
Each substitution begins and ends with the % percent symbol and can consist of a one or several property names, then an index number and then a format:
%namenamenameN:Format%
The names of substitution are case sensitive - it is usually necessary to write in small English letters, or as it is called attribute, drawing property. Some data can be substituted by short substitution or long (e.g. %n% or %name%) - there is no difference.
The substitution name can be composite. For example, face means that it is necessary to substitute some property of solid surface. Behind face we specify which one: facearea - area, facemat - surface coverage material. And after mat may be also a property of this material. facematprice - the price of the material of covering the solid surface. All these parts should be written in small letters without spaces.
%facematprice2:#.##'$'%
Here you can see inside the substitution not only its three-part name, but also its index and format. The index is used only to indicate the number of the painted surface or the number of the edge. In this case "2" means that you have to substitute the material price for the second (back) side of the part. And you need to format the price with the cents and the dollar symbol at the end. And for example, %edgematart1% is an article (art) of edge material (mat) on the first (longest) edge (end) of the part.
Substitution formats
The substitution format is written after the name and index and separated by a colon. The format redefines the standard formatting of numbers, sizes, areas. The format allows you to specify how many digits of the fractional part of the number you want to output. The same format allows you to specify any text in quotes. This text will be substituted only if the value of number/length/area/volume is not zero. You can use this to output units. For string substitution, the format string allows you to substitute some input words, but only if the value of the substitution is not an empty string. Since I use C# for my plugins, you can see the format string descriptions for C# and use them in substitution.
For floating point numbers (area, volume, prices) all the formatting options are described in great detail here. You can configure how many decimal places to write and whether to write insignificant zeros. This setting does not in any way affect the accuracy of calculations and the comparison of solids. In the format, use the characters 0 and #. 0 is a digit or 0, # is a digit or nothing. For example, the number 1.111111 formatted as 00.00 will be displayed as 01.11. And formatted 0.#### will be displayed as 1.1111. And the number 1.2 formatted as 0.#### will be displayed as 1.2. There are also standard formats, depending on the regional settings of Windows:
G - regular format (default)
E - exponential format
F - fixed number of decimal places
P - percent
C - currency
N, D, R, X - other standard formats
Standard formats should be capitalized
After the format character, 1 digit is allowed, which means the required number of decimal places.
For lengths and sizes, all the same possibilities are used as for floating point numbers, plus special AutoCAD formats:
CU - current from the drawing, as recorded in the system variables LUNITS and LUPREC,
AR - English Architectural
EN - English engineering,
FR - English fractional,
SC - scientific with decimal exponent,
DE - regular decimal
After the special formats AR, EN, FR, SC, DE, you can write one digit from 0 to 8. It will mean precision (see LUPREC). For decimal numbers, this is the number of decimal places.
If the size format is not specified in the substitution, the format specified in the Common Options or in the style settings of this command in the "Convert numbers to string" section is used.
Area and volume are displayed by default with dimensions: m², in³. If you do not need these characters, write any format suitable for numbers.
For integers (quantity, indices, table row numbers), the same strings are used as for real ones, except for the fractional part and the exponent. For example, if you need leading zeros before a number so that there are always 3 characters, then write the format 000. You can also use special formatting strings:
X - is a hexadecimal number
ARABIC - regular numbers
ROMAN - Roman numerals (only for numbers from 1 to 3999)
ALPHABET - letters in the English alphabet from A to Z and further from AA to ZZ and so on (only for numbers greater than 0)
CYRILLIC - letters in the Russian alphabet from А to Я and further from АА to ЯЯ and so on (only for numbers greater than 0)
Standard formats should be written in capital letters
For part and material prices, the default format is 0.00 and the local currency symbol $, £... If you do not need this symbol, write any format suitable for floating point numbers.
Edge angles are always converted to degrees and displayed with one decimal digit and the ° degree symbol. They can also be reformatted as any other floating point number.
For Yes/No substitutions, you can replace the default substitution string with any word. Write this word in the format line and it will be substituted for "Yes". In this case, instead of “No”, an empty line will be substituted. Or write two words separated by a vertical bar | . Then the first word will be used instead of Yes, and the second one instead of No.
For string and complex substitution, the format can be:
any text with a mandatory insertion {0}. This is where the property value will be inserted. This trick makes sense only to avoid writing anything superfluous when the property value is empty. If you export data to Excel and only one value is written to one cell, then the table cell will be assigned this format. Therefore, record only those formats that are valid in Excel.
%info:\PInformation: {0}%.
This substitution will turn into an empty line if the information about the part is empty. And if it is not empty, the line break will be inserted (in AutoCAD is encoded by the characters \P ) then the word Information with a colon and only then the detail description will be inserted.Do not try to substitute another number between the curly braces instead of 0. This will cause a program error.
substr function - extracts a substring from a string property. That is, it allows you to discard prefixes in the names of parts, etc. Details below.
up and lo formats - convert all letters in a string to upper or lower case.
You can only use one of the above options. Don't try to combine the substr function with the up format - it won't work.
Then each substitution will be described with its type. Based on this, you can choose the acceptable formats.
substr function
The substr function allows you to extract part of a string (a substring). The function name should be written in small letters. After the function name, write two integers separated by commas: the starting position and the length of the substring. The first number is the character number in the source string, starting from 1. You can skip this number, write a comma at once, and then the substring will be extracted from the beginning of the string, from the first character. The second number indicates the number of characters to be extracted. If the length is set to be greater than the length of the source string, or if the second number is not specified, then all characters up to the end of the source string are extracted. Examples:
%name:substr3,4%.
This example extracts the name of the object (for example, the name of the old block in the AsmNew command), and then the substr function extracts 4 characters from the name, starting with the third. For example, if the name was "A#9876B", then only "9876" would be substituted.
Other examples:
%name:substr3% - extract the substring from the third character to the end of the string - "9876B".
%name:substr,4% - extract a substring of 4 characters starting from the first (start not specified = 1) - "A#98".
Mathematical Expressions
Many substitution commands allow you to evaluate mathematical expressions involving numbers and numeric substitutions. In particular, you can write a mathematical formula in the settings of any column of any table command: Data Tables, Sawing Tables, and so on. To calculate the formula, you need to start the text with the = symbol.
For example, to calculate the area of the overall rectangle of a part, you can create a column in the Sawing Table with the value "= %length% * %width% / 1000000". In this case, the length and width values will first be substituted, and then they will be multiplied and converted from mm to square meters.
You can use the following functions in mathematical expressions:
Operators:
+ - / ÷ * × % ^
Functions:
exp log ln sqrt fpart round ceil floor fac sfac abs
Trigonometric functions:
cos sin tan cotan acos asin atan acotan cosh sinh tanh
Comparison operators (return 0 or 1):
> < == != >= <=
Logical operators:
&& || !
Constants:
euler, pi, nan, infinity, true, false
The priority of operations is taken into account, but it can be changed using parentheses (). If some symbols (units or degrees) are displayed when formatting the substitution, the expression will not be evaluated. You will have to force format some substitutions that output extra characters by default.
Please note that in Excel and in the dwg table the result will be written, not the formula (if only it can be calculated). If an unevaluated expression falls into a table cell, AutoCAD will try to evaluate the expression itself and will most likely show an error (cell with #### symbols).
Substitution Selection Dialog
Each substitution-enabled text box has a button to open a substitution selection dialog. To see this button, click on the field. Or double-click to enter the text editing mode in the table (in the list of fields of the Data Table). Before calling the dialog, position the cursor in the desired position in the text. A substitution will be inserted at this location.
In the settings dialog, all substitutions are grouped by objects from which data can be extracted. The substitution Format can be entered in a separate input field. And this field remembers the last formats you entered and contains examples - you can select them from the drop-down list. If the substitution allows an index, an Index entry field will appear. At the bottom of the form, you will see a field with the resulting substitution code. It can be corrected. Here, too, there is a list of recent substitutions - it may be easier for you to choose a substitution from this list. Click OK to insert the substitution. Or close the dialog with a cross so that you don’t insert anything.
Common properties
At all objects of the drawing it is possible to receive and substitutes in the text some standard properties. Here substitutions for them:
%layer% or %l% - object layer. String.
%layerNNN% - other layer properties. What substitutions are allowed for a layer instead of NNN - see below.
%color% - color. If the color has no name - digital color index or RGB code. "ByLayer"|"ByBlock" will substituted for the layer|block color. If the color is selected from the color book, the name of the book will be displayed. String.
%col% - the color of a part without color book name. String.
%owner% - the owner of this object. For objects inside a block, the name of the block will be displayed. For objects in model or paper space, the Title propery of drawing will be substituted. If the Title is empty or contains only 1 character, then the name of the drawing without dwg will be substituted. String.
%block% - the name of the block this object is included in. For model objects, the name will be empty. String.
%blockNNN% - other owner-block properties or his constant attributes. What substitutions are allowed for a block instead of NNN - see below.
%blockinstance% is the name of the dynamic block instance from which this object was obtained. String.
%group% - group name. Usually groups of objects are unnamed and you will see a hidden automatic name like *A1. Drawing objects can belong to several groups. The substitution will take the first group it comes across (most likely the first in alphabetical order). String.
%groupNNN% - other properties of the first group the object belongs to. What substitutions are allowed for a group instead of NNN - see below.
%hyperlink% - text of hyperlink. String.
%hyperlinkurl% - addres (URL) of hyperlink. String.
%area% or %ar% - the area of a closed curve or region or surface. In millimeter drawing the area will be recalculated in square meters. Floating point number. By default it is written with the units of measurement at the end.
%length% or %len% - the length of the line or curve, the perimeter of the surface and the region. For solids, the length appears only after measurement and corresponds to the dimension of the part along the X axis after laying out. Always output in drawing units. Formatted as a size without units.
%perimeter% or %p% - the length of the perimeter of the front side of the solid, the perimeter of the surface and the region, or the length of the line. Unlike length substitution, in a millimeter drawing, the perimeter will be converted to meters. Formatted as a size, but with units.
%size% - accounting size of the object. For closed curves, this is the area. For open ones - length. For solids - depending on the material settings - volume, length or area. In a millimeter drawing, the size will be converted to meters. Formatted as a real number with no units specified.
%basex%, %basey%, %basez% - X, Y, Z coordinate of base point = location, insertion point, first vertex. In current User Coordinate System (UCS). Formatted as size.
%extentsx%, %extentsy%, %extentsz% - X, Y, Z dimensions of the overall box into which the object fits (aka Extents). In current User Coordinate System (UCS). Does not work for some auxiliary objects. Formatted as size.
%dimensions% - three overall dimensions (Z x X x Y) of an object in UCS indicating the drawing units. For flat objects, Z is not substituted. For solids with metrics: Thickness x Length x Width. For round pipes - Diameter x Length. For blocks measured by the Block Metrics command, the metric dimensions are displayed, that is, the dimensions no longer depend on the current coordinate system. Formatted as size, but sorted simply as a string, not in ascending size order.
%extminx%, %extminy%, %extminz%, %extmaxx%, %extmaxy%, %extmaxz% - the X, Y, Z coordinates of the minimum and maximum points of the overall box into which the object fits. In current User Coordinate System (UCS). Does not work for some auxiliary objects. Formatted as size.
%id% is the object identifier. Changes every time you load the drawing. Integer.
%handle% - object identifier. Invariable, but local, i.e. may be repeated in an external link. Integer. It is displayed in hexadecimal by default.
Name of objects
If you are using the A>V>C> Palette, you get access to substitutions:
%name% or %n% - string name of any object, not only block,
%info% or %i% - description or any other information,
%kind% or %k% - kind, type, material of object or any other information
You can order adding any text properties to objects. Development of one property - $50. They can also be substituted by their name inside the %% symbols, respecting the case of letters.
In addition, all properties of the current drawing can be retrieved from any object. For objects from xrefs, the properties of the main drawing will be retrieved, not from he links.
For objects extracted from assembly-blocks, you can retrieve the properties of the owner-block and its constant attributes. To do this, write the word "block" in the substitution and then the desired property. Note that objects do not know through which block reference they were received and therefore the block reference properties are not available. Also, parameters of dynamic blocks and variable attributes are not available.
Solids
In addition to the standard properties of solids, you can substitute properties:
%material% or %mat% - name of material. This is a render material, not special materials from BIM or Mechanical verticals. If the material is set by ByLayer, then the material of the layer will be substituted. If the material is ByBlock, then the material of the block will be substituted. If the material is not assigned to either the solid or the layer (the default Global material remains), then an empty string will be substituted for Global. However, if you have assigned a color book color to the solid (not index or RGB), then the color name without the color book name will be substituted for Global. If you have the A>V>C> Properties Panel, then you can configure and use not only the name of the material, but also a number of its properties (see further in the Material section). In the substitution, specify the material property after mat keyword. String.
If you are using the A>V>C> Palette, you get access to substitutions:
%name% or %n% - string name of solid.
%info% or %i% - description of detail or any other information. Some characters (end of line, tab, semicolon) cannot be inserted into a cell in a text table, and the Sawing Table command will delete them.
%kind% or %k% - kind, type, material of object or any other information. String.
%sweep% - comment “Sweep” for solids marked like Sweep. Yes/No.
%mirror% - comment “Mirror” for solids marked like Mirror. Yes/No.
%texture% – comment about texture (grain) direction. "Along" means the grain pattern along the X axis of the laid out part. "Across" - along the Y axis. In the Common Options you can tweak the names of the texture directions. String.
%texture2% - “2” if Texture = Along or Across and “1” if Texture property = No (specially for Cutting3 or OptiCut program)
%texture*% - “*” if Texture = Along or Across. Use this mark in the sawing table after the length substitution. For parts with a texture across, instead of the length, the width is displayed. Thus, for all textured parts, the side along which the fibers of the texture should be deployed will be marked.
Solid Metric
If you run the Lay, Saw, Mark or SolSize commands, then its metric will be written to solid xData. You can get this data using substitutions:
%thickness% or %t% - thickness of solid (minimum of the three overall dimensions). Matches %extentsz% of the solid laid out in XY according to the rules of the LAY program. Formatted as size.
%length% or %len% - length of solid (minimum of the three overall dimensions). For parts with a texture across, instead of the length, the width is displayed. Formatted as size.
%width% or %w% - height (third of the three overall dimensions). Formatted as size.
%asym% or %a% - Indicator asymmetrical: the distance from the boxing center to the center of mass. It allows you to identify the offset holes, and others. Floating point number.
%asymv% - The direction of the center of the box to the center of mass in three dimensions. It differs from the mirrored parts. String.
%tech% - Technology, a method of manufacturing parts. String.
%box% or %note% - comment “Box” for easy boxes. Yes/No.
%nobox% - comment “Not box” for all solids except easy boxes. Yes/No.
%doubleside% - comment "Double-sided processing" for parts requiring drilling or milling from both front and rear.
%tmm%, %lmm% and %wmm% - solid size (thickness, length, width) converted from current drawing units to millimeters. Size formats are ignored.
%volume% or %v% - real volume of solid (not product dimensions). In a millimeter drawing, the perimeter will be converted to cubic meters. Floating point number. By default, volume units are displayed. By default it is written with the units of measurement at the end.
%area% or %ar% - the area of the greatest flat face of the part. You can use it to calculate the quantity of materials. In the millimeter drawing, the area will be converted into square meters. Floating point number. By default it is written with the units of measurement at the end.
%perimeter% or %p% - perimeter of the outer contour of the largest flat face of the part. You can use it to count the number of edges. In the millimeter drawing, perimeter will be recounted into meters. Formatted as size. By default it is written with the units of measurement at the end.
%facecount% or %fc% - number of faces of the solid. Integer.
%weight% - weight of the part (volume * density of the material). Floating point number.
%cost% - the price of the part materials. Floating point number. By default, the currency symbol from the Windows settings is assigned to the price.
%faceXXXN% - properties of the selected solid surface. For example, the surface indicated by the Smart Leader. N is the number (index) of the surface. The surface number 1 is always considered the front, number 2 is the rear. 3 and further, only surfaces having a cover (material assigned) are numbered in decreasing order of area. For each surface, you can substitute the following properties instead of XXX:
id - surface identifier in the internal structure of the solid. Unchanged until you edit the geometry of the solid. Integer.
# - surface index. 1 - front, 2 - rear, then in descending order of area. Integer.
color - color like all objects, including the name of the color book. String.
col - color without the name of the book. String.
area - surface area. Floating point number. In a millimeter drawing, the area will be converted into square meters. By default, it is written with the units at the end.
mat - material assigned to the surface. If not assigned (Global), then the color will be displayed. If both the material and color coincide with the solid, then an empty string is substituted. After the keyword mat, you can specify any property of the material.
%edgeXXXN% - properties of one of the ends of the part adjacent to the main surface (front). The properties of other end faces (not adjacent to the main surface) are not available. If the front is cut into several surfaces by dadoes, then working with edges is not possible. 'N' is the number (index) of the edge. The numbering of the edges is described below. Instead of XXX, you can write all the same properties as on surfaces, but it is still added:
len - the length of the end. It is measured along the length of the edge of the front plane, which may be slightly smaller than the required size of the edging material. Formatted as size.
angle - the angle of inclination of the flat end relative to the front plane. The angle is measured as it is adjusted on a sawing (format) machine: the angle is 90 degrees is taken as zero. The positive angle is when the end is visible from the front. The negative angle is when the end looks down, on the other side of the front. Floating point number. By default, 1 decimal place and degrees symbol are displayed.
letter - The letter (conditional name) of the this edge. For the four main directions these are the letters: L, T, R, B. For some solids they can also be used length Len and width W. All other ends are designated by their length or an index is used in order. Letters are configured in Common Options. There you can also configure arrows instead of letters. Formatted as String.
%covers% - a complete description of all covered surfaces. All surfaces to which the material is assigned are listed, except for the edges. For each, the name of the surface is displayed and then the name of the material. The FRONT word is displayed as the name of the front surface, for the rear - REAR, for the rest - surface area is displayed. If the same material is assigned to several surfaces, then the descriptions are combined, and the names of the surfaces are listed through the fraction symbol /. You can replace the name of the material with any other property of the material - just add the appropriate substitution name after covers keyword. In this case, you can skip the "mat" prefix. That is, to display the index of a material, you can write %coversmatindex% or %coversindex%. In both cases, "Front: A; Rear: B" will be substituted. You can substitute a description for only one surface if you specify its index in the substitution. It can be formatted as a string.
%bandings% - a full description of the edge materials at all ends of the part. The edges are listed in clockwise order around the front surface, starting from the lower left corner of the part (meaning that the part has already been laid out in the XY plane with the Lay command). As the name of the edge, its length is usually used. But you can reconfigure the Common Options so that instead of the length, the numbers of the edges are written in order or the letters L, T, R, B. For consecutive edges with the same material, only the names of the ends through / are listed. You can also select any material property. In this case, you can skip the "mat" prefix. That is, to display the index of the material, you can write %bandingsmatindex% or %bandingsindex%. In both cases, "L: A; R: B" will be substituted. You can specify a face index to display information about only one face. But the edge name (length or letter) will still be present. You can format the substitution as a string.
%slopes% - a full description of all the ends of the part, made with the inclination of the saw. Everything is similar to %bandings%, but in the list there are only inclined ends and angles instead of materials. This substitution understands both text and numeric formats. If the format does not have the string "{0}" and there is no "substr" function, then the format is applied to the angle values.
Solid edge indexes
Edge of solids in edge, bandings & slopes substitutions are listed in clockwise order around the front surface, starting from the lower left corner of the part (meaning that the part has already been laid out in the XY plane with the Lay command). Thus, for a rectangular part on the layout, end number
1 will be on the left,
2 on top,
3 on the right,
4 on the bottom.
There are not necessarily 4 edges - they can be any number. And they are not necessarily flat.
If corners are cut off or there are cutouts on a rectangular part, then the end numbers are confused and you will not be able to display the right end by its index; it is no longer the third, but, for example, 6. To solve this problem, you can use 4 special end indices:
1000 - flat end on the left edge of the part, directed strictly to the left (-X coodrinat axis),
2000 - top (+Y),
3000 - right (+X),
4000 - bottom (-Y).
This refers to the directions on the parts laid out with the Layout (LAY) command. The initial position of the part in the assembly does not matter; the part can be turned over during laying out.
If in the table you need to first specify the columns of the top and bottom edges, and then the left and right (as required by import into the OptiCut program), then use the following column order: 2000, 4000, 1000, 3000.
A part can have several edges with one special index (part with a cutout). Data about them will be combined and it may listing multiple values or subsitute *varies*.
The part may not have any of these 4 edges (triangular part, arc, circle). N/A will be substituted.
Special indexes only work with rectangular parts. Ends inside cutouts, windows, diagonals of triangular parts, curved ends - all these ends can only be displayed using regular numbering in order, but not with special indices.
It is these four main directions of the edges that can be called the letters L, T, R, B or arrows if you enable this option in Common Options.
Blocks
All standard properties are available to Block Reference. Plus:
%scale% - the scale of the link to the block. Always greater than 0. If the scales are different along different axes, the word "distorted" will be substituted for the scale. Real number.
%mirror% - if the block is mirrored in 1 or three axes, the comment “Mirror” will be substituted. String.
%instance% is the name of the dynamic block instance that this block reference actually refers to. String.
In addition, the properties of the block defenition (BlockTableRecord) are available:
%name% or %n% - name of block,
%info% or %i% - description of block,
%expodable% - if the block can be exploded (and used as an assembly), the comment will be substituted “Explodable”, otherwise - “Not Explodable”. String.
%units% - name of the unit of measurement of the block (may differ from the units of measurement of the drawing). In English. String.
Attributes and parameters are also available. Both constant (from a Block Table Record) and mutable (from a Block Reference). Their name must be enclosed between the % characters. It is important to observe the case of letters as the attribute tag is written, and to write in the substitution. Substitution of attributes and parameters can be formatted as a string. Integer and real parameters can be formatted as a number.
Virtual attributes (set in the settings of the AVC Properties Palette) will be available for substitution for all blocks.
Curves
All lines, polylines, multi-lines, arcs, circles, flat splines, ellipses are added to the standard substitutions:
%length% or %len% is the length of a line, polyline, or other curve. Always equal to %perimeter%. Formatted as size.
%endx%, %endy%, %endz% - the X, Y, Z coordinates of the end point of the curve in the current user coordinate system (UCS). Formatted as size.
%midx%, %midy%, %midz% - the X, Y, Z coordinates of the midpoint on the curve in the current user coordinate system (UCS). Not for Multi-linest. Formatted as size.
Polyline & Polyline2d
Adds to curve substitutions:
%closed% - if the polyline is closed, it will write the word "Closed", otherwise an empty line. Yes/No.
%bypass% - closed polyline bypass direction - substitute the words “Clockwise” or “Counterclockwise”. String.
%segments% - number of segments. Integer.
Arc
Adds to curve substitutions:
%radius% - arc radius. Formatted as size
%angle% - arc angle. Formatted as size (default with degrees)
Circle
Adds to curve substitutions:
%radius% - radius. Formatted as size.
%diam% - diameter. Formatted as size.
Text & MText
Adds to standard substitutions:
%style% - text style. String.
%text% - text without field codes and formatting characters. String.
%contents% - text content along with field codes and format codes. String.
%textframe% - presence of a frame around the text: Yes/No.
MLeader
Adds to standard substitutions:
%style% - multi leader style. String.
%text% - text without field codes and formatting characters. String.
%contents% - text content along with field codes and format codes. String.
%format% - substitutions for Smart Leader. String.
%textheight% - text size. Formatted as length.
%textframe% - presence of a frame around the text: Yes/No.
Dimensions
Adds to standard substitutions:
%style% - dimension style. String.
%text% - text without field codes and formatting characters. String.
%contents% - text content along with field codes and format codes. Instead of the length of the object, the string will contain the characters <>. String.
%textheight% - text size. Formatted as length.
%measurement% - measured length of a drawing object. Formatted as length.
Table
Adds to standard substitutions:
%style% - table style. String.
%name%, %n% - table name. It just content of a first cell of a table. String.
%section% - section number if table spitted between sheets. Integer.
Viewport
%scale% - viewport scale. Real number
%standardscale% - if the scale corresponds to one of the standard - a standard scale string (For example, if the scale is 0.5, then the string "1:2" will be substituted)
%locked% - the view is locked. String "Locked".
Group
By groups we mean groups of jointly selected model space objects. Groups are usually not available on their own; they must be obtained as a property of visible drawing objects via the %groupNNN% substitution. AutoCAD allows you to assign one object to many groups, but AVC programs will select one (the first) group. Instead of NNN, you can write one of the following group property substitutions:
name - group name. Instead of %groupname% you can simply write %group%. AutoCAD itself gives names like *A2 to unnamed groups.
info - description of the group. May contain newline characters.
isanonymous - nameless group. Yes|No.
selectable - a group of jointly selectable objects. Yes|No.
numentities - number of objects in the group. Integer.
Layout
Sheet (Layout) property substitutions are only available in the settings of the Detailing Drawings command (DDraw). In addition to the properties of the sheet itself, you can substitute the properties of the viewport or the details visible in the viewport. To do this, use the 'view' prefix. For example %viewstandardscale% is the scale of the viewport. If there are several viewports on the sheet, then all variants of the property will be substituted. Part properties are substituted first, even if the viewport has the same property. For example, %viewlayer% is the layer of the detail shown in the viewport, not the layer of the viewport itself.
%taborder% - sheet number in tab order. Integer.
%vpcount% - the number of viewports (and details) on the sheet. Including unfilled viewports. Integer.
Layer
Layers are usually not accessible by themselves, they should be retrieved as a property of visible drawing objects via the %layerNNN% substitution, where instead of NNN you can write one of the following layer property substitutions:
name - name of the layer. Instead of %layername% you can simply write %layer%. In layers from external links will be like file_name|layer_name.
info - description of the layer. May contain newline characters.
color - color. If the color does not have a name, use a digital color index or RGB code. If the color is selected from a color book, then the name of the book is indicated. String.
col - part color without color book name. String.
linetype - line type name. String
lineweight - weight (thickness) of lines in mm. Formatted as size
material - layer material. String. You can get other properties from a material. For example, %layermaterialthickness% - the thickness of the sheet material of the layer will be substituted.
plotstyle - the name of the plot style for drawings with "style" = .stb (not color = .ctb) plot control. String.
transparency - percentage of layer transparency. Number from 0 to 90.
off - layer is disabled (objects are invisible). Yes|No.
frozen - the layer is frozen in the current viewport. Yes|No.
locked - the layer is locked (layer objects are not editable). Yes|No.
plottable - layer to print. Yes|No.
reconciled - the xref layer is synchronized. Yes|No.
used - the layer is used somewhere in the drawing, there are objects on this layer. Yes|No.
Details
When the commands Data Table, Lay and Sawing Table group the same objects and count the number of the same, then in these commands, the detail property substitutions are available:
%row% - table row number (use only if you do not use numbering). Use only if Numbering is not configured. Formatted as an integer. The default format is 000, that is, with bit justification up to 3 digits. It is this substitution that is used for part numbering in the AvcNum command. It is here that such integer formats as ROMAN (Roman numerals), ALPHABET and CYRILLIC - alphabetical letters are most in demand.
%count% or %c% - quantity of identical details in all assemblies. Including multiplier (product series). Integer.
If geometric comparison of objects is enabled, but the separation of mirror parts into separate records is not enabled, then the following substitutions make sense:
%countmirror% - quantity of details, marked like ”mirror”. By default, an empty string is substituted for zero. Integer.
%countright% - quantity of details, exclude marked like ”mirror”. Integer.
%c+m% - quantity of "right" (as shown in layout) + quantity mirrored details (if not zero). The text "pcs." will be added to this line. String. Attantion! This substitution works only with parts, but has nothing to do with the number of assembly blocks. You can only count the number of mirror blocks in a separate Data Table.
If the search for objects inside assembly blocks is enabled or the multiplier (product series) is greater than 1, then additional substitutions can be used:
%assemlycount% - Number of assemblies. It takes into account the number of founded Block Reference in which these details are found. The quantity is also multiplied by a Multiplier (product series). Integer.
%perassembly% - Quantity per assembly (per block). Integer.
Detail properties are not saved in object and therefore not available in Smart Leader and Mark.
Materials
If you use the A>V>C> Palette, you can customize new material properties. And after that you can use the substitutions (after name mat ) :
index - the index of the material. For example: %matindex% or %facematindex1%. String.
color or col - the diffuse color of the material. If the color does not have a name - a digital color index or RGB code. If the color is inherited from an object (ByObject), then an empty string. String.
art - article of material. String.
info - description of the material. String.
use - the purpose of the material. String.
den - the density of the material. Floating point number.
length or len - the length of the sheet/rod of the material. Formatted as size.
width or w - width. Formatted as size.
thickness or t - thickness. Formatted as size.
price - cost per unit area / length / volume. Floating point number.
piece - The size of the piece of material. Sheet area, rod length or volume. Calculated by the size of the material, taking into account the purpose ("Use" field). For millimeter drawings, it is converted to meters. Floating point number.
units - Units for measuring the amount of material. Substituted depending on the purpose ("Use" field). String.
grain - This material has a grain pattern (texture) along the long side of the sheet. 0 or 1. Integer.
milltool - The name or number of the tool (cutter) as it is named in the CNC machine. For CNC-layer names. String.
millmode - Processing mode (milling). For CNC-layer names. String.
sawtool - The name or number of the tool (disk / saw blade) as it is named in the CNC machine. For CNC-layer names. String.
sawmode - Processing (sawing) mode. For CNC-layer names. String.
id - is the material identifier in dwg-file. Changes every time you load the drawing. Integer.
handle - object identifier too. Invariable, but local, i.e. may be repeated in an external link. Integer. It is displayed in hexadecimal by default.
In the Material Table command, you can use material calculation substitutions for selected parts:
quantity - The amount of material by area, length, or volume. Taking into account the required scrap (see "Cost Calculation" in Common Options). The unit of quantity depends on the purpose of the material. Floating point number.
pieces - The number of pieces of material. If the dimensions of the material are specified, the program will calculate how many sheets, rods, and edge bandings are needed. Floating point number.
weight - The weight of all parts made from this material excluding scrap. The density of the material must be specified. Not calculated for coatings and edges. Formatted as weight.
cost - The cost of this amount of material. The unit price of the material must be specified. Formatted like money.
Drawing property
For any object you can use DWG drawing property substitutions:
%filename% - drawing file name without dwg,
%dir% - the path to the drawing folder,
%revisionnumber% - revision number,
%lastsavedby% - last saved by,
%comments% - comments,
%keywords% - keywords
%author% - author,
%subject% - subject,
%title% - title,
%hyperlinkbase% - base address for all hyperlinks from drawing objects,
%dwgcreated% - date and time the file was created,
%dwgupdated% - the date and time the file was last saved,
%indwg% - total time of drawing editing,
%usertimer% - the user time counter reset by the _Time command.
%number_of_details% - the number of details in the drawing. Detail numbering can be continued from this digit.
%multiplier% - multiply the number of parts by an integer. This will help fill the table for making a large series of identical products.
You can also substitute custom drawing properties. To do this, place the substitution in the form of %customdp.My_property_name% Do not forget the point before the name. It is important to write the name in that case of letters as in the properties of the drawing. All drawing properties except dates are formatted as a string.
Current time
You can use date and time substitutions for any object.
%today% - is today's date in the short date format. The format depends on the settings of Windows. For the USA localization of Windows, the default is MM/dd/yyyy (month/day/year)
%now% - the current date and time at the time of the substitution call. The format also depends on the Windows settings.
%timestamp% - timestamp, i.e. the current date and time in short format, convenient for alphabetical sorting yyMMdd_HHmm (2 digits of the year, month, day, hour and minute without extra points and spaces). Does not depend on the date format settings.
All substitutions of the current time are calculated at the moment of launching the commands and cannot be converted to fields.
Contours of parts for CNC
The contour preparation commands for CNC (Outside loop, NC_Prepare and DXF Export) are able to use substitutions when creating new layers. These substitutions can use the data on the contours of the part, which is necessary for assigning processing parameters to the part. The same substitutions can be used in the Drill Table and on the face tilt angle leaders.
depth - Depth of immersion of the tool along the direction of immersion. For drilling, it is considered together with the cone at the end and the depth of the countersink. For the Blank layer is simply the thickness of the workpiece. For the Outside loop command, you can set the depth in the settings.
z - position on Z axis. Measured from the bottom of the part (XY plane). For inclined planes, the coordinate of the bottom point. For ends and complex shapes, the value is undefined, but the %centerz% substitution can be used. Always a positive number. It makes sense for layers of horizontal (lateral) drillings, milling and sawing.
-z - The Z-position in the inverted coordinate system from the top of the part. Always a positive number.
centerx, centery, centerz - coordinates of the drill entry point into the part along three axes. Measured from the lower left corner on the laid out part. Used in the Drill Table, but you can get the coordinates of the center of any surface, not just drilling. Note that %centerz% is the entry and %z% is the exit or bottom.
diam - diameter. For drilling - the diameter of the hole.
angle - the angle drill axis or tilting the cutter / disc from the Z-axis. Measured in degrees (or as configured to display angles in the drawing). From -90° to +90°
-angle - the tilt angle from the Z-axis in the inverted coordinate system. The angle sign is replaced with the opposite one compared to the %angle% substitution.
slope - the angle of inclination of the plane or drilling from the horizon. 90 - %angle%. For front plane is always 0. For rear plane - 180
rotation - the angle of rotation of the normal to the plane or drilling around Z axis from X (spindle rotation). From 0 to 360. For horizontal planes - n/a.
-rotation - the angle of rotation of the normal to the plane or drilling around Z in an inverted coordinate system (as required by Biesse), that is, from -X CLOCKWISE. From 0 to 360. For horizontal planes - n/a.
dir - The letter of the drilling direction "A" - in X, "B" - against Y, "C" - against X, "D" - in Y. It makes sense only for horizontal (lateral) drillings.
countersink - The word "countersink" for countersink drills. The word itself can be reconfigured in the NCP command options.
countersinkdiam - The outer diameter of the countersink at the drills.
countersinkdepth - Countersink depth of drillings.
countersinkangle - The angle of the countersink cone at the drills.
length or len - the length of the given end face of the part. Can be used on a through-cut layer on a saw.
milldiam - is the diameter of the cutter used.
sawdiam - saw blade diameter.
sawthickness - saw blade thickness.
milltool - number or name of the milling tool. The program prefers to take this data from the material properties of the part, but if it is empty, it will take it from the CNC style.
sawtool - number or name of the sawing tool.
millmode - milling mode code.
sawmode - sawing mode code.
down - label " downward" if the inclined end of the part is facing down. Substitution is used in sloped edge leaders.
passage: the minimum width of a dado or groove. The program measures the distances from all contour segments to all other points on the contour and searches for the minimum. For the circle you get the diameter. For contours with concave elements, it will give an incorrect result or "n.d."
number - drilling number. The holes are numbered in order by dirrection of drilling, by diameter and by location on the part from the base point (from left to right, from bottom to top). This order cannot be changed. The number will be the same both in the Dimensions for Detailing command and in the Drilling Table if the part has not changed between command calls. Formatted as an integer, allowing letters or Roman numerals to be displayed instead of numbers.
row - row number in Drilling Table. Used only in the Drill Table. Cannot be used in layer names.
All other substitutions of the Metric and Name of solid - the properties of the processed solid will be substituted. This way you can create individual layers for each part. You can also get data about the material of a part through a compound lookup. for example %matindex% - part material index.
View name
The Lay program can lay out parts face or backwards. With the special substitution %view%, you can display the name of the view in the title of the part. Substitution is also available in the DXF export command.
%view% - view name: "FRONT VIEW" or "REAR VIEW". Formatting is not supported.
Unknown properties
If you wrote a substitution with an error or the object does not have such a property or the block does not have the required attribute, then the substitution system will return the value "n/a". You can reconfigure this string - write down another value in the Common options in the Substitution section in the "No available" field. You can substitute an empty string too.
In the summary values and totals, the unknown substitution will be considered as zero.
Fields
AutoCAD fields are also substitutions of a special kind. They are inserted by the _Field command into any text (multitexts, multileaders, attributes, tables) that allow you to display the properties of the drawing or objects. Conveniently, the fields are updated automatically, almost immediately after you change the property of the object.
Updating the fields can occur when the image is regenerated (command _Regen), change the sheets, before printing or manually using the _UpdateField and AVCUpdate commands. Field updates are configured by the FieldEval system variable.
Commands from A>V>C> plugins can create fields and replace substitutions for fields. This can be convenient, because many object changes on Smart Leaders even without calling the LeaderUpdate command. But there are a number of limitations and peculiarities:
Do not expect the fields themselves to switch to displaying the properties of another object. For example, if you moved objects under the Smart Leaders, you still need to call LeaderUpdate.
Fields with properties created by the plugin Names work only under AutoCAD in which the plug-in Names is installed. Disable the creation of fields if you plan to transfer the dwg-file to other engineers.
Fields with additional properties of objects Name, Type, Info, etc., which creates the plug-in Names, can not be edited in the AutoCAD field editor, because he simply does not see these properties.
Fields with properties Name, Type, Info, etc., which creates the plug-in Names, work only in one location AutoCAD. If you created them in the Russian AutoCAD, they will not work in English. For Smart Leaders, it is enough to call LeaderUpdate and the fields will be recreated and will work again.
My plugins do not replace those properties on the fields that have a list of values: Mirror, Texture, Sweep - these are always substituted as a string, not as a field.
You can not create fields for properties that do not appear in the Property Panel (OPM). Those to display the Type, Info, and so on properties requires a working Names plugin (or AVC_Kit). The hidden properties of the solid are not available: %box%, %tr%, %dmm%, %wmm%, and %hmm%. No Detail properties are available. For all these cases, the substitution will still work, but the value of the property will be inserted, not the field. And you need to manually update these values (for Smart Callouts, you just need to call LeaderUpdate)
I have not yet found a way to create field for block-parameters. If you write a block parameter in a substitution, it will be substituted as a string. With block attributes, everything is fine, their substitutions will be converted to fields.
Creating fields is easy to disable in the Common Options - see the "Use Fields" checkbox.
In the Common Options, you can set the display format for numbers/sizes. This setting also applies to fields. But there is a restriction - you can not add characters and texts to the format string.
In the Common Options, you can adjust names of textures and technologies.