# Create SheetSet from Sheet grouping

**URL:** <https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217>\
**Category:** Packages\
**Created:** [March 19, 2015, 5:21am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217 "2015-03-19T05:21:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Hutton](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Colin\_Hutton](https://forum.dynamobim.com/u/Colin_Hutton)\
**Post date:** [March 19, 2015, 5:21am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/1 "2015-03-19T05:21:53Z")

</div>

Hi All

I have added a parameter to my Sheets so that I can filter my Sheet Views by that parameter, say sorting A,B,C,D etc

So each of the groups contain some Sheets.

Is there anyone I can create Print Sets ( SheetSets ) From each of the groupings ? For the purpose of selecting that list when it comes to Print or Export those sheets.

Thanks in Advance

Colin…

---

<div class="post-metadata">

**Author:** ![Timothy\_Logan1](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Timothy\_Logan1](https://forum.dynamobim.com/u/Timothy_Logan1)\
**Post date:** [March 19, 2015, 8:01am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/2 "2015-03-19T08:01:05Z")

</div>

Here’s a quick python node that lets you create sheet sets.

![SheetSet](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/b/bae1ef87ed53740c953a8ab09e8bb08ae92ad85e.png)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

import clr  
clr.AddReference(‘ProtoGeometry’)  
from Autodesk.DesignScript.Geometry import \*

clr.AddReference(‘RevitAPI’)  
import Autodesk  
from Autodesk.Revit.DB import \*

clr.AddReference(‘RevitServices’)  
import RevitServices  
from RevitServices.Persistence import DocumentManager  
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

sheets = IN[0]  
sheetSetName = IN[1]

viewSet = ViewSet()

msg = “Failed to create sheet set.”

# try to add all of the sheets to the set

try:  
for vs in sheets:  
view = UnwrapElement(vs)  
viewSet.Insert(view)

# If there’s one item in the set, just add the one

except:  
view = UnwrapElement(sheets)  
viewSet.Insert(view)

# Get the printmanager to add the view set to.

printManager = doc.PrintManager  
printManager.PrintRange = PrintRange.Select

# create the ViewSheetSetting to append the viewset.

viewSheetSetting = printManager.ViewSheetSetting  
viewSheetSetting.CurrentViewSheetSet.Views = viewSet

# Create the Sheet Set

trans = Transaction(doc, “Create View/Sheet Set”)  
trans.Start()  
try:  
viewSheetSetting.SaveAs(sheetSetName)  
msg = “Sheet set '” + sheetSetName + “’ created.”  
except:  
msg = “Failed to create sheet set”  
trans.Commit()

#Assign your output to the OUT variable  
OUT = msg

---

<div class="post-metadata">

**Author:** ![Colin\_Hutton](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Colin\_Hutton](https://forum.dynamobim.com/u/Colin_Hutton)\
**Post date:** [March 19, 2015, 9:13am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/3 "2015-03-19T09:13:39Z")

</div>

Timothy, many thanks for that. After having to retype a lot of it because simple copy paste Doesn’t work from this site :/, thought I’d give you some feedback on it.

I’m using 0.7.5.3566 btw

&nbsp;

I set it up the way you suggested, it all works fine without error, but didn’t actually generate the Sheet Set, I restarted Dynamo etc, Reloaded DYN file etc … No change…Working ok on your own files ?

I even tried using an Element Type ( ViewSheet ) to begin with.

I don’t know if it’s what I was looking for though ? Basically a Creation of a View/Sheet Set based on a parameter on the actual sheets. So if I had that parameter ( Call it Issue\_ID ) which was set to “FIRST”, then it would create a SheetSet based on those sheets which has “FIRST” as the Issue\_ID, and so on…

&nbsp;

---

<div class="post-metadata">

**Author:** ![Lejla\_Secerbegovic](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Lejla\_Secerbegovic](https://forum.dynamobim.com/u/Lejla_Secerbegovic)\
**Post date:** [July 8, 2015, 8:24am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/4 "2015-07-08T08:24:28Z")

</div>

Hi guys,

I’m trying to do a similar thing, after filtering my views according to their parameters using dynamo, I’d like to create separate Sheetsets for these. Actually I got it working so far, however I don’t like the fact that if I want to update the sheetset I get an error message (since the set is already existing).

I’m looking for a way to either update a sheetset - or delete it if it already exists. Any thoughts on this?

Btw, here is a screenshot of the working script (in 8.1) - take care of the intends after try: (copy/paste of the script above didn’t work with me either because of the formatting)

Thx, Lejla

![08-07-2015 15-49-31](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/d/d9cdecfd5640b3431f7b96e11b032b7be36347fb.jpg)

---

<div class="post-metadata">

**Author:** ![Giovanni\_Succi](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Giovanni\_Succi](https://forum.dynamobim.com/u/Giovanni_Succi)\
**Post date:** [September 28, 2015, 3:20pm UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/5 "2015-09-28T15:20:33Z")

</div>

Hello,

the above does not work for us. The script returns the success message but we cannot see any new sheet set created.

&nbsp;

Any news on this script?

Dynamo 0.8.2.2392 on Revit 2016

&nbsp;

thank you

&nbsp;

Gio

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [September 28, 2015, 10:15pm UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/6 "2015-09-28T22:15:31Z")

</div>

Hi,

I recently needed that same functionality. The node is called “ViewSet.ByViewsName” and is found in the spring nodes package. It has a safety switch that is set to not overwrite by default.

![2015-09-29_10-29-15](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/f/f6dcc55cf3e2d2750bd5d7da656393bacf817fae.png)

&nbsp;

---

<div class="post-metadata">

**Author:** ![Giovanni\_Succi](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Giovanni\_Succi](https://forum.dynamobim.com/u/Giovanni_Succi)\
**Post date:** [September 29, 2015, 11:48am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/7 "2015-09-29T11:48:58Z")

</div>

Okay, I managed to have the script work (partially). Besides the quotation marks coming in the wrong ASCII character (from the script posted online), Dynamo was also complaining about the indentation of some of the lines of the script. I thought indentation was more of a human visual aid more than a programming syntax…

Anyways, the script now works, but every other time I launch it. See the screen capture:

![9-29-2015 9-16-56 AM](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/0/0e6470eb8d22c1b0b2ea5d9d16af072dc5d19864.png)

When I first launch it I get this error:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.  
Traceback (most recent call last):  
File “\<string\>”, line 42, in \<module\>  
Exception: Starting a new transaction is not permitted. It could be because another transaction already started and has not been completed yet, or the document is in a state in which it cannot start a new transaction (e.g. during failure handling or a read-only mode, which could be either permanent or temporary).

So I go to line 42 and take that blank line out, as in the following screen cap, so that " trans.Start()" is attached to the previous line:

![9-29-2015 9-23-41 AM](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/1/1f8a081326c12bd5f4362f13bfd95a7fb8ee411d.png)

and it works…

However, next time I launch the script again, it produces the same error, and I have to reintroduce the blank line, so that the line " trans.Start()" is at 42 again…

Basically I have to move back and forth the “Trans” line from line 41 and 42 each time I run the script…

Any idea on what’s going on?

PS: even adding two blank lines works…

---

<div class="post-metadata">

**Author:** ![Ben\_Barfoot](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@Ben\_Barfoot](https://forum.dynamobim.com/u/Ben_Barfoot)\
**Post date:** [December 16, 2015, 8:23am UTC](https://forum.dynamobim.com/t/create-sheetset-from-sheet-grouping/1217/8 "2015-12-16T08:23:56Z")

</div>

Hi, This is how i got it to work. Now looking at how you can update a print set. ![Capture](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/e/e31b68c4cd814858274f0ef75b21c33de622f4c0.jpg)
