Looking for a Guide for Revit Libraries in Pythonshell

babysatch
Advocate
Advocate

Looking for a Guide for Revit Libraries in Pythonshell

babysatch
Advocate
Advocate

Hi,

 

I have noticed often, that people add a reference in their python code in Dynamo to RevitServices by the following code in order to use DocumentManager and TransactionManager:


'# Import DocumentManager and TransactionManager
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

 

Does anybody have an idea where I can find all methods, properties and members of the Revit librares "RevitServices" and "RevitNodes". I cannot find them in RevitAPI.chm.

 

Thank you.

0 Likes
Reply
3,257 Views
2 Replies
Replies (2)

jeremytammik
Autodesk
Autodesk

I would suggest you discuss this with the creators of RevitPythonShell, either in its GitHub source repository, or on StackOverflow, as explained there:

 

https://github.com/architecture-building-systems/revitpythonshell

 

https://github.com/architecture-building-systems/revitpythonshell#support

 

Happy New Year to you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

office
Enthusiast
Enthusiast

babysatch,

the problem you are addressing is not a problem of a lack of documentation of the revit api nor is it an issue resulting of the use of the revit python shell as jeremy suggests.

the dynamo addin (application) implements a own document manager and a own task manager. why this is done? consult the dynamo branch on github.

 

if you now have a python code that accesses a document (what you most certainly will do) or make changes to the revit database you have different options depending if you are in a dynamo environment or not..

i.e python shell.:

import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')

#.......

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

#.......any code to get an elementid

wall = doc.GetElement(element.id) t= Transaction(doc,"set wall parameter") t.Start() wall.LookupParameter("Any shared Parameter").Set(value) t.Commit()

dynamo python code:

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument #...... wall = doc.GetElement(element.Id) TransactionManager.Instance.EnsureInTransaction(doc) wall.LookupParameter("Any shared Parameter).Set(value) TransactionManager.Instance.TransactionTaskDone() OUT = wall

best peter