Export PDF and DWG of Current View to an “export” Subfolder Next to the RVT File in Dynamo

,

Description:

I have a Dynamo script that successfully exports the currently open sheet or view in Revit as both a PDF and a DWG. However, by default the script places these files in the same folder as the Revit project (.rvt).

What I need:

  • Detect the folder path where the active Revit file is saved.
  • Create (if it doesn’t already exist) a subfolder named “export” inside that project folder.
  • Export the PDF and DWG files into this export subfolder, using the sheet name/number (e.g. A101_Totaalblad.pdf and .dwg) for the filenames.

Current workflow:

Problem:
Everything works except the exports still end up in the base project folder instead of the export subfolder.

Question:
How can I adjust my Dynamo graph so that:

  • It reliably recognizes (and creates) the export subfolder next to my .rvt file?
  • It writes the PDF and DWG exports into that export folder, instead of the root project folder?

You’re already supplying a DirectoryPath for both files, so all you need to do is supply the correct one instead. Your “What I need” section already lays out the logic you’re after. Just look into the directory nodes available out of the box (Directory from Path and FileSystem.DirectoryExists should get you most of the way there).

Thank you! It’s working now!