(stretch) We are finally out of the box!
Prior to Revit 2008, Revit developers were kept in a fairly narrow box... You could only be added to the Tools + External Tools menu, and you could only be run when Revit was in "Modify mode" in the context of a document. The straightjacket was on!
As of Revit 2008, that's now gone... and while you don't have complete carte blanche to work in the application level, there are a variety of critical steps:
ExternalApplication
There is now the concept of External Applications, which are started when Revit starts (and shutdown when Revit shuts down). There are also now application level events for keeping tracking of when documents are created, opened, saved (which are important for a wide variety of applications which try to synchronize BIM data).
User Interface
External Applications can add both menus and toolbars. Menus can be added to the top level, or wherever you would like within Revit.
Document Control
From the application, you're now able to do several key things which were previously impossible:
- Open a specific Revit file
- Start a New Project from a Template (can you say "configurator"!?)
- Start a New Family Document
- Start a New Template
Also at the application level, event trapping is available for things like "OnNewDocument" "OnSaveDocument", "OnCloseDocument"...
(In this series of postings, I'll continue to provide short commentary on what's new in the Revit 2008 API, and why I think it's interesting).
8 comments:
Hi,
I'm wondering how do you "Start a New Family Document"
Thanks in advance!
There is a method in the Revit Application class called "NewFamilyDocument( templateFileName )".
Best Regards,
Matt
Wow,
that's easy, thanks a lot!
Hey,
It's me again, I'm having problem getting this to work with "ExternalCommandData" in VB. Can you please give me some sample if you have. Thanks again for your help!
Hi, is there a way to open a Revit project file in background, without a document attached to it, and without a window opened for it?
Thanks.
I'm not sure if I completely understand your question...
You can open a document "in the background" just using the Application.OpenDocument(...) method.
But that doesn't sound like exactly what you're looking for?
RevitAPI:
"Application.OpenDocumentFile(String fileName)
Remarks
It is correspond to the File->Open...."
By "background" i mean opening, working and save a document (family, project, ...) without a UI effect. No window opened in Revit application, so the user will not be aware about the document modification.
Ah - ok, so it is what I was thinking...
My impression is that using Application.OpenDocument() does not have any impact on the Revit UI - so it is basically running "in the background".
There is definitely no way to change the "ActiveDocument" inside of Revit (I confirmed this with ADN last week).
-Matt
Post a Comment