Automating XML Imports into Multiple Civil 3D Drawings Using Dynamo

I have an existing Dynamo script (see attached) that can import multiple LandXML files into a Civil 3D drawing. The script uses the LandXML Load from File node, followed by the String Import node to load multiple XML files by name.

My question is:
Is it possible to use this script (or adapt it) to import multiple XML files into multiple Civil 3D drawings automatically?

In other words, rather than importing all XML files into the current drawing, I’d like the script to:

  1. Open each Civil 3D file in a specified directory,
  2. Import the corresponding XML file by name (e.g. matching filenames),
  3. Save and close the drawing before moving to the next.

Has anyone done something similar or know if this can be achieved using Dynamo?

Thanks

Currently, Dynamo targets the current drawing only. If you were to open another drawing, Dynamo loses that target and doesn’t want to work. It’s a current limitation that I think they’ve been talking about working on.
Until then, I don’t think you’d be able to do what you’re asking from within Dynamo.
However, you could still use this script for a single drawing and use LISP to do the open and run portion, where you step through a list of drawings, open them, and then use the command line dynamo run commands to run the Dynamo script. You’ll need to make sure you have your inputs set correctly but this should work to accomplish your goal.

You could also try the Batch Save Utility.

Thank you, this approach worked for me.

1 Like