Set custom parameter of newly created sheet


#1

Hi,

Sorry if my terminology is a bit off. Im still learning this new language.

QUESTION: Is it possible to set a custom parameter of a sheet at the same time as that sheet has been created by dynamo?

For example, I have an Excel list of Sheets consisting of:

Sheet Number, Sheet Name, Custom Ordering Parameter.

I have dynamo set to create the sheets using the Sheet.ByNameNumber… etc. I also have dynamo set to change the custom parameter using the Element.SetParameterByName node.

The problem is, that because the sheets dont yet exist when I run dynamo, the custom parameter cant be changed. I can solve this by running dynamo twice, once to create the sheets, once to write the parameter.

However, I want to complicate things by having Dynamo create “missing sheets”. i.e. If I add a sheet to the Excel file, Dynamo cross-checks the new excel sheet list to the existing Revit sheet list and creates the new “missing” sheet in Revit. This seems to work fine at the moment, but because I cant write the custom parameter at the same time as the sheet is created my custom ordering gets all messed up if I run dynamo twice.

So is there a way to delay the custom parameter process until after the sheet creation process is completed within the same run time?

I hope this makes sense, I’m not sure if I’m describing it correctly.

Thanks for any help & advice.

ps. In the screenshots the custom parameter (Sheet Category) is directly connected to the Excel list. This is because when I run this process twice all sheets exist in both Excel & Revit, resulting in empty values in the “Find Missing Sheets” group, meaning the custom parameter cant be written from that list.

Capture 1

Capture 2


#2

Research Transaction.Start and Transaction.End. Basically, a transaction is the act of passing info from Dynamo and making changes in Revit. What you need to do is run all of your data into a Transaction.Start - create the sheets - then run the data you need to feed into parameters along with the sheet elements through a Transaction.End and back into another Transaction.Start (don’t forget to end the second transaction as well). If you want to get really fancy, you can toy with some IF nodes that basically will “trip” once the first set of data is run and allow the second part of your definition (the parameter writing) to start.

Note that if you put in two transactions in this manner, it will take 2 undos to reverse one single run of Dynamo instead of one.


#3

Thanks Ben,

Seems sensible enough. Will look into it and see what I can do.


#4

As a extra bit of guidance you may want to have a look at the script i have created for excel to sheet creation, as it checks if the sheet is already created then eliminates it from being created and then also at the end has extra sheet input added after the sheet is created.

 

Hope this helps you as it can be sometimes be good to see one in action, for ideas.

 

https://dl.dropboxusercontent.com/u/17332191/Revit%20Sheet%20Creation%20via%20Dynamo%20V0.2.zip

 


#5

Unfortunately no ‘Kudos’ feature on this forum but thanks Brendan - that’s a very useful document and script… :o)


#6

Wow other Brendan thank you very much.

Thats is going to be a great learning tool for me.


#7

No problem to you both, hope it helps you out by modifying your script or even just to utilise my script in the future.

 

If you notice anything wrong or modifications to it give me a nudge as i will sort/add as soon as i can.