# Reference Manager. Post 15 in series “AutoCAD Cleanup”

## Using Reference Manager to re-link data set.

Scenario: You received a set of files on CD. The folder structure conforms to your company standard, but when you open plot files, XREFs are not found. You need to re-link all XREFs.

• Copy the CD contents to a local drive and examine its folder structure.
• Start by figuring out which files are intended to be the plot-able sheet files. This is the hardest part. You can use the transmittals, printouts, thumbnail images and/or any other means at your disposal. Sometimes you can guess from the folder structure or the file name. In this example it looks like all the plot sheets should be in a discipline specific subfolder of the plot folder.
• Once you have a working assumption of which files are the plot sheets, you can begin solving the puzzle. Start Reference Manager.

• Add the sheet files to be analyzed. I always work in batches based on plot file locations. You will be asked if you want to add all XREFs that are attached to the drawings being added. If you select “Yes”, then all nested XREFs will be added, and it can get large and confusing very quickly. In addition, you can also encounter circular referencing. When dealing with large sets, it is easier to process one level of nesting at a time by answering “No” and adding XREFs for processing later.

• The Reference Manager interface has two views.

• First, view the List by Drawing view to find out if any drawings are “broken”. In List by Drawing view, the left pane shows a hierarchical data structure with all resource files listed per drawing. If any of the XREFs or other resources are not found the drawing icon is crossed by a red line. In the right pane you can see all the needed resources. You can sort them any way you want. (by type, status, saved path, found path or any other column).

• Now let’s attempt to repair all broken links. Change to the List by Reference Type view. Select XREFs in the left pane. Sort the right pane by status.

• The missing XREFs saved path points to the P: drive. But your system does not have a P: drive. To remedy this situation and make your data set portable, you need to convert the full path to a relative path. Looking at the folder structure and saved path you can guesstimate that the XREFs should be in the discipline specific folder under the ref folder.
• The path is relative to the location of the parent (host) file. But in this batch all plot files reside in the same folder. Select all XREFs with identical saved path. Click on Edit Selected Paths, and then change the path. To get from the location of the host file to the location of the XREFs, you need to go two levels up the folder tree, then go down to the \ref\arch folder.

• You guessed right, and the status of the XREFs changed to Resolved with a pencil logo (pencil-in feature) indicating that the change is not yet applied. Click on Apply Changes to write the new paths into the host files. The status changes to Resolved.
• Process the rest of the files in groups based on the location of the host file and saved paths. If the path is not resolved for loaded XREF (open the host file to check if it is loaded) and you can’t find the file in any folder, you simply do not have it. I usually click on Export Report at this time, and examine host files to see if a missing XREF can be safely detached or whether I need to hunt them down.
• If you have any image references, their re-pathing is identical to re-pathing for XREFs.
• You do not need to worry about Plot Configurations because your plotters/printers are different anyway.
• Missing Plot Styles will result in problems with plot line thickness and colors, but in a pinch you can try Monochrome.ctb or Monochrome.stb
• If there are “not found” Fonts and Shapes, try to purge everything, and then run the reference manager report again. If the font is still not found and you can’t get it, AutoCAD will use the substitute font. Alternatively, you may want to use a font mapping table to specify which font AutoCAD substitutes when it encounters a text object created with another font. Windows True Type Fonts are independent of AutoCAD resource folders; they belong to the operating system.

# Attachments, overlays, full, relative and no Path. Post 14 in series “AutoCAD Cleanup”

### External References. Basic concepts

Data sets in AutoCAD are a collection of all files that are needed to produce graphic output for an entire project or its subsets.
It may contain various file types: drawing files, image files, font files, shape files, plot style files and other types of linked files.
Drawing files (.DWG) of the same data set are usually linked to each other forming a hierarchical XREF structure.
To understand and be able to manipulate the dataset structure you need to know the properties of XREF links.

### Attachment VS Overlay

AutoCAD uses two types of DWG references: attachments and overlays

All XREFs that are linked (attached or overlaid) directly to the parent file are visible in that file.

The second (and any subsequent) tier XREFs are only visible if they are attachments. In the schema below you will only see XREF1, XREF2, XREF3 and XREF5 from the PLOT file.

An easy way to remember: attachments are babies – they follow their parents. Overlays are teenagers – they never go with their parents.

### Full Path, Relative Path and No Path.

XREFs and image files can be linked to master files using full path, relative path or no path.
Full path can be compared to a street address; it is an exact location of the XREF or attached image on your system. It includes server name or mapped drive name.

Relative path is like point-to-point directions from the parent file to its reference. It finds the reference based on the location the parent file. The relative path says: go several levels up the directory tree (usually to where the directory tree starts branching) then from that point go to the location indicated after the last “..”
In the following example the parent file is plot.dwg. The location of plot.dwg in the folder structure is shown on the picture on the left. All references (XREFs and images) are stored at ..EX4drawingsrefarch folder.

The relative path to REF1 and REF2 from the location of plot.dwg takes us two levels up to the EX4drawings folder, then from there to ..refarch.

This method makes the data sets portable because the path does not contain server name or mapped drive name.. In other words, if I copy the entire EX4drawings folder to any other location (CD, DVD or any network location), plot.dwg finds its references.
If no path is selected, AutoCAD will first look for XREFs and images in the same folder as the parent file, then in the search path folders. The support search paths, working search paths and project search paths are user profile specific and can be set up in Options->Files. The search path folders could vary for different systems and profiles.

# Layer reconciliation. Post 13 in series “AutoCAD Cleanup”

in AutoCAD 2008 and 2009 you may have seen the following warning

These messages are produced by layer reconciliation feature.

If layer reconciliation is enabled, when you first open any file in Autocad 2008-2009, the layer baseline list is created in the file. Next time you open the same file, AutoCAD compares the current layer list with the baseline saved in the drawing and if any “new” layers are found it marks them “unreconciled” and groups them into special filter. You can the select the unreconciled ayers and right click to reconcile them(approve). This feature can be very useful in a collaborative environment with extensive usage of XREFs. But like anything new, it takes time to get used to.

Let’s take a look at the settings (variables) which control the behavior of the layer reconciliation

LAYEREVALControls when the Unreconciled New Layer filter list in the Layer Properties Manager is created/evaluated for new layers.
Type: Integer
Saved in: Drawing
Initial value: 1 for 2008 and 0 for 2009
When LAYEREVAL is set to 1 or 2, layer baseline is created. When LAYEREVAL is set to 0, the Unreconciled New Layer filter is hidden and new layers are not evaluated.
LAYERNOTIFY Specifies when an alert displays for new layers that have not yet been reconciled.
Type: Bitcode. To calculate the value of bitcode variable, add all desired options.
Saved in: Drawing
Initial value: 15 for 2008 and 0 for 2009

If the LAYEREVAL ≠ 0 and value of LAYERNOTIFY is odd, you will also get the following dialog box that will require you to click Yes or No every time you plot or add a drawing to Publish. It can disrupt your plotting/ publishing workflow.

LAYEREVALCTL Controls the overall unreconciled new layer filter list in the Layer Properties Manager which is evaluated for new layers.This system variable also affects whether the new layer notification is displayed or not.
Type: Binary
Saved in: registry
Initial value: 1
0 Disables the evaluation and notification of new layers
1 Enables the evaluation of new layers on LAYEREVAL settings in DWG file
Note: LAYEREVALCTL overrides the LAYEREVAL and LAYERNOTIFY setvars when LAYEREVALCTL = 0. It acts like a global off (but not a global on). There is no effect even if LAYEREVALCTL is turned on if LAYERNOTIFY = 0 or LAYEREVAL = 0. LAYEREVALCTL must be set to 1 for LAYERNOTIFY and LAYEREVAL to function correctly.

Note: Initial setting for both LAYEREVAL and LAYERNOTIFY is different for 2008 and 2009, thus users which skipped 2008 did not experience problems with layer reconciliation.

Following table illustrates the differences between 2008 and 2009 and where to set these variables in graphic interface.

### Solutions for 2008:

1. Use templates with desired settings for these variables when creating new files
2. Run script to re-set the variables in existing files.

LAYEREVAL 0
QSAVE
blank line

3. If planning to use the feature, reconcile layers once manually or by calling lisp or VBA program from the script

Solutions for 2009

1.Set LAYEREVALCTL=0. It is saved in the registry, so you will not need to go to every file and set LAYEREVAL 0
2. New option in –LAYER command
Run script to reconcile all layers. This will update the baseline. New layers will be evaluated

-LAYER E *
blank line
blank line
QSAVE
blank line

# Layer cleanup scenarios. Post 12 in series “AutoCAD Cleanup”

Depending on the purpose of your cleanup, there may be variety of tasks that you need to perform with the layers:

### Task 1.The objects in the drawing are not on the correct layers, and you need to sort them out.

This is a manual process which you have to perform on every file individually. Before you start cleaning up, save the layers state and export it to an external text file. This way you do not have to worry about restoring status quo if you make a mistake. In addition, do not forget about Layer Previous.

Most of the tools you need to sort the content into the correct layers are contaoned in LAYERSII toolbox

My favorite tool for individual layer diagnostic and cleanup is LAYWALK. LAYISO and LAYUNISO could be used as well.

If you can identify criteria for sorting elements to layers (for example: all red elements should go to layer RED, or all blocks – go to layer BLOCKS) you can script that process or at least use QSELECT or selection filters.

### Task 2. You need to show/plot XREFs with different symbology (color, lineweight, linetype).

When you approach this task, there are several things to consider:

• Are element properties (color, lineweight, linetype) of XREF files set ByLayer? If desired, you can use script to force ByLayer
• What is the VISRETAIN variable setting in the parent(s) file? If desired, script set VISRETAIN
VISRETAIN is a variable which controls if the parent file “remembers” changes to XREF dependent layer properties between AutoCAD sessions. VISRETAIN is saved in the drawing.
When VISRETAIN =1 in the parent file and you attach (or overlay) an XREF for the first time, AutoCAD creates an internal lookup table in the parent file. This table contains all XREF dependent layers names and their properties as read from the XREF at the time of attachment. When you change XREF dependent layer properties, the internal lookup table holds these changes (only if VISRETAIN =1). If you add layers to the XREF file, a new record with information about the new XREF layers will be added to the table when XREF is reloaded.
• Are the XREFs already attached?
• Do you expect updates for the XREFs? If yes, do you expect the layers to be consistent?

Example: Site.dwg is your architectural site plan (VISRETAIN=1). You attached Surv.dwg (survey data) to it and changed properties of all XREF dependent layers from Surv.dwg to gray thin lines (true color 120,120,120, lineweight 0.18mm). Later you receive an update from the surveyor, and there is a new layer “ParkingLOT” (blue, 0.35mm) in the updated Surv.dwg. When you substitute the old version of Surv.dwg with the new one, all XREF dependent layers except ParkingLOT will remain gray and thin, ParkingLOT will be blue and 0.35mm

If you now set VISRETAIN =0 in the Site.dwg, the lookup table will not be saved. Next time you open Site.dwg, the XREF dependent layers properties will be re-read from the XREF file. If you now set VISRETAIN =1 in the Site.dwg, it will not return to your gray thin lines, you will need to re-assign the properties again.
VISRETAIN controls all XREFs together, it cannot control individual XREFs.

When you have multiple similar files with multiple similar XREFs which have the similar file names and identical layer names, you can use some tricks to speed up repetitive tasks.

Super Trick: Say you are working on a hi-rise building (30 floors). File names for all floors follow the naming convention filename-NN.dwg where NN represents floor number. Layers names are identical for all floors.

The layers states (on/off, symbology and freeze status) should be similar for all floors. It would really save you a lot of time if you can set up the layer state for one floor, and then use it for the another 29. The problem is that XREF dependent layer names for different floors have different names because they contain the floor number.

Here is what you can do:

• Set up the layers the way you want them for one of the floors; in this example, I use 01.
• Name and save the layer state and export it to an external file Floor1.las
• Open Floor1.las in any text editor and replace “-01” with “-02”, then save as Floor2.las
• You now can import and apply Floor2.las to the second floor.

### Task 3. You need to change layer properties without changing layer names.

Most common reason to change layer properties is to make them work with a different CTB.
You can use Standards Checker to automatically fix layer properties if the layer names are identical.
If you have a “good” drawing with the layers properties the way you want them, you can save it as a .dws file and use with Standards Checker (Tools->CAD Standards)
You may want to associate standards files with the drawings after they have been cleaned up to catch future deviations before they accumulate.

### Task 4. You need to migrate the files from one layer naming standard to another.

The best AutoCAD tool for this job is Layer Translator.
Layer translator allows you to create a “translation table” which maps the layers from your file to the layers of another .dwg or .dws file. They can be saved and re-used on other files.

#### Tips on using LAYTRANS:

• Clean up Layer 0 and Defpoint layer first. Then Map same. That will take care of the layers with identical names
Zoom Extents before you start Layer Translator.
• In Settings check Show layer contents when selected. That will visually isolate selected layers display. Use Selection Filter if needed.
• Map the layers that you can visually identify first. Save the Layer Translation Mappings. Translate.

Use LAYWALK and other layer tools as described in task1 to clarify and sort out messed up layers, then go back to translation

#### Limitations of LAYTRANS:

• Works on one file at a time. Cannot batch translate multiple files.
Even when all options are selected, the nested objects in blocks are NOT forced to color and linetype ByLayer. Use SETBYLAYER in AutoCAD2008-2009.
• Missing features: options to Force object Lineweight and Plotstyle to ByLayer.
• Can’t zoom in/out while in Layer Translator
• Layer Descriptions will be lost in translation.

Using “Other Software” for batch processing of layers and other tasks

MicroStation translation tables are Excel files, and can be easily edited for such tasks as renaming layers by appending, pre-pending and partial name substitution. You can also force color, linetype and lineweight to ByLayer for the objects nested in blocks

Best of all, MicroStation can batch translate layers in multiple files. Use latest versions for compatibility with latest AutoCAD file format.

### Potential problems to watch for while cleaning up layers

Special layers. No graphic elements should be on Layer 0 or Defpoints.

• A layer is identified by its name, and when the name is changed, other files this file is referenced to (parent files) are not ”aware” of that change.
If you change XREF dependent layer names, the XREF dependent layers properties specifically assigned in the parent file using VISRETAIN=1 will stop working.
Similarly, when you rename XREF layers, the freeze and on/off (and for 2008 VP symbology settings) information in the plot sheet will be lost. In addition, this layer may need to be reconciled.
If you use layer states and export them outside of your drawing file, after renaming the layers the exported layer states will be unusable.
• Always keep in mind that color, lineweight and, in many cases, linetype and plot style for graphic objects are set to “ByLayer”, so any change to layer properties has to be coordinated with the plot style table you are going to use.
• In previous versions of AutoCAD you could only assign VP Freeze to a layer. Now in addition you can assign VP Color, VP Linetype, VP Lineweight and, for the DWG of STB flavor, VP Plot style. In other words, your layers may look and plot differently in different viewports.

# Layer0 and Defpoints . Post 11 in series “AutoCAD Cleanup”

Layer 0 and Defpoints layers are special. These layers should not to be used to create graphic content. Layer 0 should be used only to create block definitions, Defpoints layer is used by AutoCAD to create invisible definition points for other elements. These layers behave in a special way: they cannot be deleted and fall flat into the corresponding layer of a parent file when the file containing these layers is attached or overlaid to another file.

Example: A-Plan.dwg is a construction plan with walls drawn on layer 0 and M-Plan.dwg is a piping plan with hot water pipes drawn on its layer 0. A-Plan.dwg is overlaid into M-Plan.dwg to be used as a background. You want to see/plot walls as thin lines and pipes as thick lines. However you cannot separate layer 0 of parent M-Plan.dwg .dwg and A-Plan.dwg

The Defpoints layer behaves in a similar way. On earlier versions of AutoCAD many users learned to use the Defpoints layer as storage for elements they did not wish to plot (viewports, alignment lines, sometimes XREFs and such). However starting from AutoCAD 2000, any layer can have the non-plot property, and it is a good practice to create a special layer(s) to contain those elements.

It is best to start with cleaning up Layer 0 and Defpoints.

I wrote a little LISP routine to move all objects from Layer 0 to a new layer “from0”. After it is loaded, you can run it by typing “from0”at the command line.

(defun c:from0 ()
(setq ssl0 (ssget “x” ‘((8 . “0″))))
(COMMAND “-layer” “N” “from0″ “”)
(COMMAND “chprop” ssl0 “” “la” “from0″ “”)
)

You can also run it on multiple files using ScriptPro

However if you have graphic elements on the Defpoins layer, or do not want to dump everything from layer 0 into one layer, you will have to do it manually.

To identify objects on these layers, you can use LAYWALK (Express Tools in earlier releases). I will not duplicate the HELP file of LAYWALK here but suffice it to say that it is the most powerful tool for diagnosing layer problems and sorting them out. It can answer two questions:

• What layers the objects are on?
• What objects reside on these layers?

Undocumented trick: you can use your mouse wheel to ZOOM while in LAYWALK. Just click on Select by element, and wheel forward to zoom in, wheel back to zoom out, double click on a wheel to zoom extents, or press and drag to pan. When done navigating, press Escape to return to LAYWALK without change. Explore right-click menu.

# Scale List cleanup . Post 10 in series “AutoCAD Cleanup”

### From Scale List Cleanup Utility README.txt:

Description of Problem

When a file contains excess scales, performance may be negatively affected. Eventually, the file may become unusable. To use the file, some scales must be removed. This utility repairs affected files by removing excess scales.

NOTE: Nested external references (xrefs) may produce excess scales. To correct this problem, install AutoCAD 2008 Service Pack 1 or corresponding service packs for AutoCAD-based products. The Scale List Cleanup Utility repairs files affected before the necessary service pack was installed.

Affected Products

AutoCAD® 2008-based products, including DWG TrueViewTM 2008
AutoCAD 2009-based products, including DWG TrueView 2009

Not every scale containing “XREF” in its name is a bug. Legitimate” XREF scales:

• When units are different
• When proxy objects are present
• When these scales are already used in page setups, viewports or anywhere else where scale is used.
• When scale list in XREF contains scales or definitions which are not present in the parent file

#### How to clean:

• Alternatively, add the following line (before Qsave line) to any of the cleanup scripts you run on your files:
-SCALELISTEDIT R Y E

# Proxy objects cleanup . Post 9 in series “AutoCAD Cleanup”

A proxy object is a substitute for a custom object created by an AutoCAD add-on application such as AutoCAD Architecture, Civil 3D and others. Proxy objects may look OK but erasing and moving an object, or changing object properties may not be possible on a proxy object, depending on the application that created it.

When you open a drawing, you might see a Proxy Information dialog box (depends on PROXYNOTICE variable setting). The dialog box tells you the total number of proxy objects in the drawing (both graphical and nongraphical) and the name of the missing application and provides additional information about the proxy object type and display state.

An Object Enabler lets you view and somewhat edit proxy objects in AutoCAD when add-on application is not present. You can tell AutoCAD to search and install available enablers automatically, but that setting may slow down your system and may be intercepted by your network security policies. It is much better to install all of them on every machine in the office. http://www.autodesk.com/enablers.
Better yet, Object Enablers allows you to convert proxy objects to plain AutoCAD

Following script can be used to convert file with proxy objects to the plain AutoCAD file (provided you have an object enabler installed).

-EXPORTTOAUTOCAD
B N
blank line
blank line
blank line
QSAVE
blank line

Same script explained line-by line:

 LINE# SCRIPT COMMENT 1 -EXPORTTOAUTOCAD prerequisite: object enablers for proxy parent application 2 B N set BIND option to NO (can be used with YES, if you want to bind all XREFs) 3 P ACAD\ SUPER TRICK : Set PREFIX option to “ACAD\”. This will export the file into ACAD subfolder of current folder . This subfolder must exist before you run the script. 4 blank line 5 blank line 6 blank line 7 QSAVE 8 blank line

# Resolving problems with units. Post 8 in series “AutoCAD Cleanup”

Scenario: Some of your files were created in another country. The units are set to Architectural when you received the files. All objects’ LTSCALEs are set to 1. Some layers in both files use the HIDDEN linetype. You referenced these files to the files created and worked on in the US and experience the following problems:

• No matter what LTSCALE you set either lines from the US files or lines from the foreign files do not scale correctly.

• No matter what LTSCALE you set, either lines from the US files or lines from the foreign files do not scale correctly.
• When you reference foreign file in AutoCAD 2006 or newer, in addition to the problems with the LTSCALE, the whole foreign XREF file doesn’t scale correctly and is not located in the right place even though you attached it with the scale=1 and insertion point at 0,0,0.

Here is what happened and how to correct this.

There are several variables in AutoCAD that control units.

MEASUREINIT (0 English; 1 Metric) sets the initial drawing units as English or metric. MEASUREINIT controls which units, hatch pattern and linetype definition files a new drawing uses if not started from a particular template. MEASUREINIT is saved in the registry and the original value is determined by the geographic location of the installation.

MEASUREMENT is stored in the drawing and always overrides the MEASUREINIT setting.

When the foreign file was created, it took the local (metric) value of Measureinit and saved it in the file as the value for MEASUREMENT. At that time the operator may have changed the units to Architectural, but did not change other unit variables. In the course of his work, the metric linetype definition for HIDDEN line from the ACADISO.lin was loaded and used in the drawing.

The US drawing was started with MEASUREMENT set for English units and HIDDEN line definition from ACAD.lin (English).

The linetype names are identical in ACAD.lin and ACADISO.lin, but definitions are different. After the definitions are loaded into the file, it is not clear what .lin file they came from.

To correct the linetype issue you need to re-load linetype definitions from the ACAD.lin file into the foreign file. While you are at it, set the MEASUREMENT=0.

The second problem is illustrated by the units dialog boxes

#### Units to scale inserted content.

These values are controlled by the INSUNITS variable, which is saved in the drawing. The foreign drawing had it set to something other than inches, but the file did not have any symptoms until AutoCAD2006. Before 2006 this variable only affected drag-and-drop operation.

Possible values of INSUNITS are: 0-Unspecified (unitless); 1-Inches; 2-Feet; 3-Miles; 4-Millimeters; 5-Centimeters; 6-Meters; 7-Kilometers; 8-Microinches; 9-Mils; 10-Yards; 11-Angstroms; 12-Nanometers; 13-Microns; 14-Decimeters; 15-decameters; 16-Hectometers; 17-Gigameters; 18-Astronomical Units; 19-Light Years; 20-Parsecs

The only remaining question is what will happen when INSUNITS in either file is set to 0? (unitless).This situation is controlled by INSUNITSDEFSOURCE and INSUNITSDEFTARGET. They can be set in the Options-> User Preferences. The values are similar to INSUNITS.

The following script will fix all unit related the problems

-UNITS 4 64 1 0 0 n
INSUNITS 1
MEASUREMENT 0
EXPERT 3
blank line
EXPERT 0
-PURGE LT *ISO* N
QSAVE
blank line

Lines 1-3 simply set unit variables. Line 4 forces the linetype command to work in text mode without issuing prompts for user intervention (it needs EXPERT 3 mode for that, which I reset back to default EXPERT 0 after I am done with the LINETYPE command). After loading all linetypes from ACAD.lin, I purge only the linetypes with a name containing “ISO”. (I could have purged all unused linetypes or even all unused definitions.)

# Using scripts to run LISP or VBA routines and setting variables. Post 7 in series “AutoCAD Cleanup”

### Run LISP routines or VBA macros

You can batch process multiple files using scripts which call LISP or VBA macros.

Example: the following script runs a lisp routine to delete layer filters. It loads the Layerfilterdelete.lsp file, then deletes layer filters using a command LFD defined in the routine.

(LOAD “C:\\AU-CLEANUP\\EXERCISES\\SCRIPTING\\LAYERFILTERDELETE.LSP”)
LFD
QSAVE
blank line

(DEFUN C:LAYERFILTERSDELETE () (VL-LOAD-COM) (VL-CATCH-ALL-APPLY ‘(LAMBDA () (VLA-REMOVE (VLA-GETEXTENSIONDICTIONARY (VLA-GET-LAYERS (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) “ACAD_LAYERFILTERS”))) (PRINC “\NALL LAYER FILTERS HAVE BEEN DELETED.”) (PRINC)) (DEFUN C:LFD () (C:LAYERFILTERSDELETE))

If a routine expects a user response, you need to script the response also.

### Set up Variables

You can use scripts to set up variables. Here is an example where you set some variables you need for your environment. Keep in mind that not all variables are saved in files, some are saved in the registry, and some cannot be saved at all.

ATTMODE 1
ATTDIA 1
DIMASSOC 2
FILLMODE 1
MIRRTEXT 0
PDMODE 0
VISRETAIN 1
XEDIT 0
QSAVE
blank line

# Dealing with CTB and STB types of DWG. Post 6 in series “AutoCAD Cleanup”

DWG files come in two flavors. One uses traditional CTB (color based plot tables), the other uses STB (style based plot tables). Plot style is a general property that can be assigned to an object or a layer in the STB “flavored” DWG file. An object can also inherit this property from a layer much like color, linetype or lineweight when set to ByLayer.

In DWG file of CTB flavor, the plot style property is set to ByColor and cannot be changed.

If PSTYLEPOLICY (a variable saved in the registry) is set to 1, new files (unless created from templates) will be CTB flavor of DWG and will use CTB for plotting; when it is set to 0, new files will be STB flavor of DWG and will use STB for plotting.

When you need to convert DWG files from STB flavor to CTB flavor, you need to strip the plot style property from the objects and layer definitions. This can be done easily using the following script. DWG files of CTB flavor will not be affected by this script.

CONVERTPSTYLES
QSAVE
Blank Line

When you need to convert from CTB to STB, you need to add that property to the objects and layer definitions.

Before converting a CTB flavor of DWG file to STB flavor of DWG file, you first need to have a STB table which you will be able to use with your former CTB DWG file.

To accomplish this, type CONVERTCTB at the command line and select the CTB to be converted to STB. IN this example, I selected ACAD.CTB to be converted to ACAD2.STB

You can then use the following script to batch convert CTB DWG files to use ACAD2.STB. DWG files of STB flavor will not be affected by this script.

CONVERTPSTYLES
Blank Line