ababs Posted May 22 Posted May 22 Hi everyone, I’m working on a project with multiple AutoCAD drawings (building floors), and each floor contains several XREF layers. I want to know if there is a way or tool to change XREF layer properties (such as color, linetype, lineweight, etc.) for multiple drawings at once without opening each file individually. For example: I have many floor plans. Each drawing has the same XREF attached. I want to directly modify the XREF layer overrides across all drawings in bulk. Is there a built-in AutoCAD feature, script, LISP, Sheet Set method, Layer States Manager workflow, or Autodesk tool that can do this automatically? Quote
BIGAL Posted May 23 Posted May 23 You can use possibly OBDX which can edit a dwg without opening it. Using a script is much simpler as it will open a dwg make the edits then close it. Should be reasonably fast. The obvious first step is what are you trying to change ? You need say a text file with the new settings, layer name, color, linetype on/off and so on. So if I understand correct another way, the sequence may be open a dwg add the xref do the layer changes save and close do next dwg. So what I am asking here does original dwg always have the xref pre loaded. Need sample dwg, txt and a xref. Can be blank just need layers, Quote
ababs Posted May 23 Author Posted May 23 hello actually we attach the architectural drawings as xref after finishing our mechanical plans we have to publish so we got to change xref's layers properties excpt for title block(which is also xref) Quote
BIGAL Posted May 24 Posted May 24 (edited) @ababs "actually we attach the architectural drawings as xref " so why not do the changes then as part of an custom attach xref lisp. Again need an idea of what the layer names are and the relevant changes. How do you propose to identify the layers ? By wildcards "wall*" etc Were I worked we redid the color of layers by wildcards about 7 of them. So maybe 50 layers. Edited May 24 by BIGAL Quote
ababs Posted May 25 Author Posted May 25 Hi Again for example, here I have 4 xref attached, I need to change the layers properties (make color 180,180,180 and line weight =default) for these xrefs without opening all drawings. Thank you for your time Quote
BIGAL Posted May 26 Posted May 26 (edited) So give this a try. Just load the xrefs in a dwg then run this code will reset all the xref layers. Note will do all current XREFS. Just do it as part of adding the XREFS to current dwg. ; https://www.cadtutor.net/forum/topic/99138-layer-properties/ ; Set all xref colors in a dwg ; By AlanH May 2026 (defun c:setxrefcol ( / lst blk lays xname tc) (setq lst '()) (setq blk (tblnext "BLOCK" T)) (while blk (if (member (logand (cdr (assoc 70 blk)) 4) '(4)) ; bit‑4 = xref (setq lst (cons (cdr (assoc 2 blk)) lst)) ) (setq blk (tblnext "BLOCK")) ) (reverse lst) (setq lays (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) (repeat (setq x (length lst)) (setq xname (nth (setq x (1- x)) lst)) (vlax-for lay lays (setq lname (vlax-get lay 'name)) (if (wcmatch lname (strcat "*" lname "*")) (progn (setq tc (vla-GetInterfaceObject (vlax-get-acad-object) "AutoCAD.AcCmColor.20")) (vla-SetRGB tc 180 180 180) (vla-put-TrueColor lay tc) ) ) ) ) (princ) ) (c:setxrefcol) There is no need to try and do it as a after task. Edited May 26 by BIGAL Quote
ababs Posted May 26 Author Posted May 26 Thank you, but I am looking for something more general (I don’t think a LISP will solve the problem). I remember seeing something on YouTube where we can control layer properties without opening the drawings. I uploaded the picture for this specific XREF (x-A2-landscape). I don’t want to change these properties for this xref ....... Your LISP is too specific because, on some floors, more or fewer architectural XREFs are attached. Quote
BIGAL Posted May 26 Posted May 26 (edited) I understand there are ways of selecting which XREFS you want to change. ; Set all xref colors in a dwg ; By AlanH May 2026 ; Multi choice added by AlanH (defun c:setxrefcol ( / lst blk lays xname tc) (setq lst '()) (setq blk (tblnext "BLOCK" T)) (while blk (if (member (logand (cdr (assoc 70 blk)) 4) '(4)) ; bit‑4 = xref (setq lst (cons (cdr (assoc 2 blk)) lst)) ) (setq blk (tblnext "BLOCK")) ) (if (not AH:Toggs)(load "Multiple toggles.lsp")) (setq ans (reverse (ah:toggs (cons "Choose Xrefs " lst)))) (setq lays (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) (setq tc (vla-GetInterfaceObject (vlax-get-acad-object) "AutoCAD.AcCmColor.20")) (setq lst2 '()) (repeat (setq x (length ans)) (if (= (nth (setq x (1- x)) ans) "1") (setq lst2 (cons (nth x lst) lst2)) ) ) (foreach lname lst2 (vlax-for lay lays (if (wcmatch (vlax-get lay 'name) (strcat "*" lname "*")) (progn (if (= lname "Defpoints")(alert "defpoints")) (vla-SetRGB tc 180 180 180) (vla-put-TrueColor lay tc) ) ) ) ) (princ) ) (c:setxrefcol) You must save multi Toggles.lsp in a support path as its auto loaded, it will display the names of your xref's, up to about 20 xref's by name, then just tick on the ones you want to change. Multi toggles.lsp Edited May 27 by BIGAL Quote
tombu Posted 1 hour ago Posted 1 hour ago On 5/22/2026 at 7:24 AM, ababs said: Hi everyone, I’m working on a project with multiple AutoCAD drawings (building floors), and each floor contains several XREF layers. I want to know if there is a way or tool to change XREF layer properties (such as color, linetype, lineweight, etc.) for multiple drawings at once without opening each file individually. For example: I have many floor plans. Each drawing has the same XREF attached. I want to directly modify the XREF layer overrides across all drawings in bulk. Is there a built-in AutoCAD feature, script, LISP, Sheet Set method, Layer States Manager workflow, or Autodesk tool that can do this automatically? You can have multiple references to the same drawing with different Layer Properties. I've done it many times. You could insert the same XREF drawing into one of your project drawing with a different name, modify it's layer properties then copy each of them into your project drawings. You could also define Layer States in the XREF drawing for both Layer States in the XREF drawing then insert and name each of them into one of your project drawings then just copy each of those inserts to the rest of your project drawing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.