Unable to import RevitServices in pythonShell


Hi I started to learn python but I have a problem with importing RevitServices in pythonshell. For example in dynamo everything works fine. Am I missing something?

Best to ask in a forum for Python Shell.

RevitServices is specific to Dynamo. You might be able to import it using clr.AddReferenceToFileAndPath by pointing it to the exact DLL in the Dynamo files. Otherwise, you will have to use the RPS-specific method of accessing the document (I haven’t used RPS so I’m not sure how this is done) and manually construct transactions instead of using the TransactionManager from RevitServices.

1 Like

As stated already, this isn’t a RPS forum, but oh well :slightly_smiling_face:.

Take a look here. Nate Miller’s Revit Api notebook is a great resource to get started. It is Mass environment only though. Another excellent resource is the pyRevit channel on YouTube.

Hi @Mo_Ody

You don’t need to access RevitServices in RPS. Often you will not have to import too many libraries as you will in dynamo. API and APIUI will be enough. Also note the global var _revit and _window. These are not set in the dynamo interface. _revit is your access into various revit globals. Here is the typical RPS imports:

And here is Dynamo:

Hope that helps!

6 Likes

@Kulkul you are the king, thanks for that. I googled it all over the internet, but i could not find this information. Hope it helps other users also.

1 Like