Called from CADViewer or directly controlled though a command-line process, the back-end CAD converter AutoXChange 2025 new Map Block command (-map_block or -mb) allows the user to swap various items in place of an AutoCAD Block instance. These substitutions can be:

  1. (1) A different block
  2. (2) An SVG symbol
  3. (3) An image file
  4. (4) A square or cross at the insert point
  5. (5) An outline of the extent of the block


Block Substitution

Block Substitution allows the user to switch one block for another. The new block will replace the original block and be scaled to fit the same extent as the original one.

The command will be:

​-mb=BlockA>BlockB

Multiple Block Substitutions can be listed separated by semicolons. This command will be:

​-mb=BlockA>BlockB;BlockB>BlockD

If either Block Name contains spaces, the substitution string must be enclosed in parentheses (e.g.,. -mb=“BlockA>BlockB”).



A Note on Attributes

If the Blocks have Attributes, the Attributes will only be processed if the Attribute ID is the same in the Original Block and New Block. At this time, there is no method to map attributes using different names.



Block Substitution from a Different File

Block Substitution can be performed using Blocks from a different file. The second file can be a library of blocks that does not contain a regular drawing, just the defined blocks. The new block will replace the original block and be scaled to fit the same extent as the original one.

The command will be:

​-mb=BlockA>drawing\BlockB

As before, multiple Block Substitutions can be listed separated by semicolons. If either Block Name contains spaces, the substitution string must be enclosed in parentheses (e.g.,. -mb=“BlockA>BlockB”).



SVG Substitution


SVG Substitution allows users to switch a block for an SVG (Simple Vector Graphics) file. The SVG image will replace the original block and be scaled to fit the same extent as the original block.

The command will be:

​-mb=BlockA>svgfilename.svg:scale

As before, multiple Block Substitutions can be listed, separated by semicolons. If either the original Block Name or the SVG File Name contains spaces, the substitution string must be enclosed in parentheses (e.g.,. -mb=“Block A>c:\drawings\svg file name.svg”). If the SVG File is not in the same directory as the base drawing, then either the relative ("..\file.svg)" or absolute path (“c:\drawings\svgs\file.svg”) must be listed.

If a scale is listed, then the SVG file will be displayed at that scale. Negative or zero scales will be ignored.



Image Substitution

Image Substitution allows users to switch a block for a Raster Image (PNG, GIF, JPEG) file. The image will replace the original block and be scaled to fit the same extent as the original block.

The command will be:

​	-mb=BlockA>rasterfilename.<extension>:scale

As before, multiple block substitutions can be listed and separated by semicolons. If either the original Block Name or the Raster File Name contains spaces, the substitution string must be enclosed in parentheses (e.g.,. -mb=“Block A>c:\drawings\raster file name.png”). If the Image File is not in the same directory as the base drawing, then either the relative ("..\file.png)" or absolute path (“c:\drawings\svgs\file.png”) must be listed.

If a scale is listed, then the Image file will be displayed at that scale. Negative or zero scales will be ignored.



Square or Cross

The user can substitute a simple cross or square for all block instances. The Cross or Square will be defined as a custom block and use the standard Block substitution method, except that it will NOT be scaled to the extent of the original Block.

The command will be:

​-mb=BlockA>*SQUARE\ or -mb=BlockA>*CROSS*

The substitution string must be enclosed in parentheses if the original Block Name contains spaces. Multiple Block Substitutions can be listed, separated by semicolons. For instance:

​-mb=BlockA>*SQUARE*;BlockB>*CROSS*


Extents

The user can substitute a rectangle for all block instances. The rectangle will not be a Block but rather a simple polyline. It will be the size and extent of the original block on the same layer.

The command will be:

​-mb=BlockA>*EXTENT* or -mb=BlockA>*EXTENTS*

The substitution string must be enclosed in parentheses if the original Block Name contains spaces. Multiple Block Substitutions can be listed, separated by semicolons.



Delete

The user can delete all block instances. No geometry will be created for the Block References.

The command will be:

​	-mb=BlockA>*DELETE* or -mb=BlockA>*ERASE*


Mixing Types

Multiple Block Substitutions can be listed, separated by semicolons. Each part of the substitution can be a different type, so different blocks can be mapped to different DWG Blocks, SVG files, Cross/Square, or Extents.

For instance, the following is valid:

​-mb=BlockA>BlockB;BlockB>*CROSS*;BlockC>*EXTENTS*

This will result in:

  1. (1) BlockB replaces BlockA
  2. (2) A Cross replaces BlockB (in the original file, not the prior substitution)
  3. (3) BlockC is replaced by a rectangle for its extents


Wildcards

Map Block uses Regex syntax for wildcard processing. All normal Regex rules apply.

For instance, to map any block that begins with F or P to *extents* use:

-mb=(F|P).*>*EXTENTS*

To map all blocks to *CROSS* use:

-mb=.*>*CROSS*

To map any block that begins with ABC and has exactly one character after it to *SQUARE*, use:

-mb=ABC.>*SQUARE*

You can test your Regex schema at https://www.regexplanet.com/



ENJOY - and get in touch!