How to select and understand the Library?

Hi All,
I like to understand the selection of library while starting a particular script in python.

For Example.

import clr
import math
clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.DB import *

app = revit.Application
doc = revit.ActiveUIDocument.Document

Thanks to Nathan.

How he selected Revit API, RevitAPIUI as reference. or in other words how to check what is the use of that reference.

Is there any Basic Revit API reference document/video for Python(I can understand the workflow and scripting).

Thanks all.

1 Like

Hello Rajkumar!

This article explains a lot when it comes to how dynamo works with the revit api: https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration#revitapi

The Revit API uses .NET assemblies to give access to functionalities in the program, these assemblies are .dll files. RevitAPI.dll and RevitAPIUI.dll are files that can be found in the Revit program folder.

To use .NET with python Dynamo uses a variant called IronPython. How clr and clr.AddReference work is explained in the IronPyton documentation: http://ironpython.net/documentation/dotnet/

Finally when you do from Autodesk.Revit.DB import * you import all the classes in the Autodesk.Revit.DB Namespace, and thats where most of the Classes (Methods etc.) you can use in Revit are. Se all classes in DB here: http://revitapisearch.com/html/87546ba7-461b-c646-cbb1-2cb8f5bff8b2.htm

6 Likes

@Einar_Raknes Great Link ! thanks!

Thank you very much Einar…

Thanks Einar for the response and links!

In addition to the above, these examples may be of use to you as they describe what is happening.

The repo was started by Sol and has a few contributors.