Using Dynamo on *not* active document

Hi,
I am working on a “start up” script for when I receive Revit models from a designer. The workflow I’m trying to automate is 1. open file, 2. detach from central, 3. preserve worksets, 4. relink any other Revit models from the new folder, 5. save as new central

I have successfully completed the steps with individual scripts but am running into a problem trying to combine them. I’m trying to run this WITHOUT ever opening the model (running in a new blank revit project or in Sandbox). However, the relinking of the models part only seems to work when I am actually in the project.

Any thoughts?

**Additional pictures in the comments since I’m a “new user” and cant post more than one image :roll_eyes:

Part 1 success using not active document

Part 2 success only when working in the actual model

I’m thinking the issue is how the Revit links are shown in the active v non active


image

This is literally impossible.

Think of the rvt files like a book which contains all your BIM data. You want to write inside the book, but you are asking to do so without opening the book. It’s an impossibility. You can edit the cover sure, but not the contents of the book unless you open it.

More likely what you are looking to do is open the file for background processing. This is doable with nodes that have a document input, but most do not as Dynamo gets very troublesome when using background processing.

A better solution might be to use a full add-in, Forge Design Automation, or Dynamo Automation.

1 Like

Well yes, I’m opening it in the background. I’m in a blank revit project and running the script on a different model that I have selected with document input. Are you saying the relinking part is impossible? Because the first part of the script I’m able to successfully do, so that is clearly not impossible.

You would need this portion of the graph but with a “Document” input, that is what is missing here. You have to tell it which document to work on, and most nodes default to the active document, and in your case that is the blank file.

@JacobSmall was mostly responding to your comment, which turns out isn’t really what your trying to do, since you are in fact opening it, just in the background.

Again, this will most likely work if you can get a node with a Document input, or modify the one you have since it appears to be a custom node already.

I see, I thought the file path input there was grabbing the document but I understand now its just reporting. I am going to look to the Dynamo Automation Jacob suggested.

If they have to run separately, not the end of the world, I was just doing some development and testing out to see what would work.
Thanks!

There are a lot of things that can happen as I have done a lot of background document work, the main issue I have ran into when trying to do these types of operations on background opens is that any Errors or Warnings on open can cause the active document to switch back to the blank file and no longer be pointing to the opening doc. Not saying that you shouldn’t investigate, but keep in mind that there may be things that pop up you aren’t expecting.

Python would probably also be really good thing to look at here for this if you can.

2 Likes

if you happen to know DynamoAutomation well, I have started another thread related to this issue with my latest problem :sweat_smile: