Associate railing category a shared parameter from api

Associate railing category a shared parameter from api

Anonymous
Not applicable
621 Views
3 Replies
Message 1 of 4

Associate railing category a shared parameter from api

Anonymous
Not applicable

I created a routine to create a shared parameter (param1), I need to associate this parameter to the railing category but does not show the category associated with the parameter, I bear this code:

 

Autodesk.Revit.ApplicationServices.Application app = (Autodesk.Revit.ApplicationServices.Application)sender;

Document doc = e.Document;

 

DefinitionFile sharedParametersFile = OpenSharedParamFile(app);

DefinitionGroup eBIMgroup = OpenGroup(sharedParametersFile);

Definition definition = OpenDefinition(eBIMgroup);

Category Railings = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Railings)

ategorySet categoryset = app.Create.NewCategorySet();

categoryset.Insert(Railings);

Transaction tran = new Transaction(doc, "Parametro");

tran.Start();

Autodesk.Revit.DB.Binding binding = app.Create.NewInstanceBinding(categoryset);

doc.ParameterBindings.Insert(definition, binding, BuiltInParameterGroup.PG_TEXT);

tran.Commit();

 

 


when I write code "BuiltInCategory." Several options appear which is correct?

Tranks, I hope you can help me!

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

rosalesduquej
Alumni
Alumni
Accepted solution

Hi Marcos,

 

I'm not too familiar with the Railings from the API, But I found a post by Jeremy, Have you seen it before? I see he uses OST_StairsRailing as his BuiltInCategory After he Investigated with the RevitLookup Tool, Have you tried that?

 

http://thebuildingcoder.typepad.com/blog/2011/07/retrieve-railing-elements.html

 

Hope it helps,

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
Message 3 of 4

Anonymous
Not applicable

rosalesduquej:

I not visited thebuildingcoder.com for not view this post I saw the post on page thebuildingcoder.com you indicate. in this post it is what I wanted.

 

Category Railings = doc.Settings.Categories.get_Item(BuiltInCategory.OST_StairsRailing);

 

Thanks for help me

 

0 Likes
Message 4 of 4

rosalesduquej
Alumni
Alumni

Hi Marcos,

 

You are very welcome, Glad it worked for you. 

 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes