I have the need to create a script that would accomplish the following:
Refer to an excel spreadsheet that would have values of Revit categories in one column, and in the other column a workset name
Then in Revit I would need to create the worksets contained in the excel file
After that, I would need to change the workset of all elements in each category listed to the workset name that corresponds in the column next to it in the excel file.
I know this is crazy, but its a client requirement in one of our large overseas projects. As far as I can see the API does not allow the creation of worksets, only reading ones that already exist. I am just checking here first to see if anyone has a workaround or different way to tackle this problem. I am new at programming so the API and Python are kind of beyond reach at the moment.
As a rule of thumb, you can assume that anything Revit-related (i.e. creating or manipulating Revit elements) that you cannot do with the Revit API cannot be done using Dynamo either. So if there’s no support for creating worksets via the API it will not be possible in Dynamo either. Or at least that’s how I understand it…
Ok, makes sense.
I will create the worksets manually, but now I have hit another roadblock. I am trying to set the workset of instances of a certain category, and I keep getting the error that the workset parameter is read only. Is this another limitation?
It works fine when I use the select by type nodes, but with the select category nodes it creates the read only error. The reason I can’t do it by type is that certain categories, like doors, don’t show up on the list.
workset is not a parameter to be set with this node. it is a BuiltIn parameter, so you have to deal with a Python+API node to achieve this. possible though as described in this post from the building coder: http://thebuildingcoder.typepad.com/blog/2013/01/change-element-workset.html
Yes, you can set the workset from Dynamo without use of the API. Problem that I am seeing in your definition is that you are using a “Number” node (in programing its a double) to set the workset while per API it requires an Integer. Give that a try and let me know if it works.
<p style=“text-align: center;”></p>
Does not look like it worked.
I think you need to get the “Set List Instance Parameter” node first. Also it looks like you have 2 worksets created and you want to add your walls to the second workset . Shouldn’t your integer slider be set at 1?
Works great for me. Parameter name “Workset” has to be localized, “Sous-projet” here in France.
No, the idea is that you use the Integer value of the workset ID not its position on a list. See Juline’s comment below for a fix.
I tried it with in integer slider but it did not work either. FYI it works with the set by category nodes. I tried it with walls successfully. The problem is I’m trying to do doors, and it gives me the error when I use by type. Maybe it’s a system family vs component family thing. Also I’m using 6.3, are you guys using 7.0?
Well it works for me, and with doors as well. Here’s a screen capture to prove it:
Oh, and one more thing. Make sure that you are trying to change the workset on doors that actually exist in your model. Selecting doors by type will get you a list of ALL doors that are in the project, regardless of whether they are actually placed. Try it with Get Family Instances by Category, that makes sure that doors are actually instantiated in the model. Good luck!
This worked, thanks! It looks like the problem I was having is that I did not have some of these packages installed. Once I downloaded them I was able to match your definition.
One snag I have come across is that in 0.7 the GetWorksets node does not work at all and returns a null result. In 0.6.3 GetWorksets works, but it seems buggy. When I initially placed it I got the worksets listed, but when I closed Revit and reopened the same file, it started giving me a null result.
I sure wish there was a node that gave you a drop down of the worksets in the model. That would be helpful.
All of the nodes that I have written were written in 0.6.3 and never tested on 07.0 platform. I would not be surprised if they did not work. I am sorry about that, but as it is right now I have no plans of re-writing them for the newer platform. Also, since this is an open source project feel free to add a drop down node that will let you choose a workset. I am sure that Dynamo community will be thankful for every improvement. Good luck!
Thanks for your help. I understand if you don’t want to update the nodes for 0.7. From what I can tell it seems to be the references in the Python code to the LibGNet library dll that is no longer called the same name in 0.7. I tried changing it to the names of the LibG dlls included in the folder but none of them work.
Unfortunately I don’t know how to program so I am pretty much limited until I get around to learning it. Cheers.
So the question still remains: How to create a new workset with Dynamo? Also does someone know how to create a node with a dropdown that will automatically populate with the current file’s worksets?
Workset standards are becoming really important in project workflows in organizing data for interoperability.
Well, that first question was actually answered at the very beginning of this thread. The Revit API doesn’t allow for the creation of new worksets, therefore Dynamo can’t do it either.
Regarding your second question - you would have to code that node in C#, compile it etc. But the documentation (https://github.com/DynamoDS/Dynamo/wiki/Getting-Started-with-Dynamo-Development) is out of date, so good luck.
I think currently your best bet is to select a workset by name (get all worksets, get their names, find the one you’re looking for). There are some packages that do similar operations (i.e. selecting something by name) on the package manager, just search for “by name”.
Andreas, is this still true? I was talking with another developer today about another topic and they mentioned they thought worksets could be created via the API now. Any additional thoughts?
Yes, as of Revit 2015 you can create worksets via the API.
(To be a little more precise: This was introduced with the subscription update aka Revit 2015 R2…)
Rhythm now has a node for that
Great work John, it does the job nicely: