Hello Dynos,
I know it is basic question… but what do I wrong? is there a basic frame? or a missing library additional to the Code?
It doesn`t find libaries? some blockes are not defined?
How use I a code in a correct way: http://www.revitapidocs.com/code/ ?
You should paste your code here so we can see it ,or at least provide a screenshot of your python code.
“”"
GET ALL WORKSETS FROM THE CURRENT DOCUMENT
TESTED REVIT API: 2016,2017,2018
Author: min.naung@https://twentytwo.space/contact | https://github.com/mgjean
This file is shared on www.revitapidocs.com
For more information visit http://github.com/gtalarico/revitapidocs
License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
“”"
from Autodesk.Revit.DB import FilteredWorksetCollector, WorksetKind
document instance
doc = revit .ActiveUIDocument.Document
collect user created worksets
worksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset).ToWorksets()
loop worksets
for workset in worksets:
# print name, workset
print workset.Name,workset
The errors came from the underlined libraries I use dynamo 0.9 … Revit 2016
Hi @Draxl_Andreas ,
The code above is likely created for Revit Python Shell, and not Dynamo. The code itself will work in a python node, but the imports needs to be tweaked.
Search this forum for any posts that includes the imports in a python node. Place the imports in the code you’ve posted and remove everything before the “#collect user created worksets” line.
Good luck
1 Like
Thank you very much! I am Architect and i am not a native-speaker regarding Revit-Python-Dynamo - so your answer is a good answear!
3Pinter
February 14, 2019, 3:14pm
6
If you aren’t speaking Revit python dynamo: I’d suggest you start with dynamo and some useful packages.
Clockwork has a node that returns all the Worksets
GeniusLoci has a similar node too.
1 Like
…so I almost done look:
I am able to list the worksets but not with the name! So how should be the chances in my script
The script Dynamo primier helped me a lot! http://primer.dynamobim.org/en/10_Custom-Nodes/10-4_Python.html
Thank you
KR
Andreas
…you have right! but i want to understand, i would like also do costumize stuff - I try to learn first and not just doing stuff- In spite of that thank you very much for the packages!
3Pinter
February 14, 2019, 3:56pm
9
As you wish, but do remember that you inspect custom nodes.
Anyways:
Your final loop looks strange: Try this.
wsnames = []
for workset in worksets:
wsnames.append(workset.Name)
OUT = wsnames
1 Like
Hi,
I’m glad you now have a script that works.
To clarify what @3Pinter has written, there are many possibilities with existing packages.
1 Like