Working with multiple Civil 3D drawings

Does anyone know how to make Dynamo work with multiple Civil 3D drawings from a single Dynamo window? In my case, I want to attach the same external references (XREFs) to several open drawings, but Dynamo only lets me do it one drawing at a time.

Hi,

This may be one for ‘Batch Scripting’ using the AutoDesk core console.

Would need a script (.scr) and a batch file (.bat)

For your given example, the script may look like the following:

;Tilemode, 0= PaperSpace 1= ModelSpace.
tilemode 1
;-xref activates the xref command in the command line
-xref
;A for attach.
A
;The address of the dwg to be xreffed
“XX\XXX\XXXXX\XXXXXX.dwg”
;Insertion Point
0,0
;X Scale Factor
1
;Y Scale Factor
1
;Rotation Angle
0
.qsave
.quit

Following is a useful presentation given via AutoDesk University which covers this:

https://www.autodesk.com/autodesk-university/class/AutoCAD-Scripting-Core-AutoCAD-Core-Console-2018

Hope this helps!

Use Batch Save Utility for this. Have Claude or ChatGPT make you a .scr file (or a .scr that then runs a lisp file). I fixed 200 dwg xrefs with this last week!