How to use a parametrically modeled element in the API of a plugin in Revit

How to use a parametrically modeled element in the API of a plugin in Revit

Anonymous
Not applicable
591 Views
4 Replies
Message 1 of 5

How to use a parametrically modeled element in the API of a plugin in Revit

Anonymous
Not applicable

Hi everybody! 

 

Hope you're fine! 

 

I have already started programming a plugin in the API. In a part of this plugin, I'd like to import the parametrically modeled elements in the Revit family into the plugin and change their parameters using API. 

 

For example, I have modeled a column parametrically in the Revit family manually; Now, I'd like to have a push-button that when users click on it, the modeled column is imported and its parameters can be accessed through the API (plugin). 

 

Next, I'd like to adjust the parameters of the column through API and change its position in the active document.

 

I would be so happy if someone helps me; I really need it.

 

Kind regards, 

Saeed. 

 

0 Likes
592 Views
4 Replies
Replies (4)
Message 2 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

 

Where do you want to import the modeled column?
Do you want to import the column into the project document or family document?
 
From your post, I assuming you want to import the column family into the project document. Am I correct?
 
This below link will help you to create a push button
 
Create a separate DLL file( for example "ColumnParameterEdit.dll" ) that contains the information about importing the column family and accessing the column's parameters.
 
while creating the pushbutton you have to pass the ColumnParameterEdit.dll file location and the corresponding class name as parameters.
 
for example:
PushButton pushButton = RibbonPanel.AddItem(new PushButtonData("NAME", "TEXT", @"ColumnParameterEdit.dll location", "Class name of ColumnParameterEdit.dll")) as PushButton;
 
When the push button is pressed, the column family is imported into the project and you can access the parameters of the column.
 
Use LoadFamily to load column family into the project  LoadFamily Method (String)  or to load column family symbol you can use LoadFamilySymbol Method (String, String) 
 
I hope this helps.
 

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

Also Please note, In the project document, the instance parameter of an element is accessible only after creating an instance of an element in the project.(i.e)only after creating a family instance in the project.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 5

Anonymous
Not applicable

Thanks a million for your response!

 

Yes, you're absolutely correct. I'd want to import the column into the project document (the Active document of the plugin).

 

The only thing I do in the Revit family is to manually create some parametric models of building elements. When I created a library of these elements, I'd like to use the elements in my plugin (project document) through a couple of push-buttons. 

 

I have already designed the ribbon tap, ribbon panels, push-buttons, and have no problem regarding them. My only problem is about finding access to my parametrically designed elements in the library. 

 

I feel my problem exactly refers to the .dll files you just mentioned perfectly. Is there any example of the .dll files I'm looking for?

 

It would be great if I could have an example to learn more.

 

Thanks again!

 

Kind regards 

Saeed

0 Likes
Message 5 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

I would suggest you create your own dll file to edit the parameter of the column element.
 
There are a lot of blog posts available online that will help you to edit elements' parameters via API.
 
If the element is placed in the project(i.e family instance), you can access both the instance parameter and a type parameter of the family instance
 
 Have a look at this below youtube video.
 
If the element is loaded into the project but not placed in the project,(i.e no family instance), you cannot access the instance parameter of the element.
 
I believe now you know the difference between an instance parameter and a type parameter of an element.
 
There are different ways to get a parameter of an element/element type.
//ELEMENT INSTANCE PARAMETERS
                Element e;
                e.get_Parameter();
                e.GetParameters();
                e.LookupParameter();
                e.Parameters;

//ELEMENT TYPE PARAMETERS
                ElementType et;
                et.get_Parameter();
                et.GetParameters();
                et.LookupParameter();
                et.Parameters;

Similar questions have been previously asked in this forum before.Please search in this Revit API forum.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes