I HAVE PASTED A ROUTINE THAT I NEED SOME HELP WITH. THIS ROUTINE WILL RUN ON SOME DRAWINGS AND ERROR OUT ON OTHERS. WHEN IT ERRORS THE COMMAND LINE SHOWS "VL-NAME SPACE MISMATCH". THE ERROR OCCURS AFTER THE PURGES AND CHANGE COMMANDS. IS THERE A PROBLEM WITH THE CODE I CAN NOT FIND? IF NOT CAN AN ERROR TRAP BE PUT IN TO "RESUME ON ERROR"?
(DEFUN C:FIXA22 ()
(command "layer" "thaw" "*" "" "")
(command "layer" "SET" "0" "" "");sets current layer
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(command "CHANGE" "ALL" "" "p" "COLOR" "BYLAYER" "LW" "BYLAYER" "" "")
(command "layer" "FREEZE" "*" "" "")
;START OF XREF SECTION
(tblnext "BLOCK" T);sets pointer to top of block table
(setq Loop T)
(while Loop
(setq Bdata (tblnext "BLOCK"));;steps through table
(if (assoc 1 Bdata);;an xref path
(setq XrefName (cdr (assoc 2 Bdata))
Loop nil
)
);if
);while
;start of thawed A2 xreflayer list
(setq LayList '(
"A-FLOR-ELEV"
"A-FLOR-EVTR"
"A-FLOR-FCAB"
"A-FLOR-RMNA"
"A-FLOR-RMNU"
"A-FLOR-STRC"
"A-FLOR-STRS"
"A-FLOR-STRS-UPDN"
"A-FLOR-XSHT"
"A-GLAZ-EXTE"
"A-WALL"
"A-WALL-ACCP"
"A-WALL-ACLG"
"A-WALL-CLNG"
"A-WALL-COLS"
"A-WALL-EXTE"
"A-WALL-GLAZ"
"A-WALL-LOW"
"A-WALL-SLAB"
"A-WALL-STRC"
"VIEWPORT"
"XREF"));end of A2 xref thawed layer list
(foreach x LayList
(setq LayName (strcat XrefName "|" x))
(command "layer" "THAW" LayName "" "")
);foreach ;end of A2 THAW XREF section
;END OF XREF SECTION
;START OF THAW SECTION
(setq LayList '(
"A-CLNG-ACCS"
"A-CLNG-BKHD"
"A-CLNG-DETL"
"A-CLNG-DOOR"
"A-CLNG-EQPM"
"A-CLNG-EXJT"
"A-CLNG-GRID"
"A-CLNG-HOOD"
"A-CLNG-NGRD"
"A-CLNG-REFS"
"A-CLNG-SHTT"
"A-CLNG-SKYL"
"P-ANNO"
"viewport"
"XREF"));END OF THAWED LAYER LIST
(foreach x LayList
(setq LayName (strcat x))
(command "layer" "THAW" LayName "" "")
);foreach
;end of THAW section
(command "layer" "SET" "A-clng-grid" "" "");SETS CURRENT LAYER
(command "layer" "lock" "xref" "" "")
(command "layer" "plot" "n" "viewport" "" "")
(command "ltscale" "24")
(command "fillet" "R" "0" "")
(vl-Load-Com);START OF LAYER FILTER DELETE
(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);clean exit
);defun;END OF LAYER FILTER DELETE
(DEFUN C:FIXA22 ()
(command "layer" "thaw" "*" "" "")
(command "layer" "SET" "0" "" "");sets current layer
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(COMMAND "PURGE" "ALL" "" "N")
(command "CHANGE" "ALL" "" "p" "COLOR" "BYLAYER" "LW" "BYLAYER" "" "")
(command "layer" "FREEZE" "*" "" "")
;START OF XREF SECTION
(tblnext "BLOCK" T);sets pointer to top of block table
(setq Loop T)
(while Loop
(setq Bdata (tblnext "BLOCK"));;steps through table
(if (assoc 1 Bdata);;an xref path
(setq XrefName (cdr (assoc 2 Bdata))
Loop nil
)
);if
);while
;start of thawed A2 xreflayer list
(setq LayList '(
"A-FLOR-ELEV"
"A-FLOR-EVTR"
"A-FLOR-FCAB"
"A-FLOR-RMNA"
"A-FLOR-RMNU"
"A-FLOR-STRC"
"A-FLOR-STRS"
"A-FLOR-STRS-UPDN"
"A-FLOR-XSHT"
"A-GLAZ-EXTE"
"A-WALL"
"A-WALL-ACCP"
"A-WALL-ACLG"
"A-WALL-CLNG"
"A-WALL-COLS"
"A-WALL-EXTE"
"A-WALL-GLAZ"
"A-WALL-LOW"
"A-WALL-SLAB"
"A-WALL-STRC"
"VIEWPORT"
"XREF"));end of A2 xref thawed layer list
(foreach x LayList
(setq LayName (strcat XrefName "|" x))
(command "layer" "THAW" LayName "" "")
);foreach ;end of A2 THAW XREF section
;END OF XREF SECTION
;START OF THAW SECTION
(setq LayList '(
"A-CLNG-ACCS"
"A-CLNG-BKHD"
"A-CLNG-DETL"
"A-CLNG-DOOR"
"A-CLNG-EQPM"
"A-CLNG-EXJT"
"A-CLNG-GRID"
"A-CLNG-HOOD"
"A-CLNG-NGRD"
"A-CLNG-REFS"
"A-CLNG-SHTT"
"A-CLNG-SKYL"
"P-ANNO"
"viewport"
"XREF"));END OF THAWED LAYER LIST
(foreach x LayList
(setq LayName (strcat x))
(command "layer" "THAW" LayName "" "")
);foreach
;end of THAW section
(command "layer" "SET" "A-clng-grid" "" "");SETS CURRENT LAYER
(command "layer" "lock" "xref" "" "")
(command "layer" "plot" "n" "viewport" "" "")
(command "ltscale" "24")
(command "fillet" "R" "0" "")
(vl-Load-Com);START OF LAYER FILTER DELETE
(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);clean exit
);defun;END OF LAYER FILTER DELETE