Script 2nd run altering results of the 1st run

Hi everyone.
I have a fairly complex script that essentially grabs a selection of elements and makes specific views of these elements a plan view, a side view and a front view, and then it creates a sheet and places the corresponding views on each sheet aligning the views to predetermined parameters.

I am currently facing 2 challenges and I don’t even know where to start, the node I am Using is the Sheet.ByNameNumberTitleBlockAndViews, I generally run the script for separate parts of my drawing for various reason. But on my second batch, some overwrite the first, that sheet name is changed and replaces the previous one but I end up with views for both pieces in on sheet. like so:
shop
The original was like:
shop2

The second problem I am facing with this same script is for face-based or workplane-based families. These families are rotated or in an angle (see the first picture) but I would like to have the views as if they weren’t. Like a shop drawing or and assembly.

Is it possible?

Thanks!

Hi,

OOTB nodes have Element binding.
You can close the graph after the first placement of views and reopen the graph for the second run.
The best solution is to use Dynamo Player.

Hi Alban, Thanks for the info. I am actually doing that. But getting the same behavior, if I use the Dynamo player it erases all my other sheets and creates the news ones.

I figured out how to align the sections to match the views the way I needed.
Get the transform for the coordinates and replace X o Y vector on the node by the Z transform (Its an XYZ, do to an Vector.byCoordinates(Ztransform.X, Ztransform.Y, Ztransform.Z) or the Y tramsform, etc.

Depending on the view you need to change these parameters.
Now I still need to find a way to have Dynamo and Dynamo player not changing the current sheets but instead only adding new ones.

P.S: I am using the create Element View node from the BIM4Struc to create the views. It can be done using python as well.

You need to clear the Element Binding out of the file, and then only create the elements via Dynamo Player, or create them from Dynamo Revit but don’t save the file between runs.

If you upload the dyn I can clear the element bindings for you.

I appreciate it Jacob.
Shop Drawings Walls.dyn (201.5 KB)
Shop Drawing Roofs & Floors.dyn (176.1 KB)

there you are.
It happens via Dynamo player as well.
Or at least it is happening, does Revit have a limit in the number of sheets, and it is overwriting the sheets?

Thanks again.

There are no element bindings in the file you sent me, and I’m not entirely sure how to recreate a Revit file for their use - can you send me a very basic file to test it on so I can verify the behavior you’re seeing and provide the resolution?

Jacob do you think Revit have a limit on the number of Sheets?
Because if I run it for like 10 sheets it work fine, but if I do it for 200 them it overwrite the current ones.
I will prepare a file to send you.

No, it does not.

the files you asked https://drive.google.com/open?id=1tsJ4QyBA3r-85cRqbV4FJMpV4U1HWbYV

Using the “Shop Drawing Roofs & Floors” graph you provided, I can’t recreate the behavior when executed entirely via Dynamo Player, each and every time.

However, if I run first though Dynamo (causing view and sheet creation), then save the Dynamo graph, and then run the graph with Dynamo Player you’d see the result you’re describing, on the initial and each successive run. It’s also slower (as a result of the element binding).

I also wanted to point out that the ‘Select Model Elements’ feeds into a python script which is only configured to work with a single item. Of course doing this means you’ll need to ensure you build a flat list of the selected elements to ensure you pass a list when sending a single element.

You may also want to take the time to adjust the order of your inputs. Copy paste them and rewire (hold shift before selecting the wires going out of the previous node and you can move all outputs from the previous node to the new one).
Replacing the selection node in this way, not selecting any elements, running the graph, and then saving will also remove the bindings from this file.

I did not check to see if this holds true for both graphs you provided, but I did push the limit and hit run in Dynamo Player using a version of the graph with modified Python, no element bindings, and adjusted input order, with a selection set of 158 floor and roof panel elements. Five minutes into the run ang going strong, and it’s late here so I likely won’t wait up for results, but I hope to see completion in the morning. Runs smoothly when using up to 22 elements though.

No sooner than I went to put the laptop down I got an error message - you have duplicate marks so you’re getting duplicate view and sheet names, causing… something like 258 error messages and a whole lot of added computational runtime. Adding unique marks had the graph run to completion, creating 465 views and placing them on 155 sheets, 3 views and 1 sheet for each of the wall and roof panels in less than 3 minutes.

Yeah, I am sorry for that, I want to find a way to mark panels automatically but the position, level and order of placement play a role in the marking of each panel due to assembly.

If i could select them in a ordered manner without picking select them, this problem could be easily corrected.
But using pick select to select this many elements, sometimes you miss-click something without realizing it. Is it possible to add a counter in the pick select routine? That and having the selected panels highlighting would do it as well.

Thanks for you feedback Jacob. It helps a lot.

Sorry but about the order of inputs, is that the user alterable inputs or inputs for a specific node?
And why do I need to alter them? Another thing is, how did you got it to run so fast? Here is a good 15min each time for this many panels.

Thanks again Jacob.

The user driven inputs (offset and such). They show up fine in Dynamo Player, but somewhat out of order, and the order is determined by the order in which they were placed, so copy/pasting them and rewiring will resolve the order.

I just did a screencast of the process, showing the inputs used and the full graph run from start to finish, with 155 elements. I did not show the inner workings of the graph though. Total video length is 3:10. With further optimizations of the graph (inline design script functions, custom nodes, or python use) you might be able to get the time down further. Link will be here once it’s processed (the server that processes uploaded videos can be slow, give it a bit before you check): Screencast Title

Any chance you can send me your version of the script? With the optimizations you did, so I can compare and learn?

Most of what I did you won’t see - I re-aligned the nodes I replaced as I replaced them. The big change was in the python, setting it to work with a list (and only a list) to ensure multiple selections work. I assume you have that already? If not I can upload that code later.

Yeah I changed that python node already.
It work with both a list and a single item.

But it is taking me a good 25min + to run it for just the roof panels. MY computer has a core i7 7820HQ and 16Gb of ram, and it is taking a good chunk of those resources, to run everything.

Which Revit and Dynamo version? Could be that your project hasn’t optimized the roof panels in terms of the marks? Or maybe you’re selecting stuff you shouldn’t be? Note that there are a few model lines which may be complicating things.

I am running Revit 2019 and Dynamo 2.01. Yeah I have a view with all the model lines and the roof model Hidden so they should not be the culprit. The script runs ok, no errors or warnings, just a fair amount of time to run it.