How to start a built-in Revit command for adding a family?

How to start a built-in Revit command for adding a family?

Anonymous
Not applicable
640 Views
3 Replies
Message 1 of 4

How to start a built-in Revit command for adding a family?

Anonymous
Not applicable

In my app I have a function that is
1. Looking in a database for a certain Family
2. Importing the Family
3. Validating some parameters

Now what i need to do next is
1. Make the user interface switch to the Architecture Tab
2. Open the properties dialog box
3. In the properties dialog box the imported Family should be selected
4. and the built-in-command for adding the Family should be initiated just as if the user pushed a button in the Build Panel in the Architecture Tab.

Is that possible?

Regareds
Jan Grenov

0 Likes
Accepted solutions (1)
641 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Jan,

 

Sounds cool.

 

I would say yes, basically.

 

Possibly some research and tweaking of your outlined spec will be required.

 

I thought it was possible to to switch to the architectural tab, but on closer investigation I do not see how, so I may have been mistaken.

 

However, you can check whether the architectural tab is currently active, and prompt the user to switch it on, if not; look at the discipline controls introduced in the Revit 2013 API for that:

 

http://thebuildingcoder.typepad.com/blog/2013/03/whats-new-in-the-revit-2013-api.html > Discipline controls

 

The properties tab should be activated when you select an element. You can select an element via the current document selection set:

 

  selection = uiApp.ActiveUIDocument.Selection;

 

There are various ways to place a family instance programmatically or through the user interface.

 

  • PostCommand Insert
  • PromptForFamilyPlacement
  • NewFamilyInstance

 

Revit 2015 also introduces the Default Type API that may be of use to you when placing instances:

 

http://thebuildingcoder.typepad.com/blog/2014/04/whats-new-in-the-revit-2015-api.html#3.02

 

I hope this gives you a couple of starting points for your further research.

 

Cheers,

 

Jeremy



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

Message 3 of 4

Anonymous
Not applicable
Thanks Jeremy
Lately I have come across a couple of limitations to the Revit API, Maybe this issue adds to the collection, but I have not given up yet. Thanks for your valuable comments. If my investigation results in a solution I will post it here.

Regards
Jan

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Dear Jan,

 

I should not really think that anything in the task you describe should add to that list.

 

You just need to adapt it to the Revit best practices.

 

Determine the optimal workflow through the user interface first and try to follow that programmatically.

 

The Revit API makes it really easy for you to work with the system, and really hard to work against it.

 

That is intentional  🙂

 

Cheers,

 

Jeremy



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

0 Likes