File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ GET ALL WORKSETS FROM THE CURRENT DOCUMENT
3+
4+ TESTED REVIT API: 2016,2017,2018
5+
6+ Author: min.naung@https://twentytwo.space/contact | https://github.com/mgjean
7+
8+ This file is shared on www.revitapidocs.com
9+ For more information visit http://github.com/gtalarico/revitapidocs
10+ License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
11+ """
12+ from Autodesk .Revit .DB import FilteredWorksetCollector , WorksetKind
13+
14+ # document instance
15+ doc = __revit__ .ActiveUIDocument .Document
16+
17+ # collect user created worksets
18+ worksets = FilteredWorksetCollector (doc ).OfKind (WorksetKind .UserWorkset ).ToWorksets ()
19+
20+ # loop worksets
21+ for workset in worksets :
22+ # print name, workset
23+ print workset .Name ,workset
Original file line number Diff line number Diff line change 1+ """
2+ ROOM TAGS MOVE TO ROOM LOCATION
3+
4+ TESTED REVIT API: 2016,2017,2018
5+
6+ Author: min.naung@https://twentytwo.space/contact | https://github.com/mgjean
7+
8+ This file is shared on www.revitapidocs.com
9+ For more information visit http://github.com/gtalarico/revitapidocs
10+ License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
11+ """
12+ from Autodesk .Revit .DB import FilteredWorksetCollector , WorksetKind
13+ from Autodesk .Revit .DB import Transaction
14+
15+ # document instance
16+ doc = __revit__ .ActiveUIDocument .Document
17+
18+ # collect room tags from active view
19+ tags = FilteredElementCollector (doc , doc .ActiveView .Id ).OfClass (SpatialElementTag ).ToElements ()
20+
21+ trans = Transaction (doc , "Room Tags Relocation" )
22+ trans .Start ()
23+ # loop tags
24+ for i in tags :
25+ # get room location
26+ room_loc = i .Room .Location .Point
27+ # location to move (room location - current tag location)
28+ new_loc = room_loc - i .Location .Point
29+ # move to new location
30+ i .Location .Move (new_loc )
31+
32+ print "DONE!"
33+ trans .Commit ()
You can’t perform that action at this time.
0 commit comments