As we got to know what is API, lets understand how to implement communication between User and Revit.
of course saying let's implement something needs some basic understanding, like translating what a statement points to on Revit. What is Document, and what is UI Document. What is Application, and Transaction.... you don't have to worry about all these terms... gradually you will get know how things works. but in order to be fully familiar with Let's API It you need to have a basic understanding of programming, specifically, Object Oriented Programming (OOP).
this is our guy, the Revit Application, which its definition in API is UIApplication. so let's brainstorm your thoughts... What functions expected to be found in this class UIApplication?
...
..
.
Well your guess would be right if you thought of Open/Close Projects/Families..etc. but definitely uiapp has a lot of functions to do. and going through them all we will write millions of posts to cover it all. however, we will keep visiting uiapp through this blog on the necessity to do something.
for now you need to know this is the UIApplication.
but the question could be how on earth i as individual, get an access to tell Revit show me all your mighty?
That is exactly what you need to start to think of "an Access". you need to be aware, that the owner of any Program, if there is a will to let users access their core program function, then there must a design considered for this. meaning there would be no API if originally the application is not designed for that.
Thanks Autodesk for allowing us to do our job the way it suites our needs. you can think of it like the USB Port in your PC. if there is no Port for USB you will never be able to access your USB stick.
I will explain in detail how you setup this access, in another post. but first I need to setup some basic understandings before we start our engine. so please be patient.
What you should also be aware of for now, once Revit starts and loads its Window interface, it starts looking for any available IExternalCommand and IExternalApplication Classes that can be executed. you can think of these two classes as the USB pins, if they match what Revit is looking for, then we have entered Revit World. and as a start Revit instantly sends, its first gift to you, an object called UIControlledApplication.
of course saying let's implement something needs some basic understanding, like translating what a statement points to on Revit. What is Document, and what is UI Document. What is Application, and Transaction.... you don't have to worry about all these terms... gradually you will get know how things works. but in order to be fully familiar with Let's API It you need to have a basic understanding of programming, specifically, Object Oriented Programming (OOP).
UIApplication
UIApplication is the root container of everything in Revit. First you need to think of the computer way of work is like a train. A train moves on rail till it reaches its final destination. and the final destination of a computer work is terminating the application.
See how RevitAPIdoc identify it
Represents an active session of the Autodesk Revit user interface, providing access to UI customization methods, events, the main window, and the active document. You can access documents from the database level Application object, obtained from the Application property. If you have an instance of the database level Application object, you can construct a UIApplication instance from it. ~RevitAPIDoc
this is our guy, the Revit Application, which its definition in API is UIApplication. so let's brainstorm your thoughts... What functions expected to be found in this class UIApplication?
...
..
.
Well your guess would be right if you thought of Open/Close Projects/Families..etc. but definitely uiapp has a lot of functions to do. and going through them all we will write millions of posts to cover it all. however, we will keep visiting uiapp through this blog on the necessity to do something.
for now you need to know this is the UIApplication.
but the question could be how on earth i as individual, get an access to tell Revit show me all your mighty?
![]() |
Googled Image |
Thanks Autodesk for allowing us to do our job the way it suites our needs. you can think of it like the USB Port in your PC. if there is no Port for USB you will never be able to access your USB stick.
I will explain in detail how you setup this access, in another post. but first I need to setup some basic understandings before we start our engine. so please be patient.
What you should also be aware of for now, once Revit starts and loads its Window interface, it starts looking for any available IExternalCommand and IExternalApplication Classes that can be executed. you can think of these two classes as the USB pins, if they match what Revit is looking for, then we have entered Revit World. and as a start Revit instantly sends, its first gift to you, an object called UIControlledApplication.
UIControlledApplication
This is an argument sent from Revit when it successfully get connected to a new addin. It contains very minimal information, but enough to take you inside and setup your program. it allows you to add an icon/Button to your application. when to show your button and when not. additionally some very useful events such as Idling. again we will explain more about these methods and events by time.
RevitApiDoc defined it as
RevitApiDoc defined it as
Represents the Autodesk Revit user interface, providing access to UI customization methods and events.This class does not provide access to documents because it is provided to you through the ExternalApplication OnStartup()/OnShutdown() methods, and those methods are when it is not possible to work with Revit documents. You can work with documents by getting them from the UIApplication class; that class is obtained from events and ExternalCommand callbacks. ~RevitAPIDocwell that's it for now. the next post we will talk about how to setup your program to get connected to Revit.
No comments:
Post a Comment