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.
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.
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.
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.