Substitutions

Substitutions are used in the plug-ins Sawing Table, Lay and Smart Leader.
Substitutions are a system similar to AutoCAD fields. Substitutions show my programs where to insert the data about the objects. Each substitution begins and ends with % symbol. Some data can be substituted with a short substitution or a long one (for example %n% or %name%) - there is no difference. 
All substitutions are written only in small letters. And attributes of blocks should be written in the same register as they are written inside the block.

Solids

Here is a list of all permissible substitutions for solids:
  • %layer%  or %l% - solid layer name,
  • %color%  or %col% - solid color name. If color has no name – color index inserted. If color = “by layer” – space inserted.
  • %material% or %mat% - render solid material,
  • %thickness% or %depth% or %d% - depth (thickness) of solid (minimum of the three overall dimensions),
  • %width%  or %w% - width  (length)  (minimum of the three overall dimensions),
  • %height%  or %h% - height  (third of the three overall dimensions),
  • %volume% or %v% - real volume of solid (not product dimensions),
  • %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.
  • %asymv% - The direction of the center of the box to the center of mass in three dimensions. It differs from the mirrored parts
  • %tech% - Technology, a method of manufacturing parts
  • %box% or %note%  - comment “Box” for easy boxes.
  • %nobox% - comment “Not box” for all solids except easy boxes
  • %dmm%, %wmm% and %hmm% - solid size converted from current drawing units to mm. Formats ignored
  • %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.
  • %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.
  • %facecount% or %fc% - number of faces of the solid.
If you are using a plugin Names, you get access to substitutions:
  • %name% or %n% - string name of object. If grouping then will use the first available solid name. You have to check that there are no identical solids with different names,
  • %info% or %i% - description of detail or any other information
  • %kind% or %k% - kind, type, material of object or any other information
  • %sweep% or %s% - comment “Sweep” for solids marked like Sweep,
  • %mirror% or %m% - comment “Mirror” for solids marked like Mirror ,
  • %texture% or %t% – comment about texture direction,
  • %tr% - “1” if Texture property = No, “2” if Texture = Along or Across (for Cutting3 program)

Details

When the commands Lay and Sawing Table group the same solids and count the number of the same, then in these commands, the property part substitutions are available:
  • %number%  or %#% - item number in numbered list (use only if you do not have a set of numbers in the name of a solid),
  • %count% or %c% - quantity of identical solids,
  • %mirrorcount% or %mc% - quantity of identical solids, marked like ”mirror”,
  • %sumcount% or %sc% - summary quantity of identical solids (unmirrored and not),
  • %c+m% - quantity of identical solids + quantity unmirrored solids (if not zero). The text "pcs." will be added to this line.
  • %assemlycount% or %ac% - Number of assemblies. Set by user. The number of parts found will be multiplied by this count.
  • %perassembly% or %pa% - Quantity per assembly. The number of parts without multiplying the number of assemblies.

Blocks

For blocks you get access to substitutions in Smart Leader:
  • %layer%  or %l% - solid layer name,
  • %color%  or %col% - solid color name. If color has no name – color index inserted. If color = “by layer” – space inserted.
  • %material% or %mat% - render material,
  • %name% or %n% - name of block,
  • %info% or %i% - description of block,
  • attributes and parameters of the block - they should also be enclosed between the characters %

Other

For any other objects you get access to substitutions in Smart Leader:
  • %layer%  or %l% - solid layer name,
  • %color%  or %col% - solid color name. If color has no name – color index inserted. If color = “by layer” – space inserted.
  • %material% or %mat% - render material
  • %area% or %ar% - area of a closed curve or region or surface. In the millimeter drawing, the area will be converted into square meters.
  • %perimeter% or %p% - the length of any line or curve or the perimeter of a region or surface. In the millimeter drawing, perimeter will be recounted into meters.
  • %id% - object identifier. Changes every time the drawing is loaded
  • %handle% - object identifier. Constant but local. Сan be repeated in external links
And if the plugin Names is installed, then still available:
  • %name% or %n% - string name of object,
  • %info% or %i% - description of detail or any other information,
  • %kind% or %k% - kind, type, material of object or any other information

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,
  • 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.

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.

NC layer names

The contour preparation commands for CNC (Outside loop, CNC_Prepare and DXF Export) are able to use substitutions when creating new layers. The following substitutions can be inserted into the layer name template:
  • %depth% - depth. Can be used in all layers. For milling, this is the depth from the top of the part. For drilling, this is the depth of drilling from the entry point into the part. For the through layers and 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. Measured from the bottom of the part (XY plane). It makes sense only for layers of horizontal (lateral) drillings.
  • %diam% - diameter. For drilling - the diameter of the hole. For all other layers, the diameter of the cutter specified in the settings will be substituted.
  • %angle% - the angle between the drill axis and the XY plane. Measured in degrees (or as configured to display angles in the drawing). It makes sense only for inclined (universal) drilling.
  • %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.
  • 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. For example, you can set the tool number in the Kind property and then paste it into the layer by substituting %kind%.
A null string is substituted for zeros. If a wildcard separator is specified, it will be inserted into the name of the layer before the non-zero substitution (except for the solid properties).

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.
Comments