Revit Batch Processor

Just posted a similar issue on Github for this tool. I seem to be running into an issue where my dynamo graph does not want to run because the Revit Batch Processor could not determine the Run mode of the script. I have doubled checked that I am running 1 version of dynamo and I have even tried running the same graph on different projects and also creating the graph from scratch. Apparently if I can convert to design script I might be able to work around the error. The problem is that I am a novice at design script. I have basic python knowledge. Very basic. I am attaching my graph and corresponding script. Any information is greatly appreciated.Scripting.pdf (436.0 KB)

What is the end goal? To get all linked documents and extract data from them?

The end goal is to create a script that will run in multiple projects without opening the projects. And then save the projects after running the Dynamo script. The purpose of the specific script is to change the Parameter of all revit links to overlay from attachment. I can run the script in the current project and it does exactly what I want it to. Changes from attachment to overlay. The issue I am trying to overcome is trying to iterate that graph through multiple projects. The Batch Processor says that I can do everything from the background if it is a python script (design script). I.E. not having to open each revit file before it executes the script. This would be ideal.

But even if I have to batch open every project as long as I can make the dynamo graph work with the batch processor I will be satisfied.

Opening is a requirement, even if it happens in the background.

Where was the github post? Can you show how the error is triggered?

Also you should know that Python and DesignScript are two very different things.

Here are all the errors I am having.

Here is my starting window for the Batch Processor.
Batch%20Processor%20Window|690x251 !

I am aware that python and design script are different. But design script is python based. no? Please play nice. I am novice at best with python. Ive made a couple small scripts to get odd elements bounding boxes. and added a for loop to iterate through a list of odd elements. Thats the most advanced thing I have done with any kind of scripting.

1 Like

Designscript is its own language. The Python node allows you to import certain functions from the Designscript library (DSCore), but the opposite cannot be achieved. Although the two share many similar concepts (as most languages do) the syntaxes are inherently different.

In regards to your error message, it most likely has to do with the differences between files from Dynamo 2.x and files from 1.x and earlier. 2.x files use a JSON data structure whereas 1.x files use an XML data structure. For example, the header in a 1.x file:

<Workspace Version="1.3.2.2480" X="-2559.42806090032" Y="4133.772744348" zoom="0.60735379785122" ScaleFactor="1" Name="Home" Description="" RunType="Manual" RunPeriod="1000" HasRunWithoutCrash="False">

Notice the RunType=“Manual”. This is most likely what the program is looking for. In a 2.x file this is completely different:

 "View": {
    "Dynamo": {
      "ScaleFactor": 1.0,
      "HasRunWithoutCrash": true,
      "IsVisibleInDynamoLibrary": true,
      "Version": "2.0.1.5055",
      "RunType": "Manual",
      "RunPeriod": "1000"
    }
}
2 Likes

Do the dyn files all open and run fine in Dynamo? If not that would be the first issue to resolve.

Where did you get the batch processor? They may be able to provide insight into the appropriate dynamo file formats.

all dyn’s open and process just fine. I think its a file format issue. The developer sounds like he is working on it. But for practice I would still like to condense my graphs by using more design script. As you can see I have isolated all the rvt links in the doc. But now I want to:

  1. isolate just the revitlinktype’s.
  2. set the parameter “Reference Type” to be a certain value.

If I can do any one of the above things in design script I would be happy. Just for my learning purposes.

From what the developer said you can run .dyn’s or .py’s through the batch processor. But I can not save a portion of design script into a .py can I? I think thats what your telling me gartland… right?

Correct. Trying to put Designscript into a python script would most likely raise a SyntaxError. Also, the way that scripts have to be written to run as a standalone .py (in Revit Python Shell or similar) differs slightly from how they are written within a python node in Dynamo.

Sounds like I need to do some research on Revit Python Shell. Thanks man. Any help on the two items above would be greatly appreciated. Trying to help out my team!

  1. Save the graph (step 3 can occasionally crash due to conflicts in name spaces)
  2. Select a bunch of nodes
  3. Right click on the background (not a node) and choose ‘node to code’
  4. Re-run the graph and verify results match (99% of the time they do)
  5. Update the code as needed to reduce the amount of outputs, reducing the overhead and system requirements in most cases

This example should help. Note that the offsets are not required to read like that, but it helps me understand where in my functions I have gotten. Also some of the coding could be simpler (ie no brackets around the range, the ..1 is also redundant).

1 Like

UPDATE.

Guys,

Learned a little python shell and was able to make a stand alone script out of the dynamo graph above. Here it is. Thank you guys for all the good resources!

First Python w-imports.txt (1.6 KB)

1 Like

Yep indeed it was the difference in workspace file format (xml -> json) that broke RBP. I’ve since updated it. v1.5.1 should work with Dynamo 2+ workspace files now.

1 Like

UPDATE.

Here is the Script that iterates through multiple models using @ElCapitanDan’s RevitBatchProcessor! Finally successful this morning at 1:00AM. Special thanks to @ElCapitanDan, @JacobSmall, @cgartland, and especially thanks to Ehsan Iran-Nejad for the awesome collection of youtube tutorials for the python shell.

https://www.youtube.com/watch?v=vsXsc2PYLCU.

Have not even watched all sessions. Great information!

Best,

BatchPython.txt (2.2 KB)

4 Likes

@n.dull that’s great!

Btw you can remove that GPL copyright notice from the script (or at least put your name in there instead). I’ve accidentally added that notice to the source file for the default RBP task script template in the source code which doesn’t make sense for user-generated task scripts obviously. I’ll remove it from the template scripts for the next version.