PDA

View Full Version : How can I get a OST_Railings Category Reference...



julien.duprat
2008-07-03, 01:34 PM
I try to get a OST_Railings Category Reference...

I have two ways to do this :

First Way :

method

public static Category GetCategoryReference(Autodesk.Revit.Application revitApp, BuiltInCategory bic)
{
Filter filter = revitApp.Create.Filter.NewCategoryFilter(bic);
ElementIterator itor = revitApp.ActiveDocument.get_Elements(filter);
while (itor.MoveNext())
{
Element currentElement = itor.Current as Element;

if (currentElement != null && currentElement.Category != null)
{
return currentElement.Category;
}
}
return null;
}

Call : c = NovaExporterForRevitHelper.GetCategoryReference(revitApp, bicTemp);


Second Way :

method :

public static Category GetCategoryReference2(Autodesk.Revit.Application revitApp, BuiltInCategory bic)
{
CategorySet catSet = revitApp.Create.NewCategorySet();
return revitApp.ActiveDocument.Settings.Categories.get_Item(bic);
}

call : c = NovaExporterForRevitHelper.GetCategoryReference(revitApp, bicTemp);

First Method works with a lot of BuiltInCategory : Walls, Views....

But it don't work with OST_Railngs...

Can you help me ???

Thanks a lot.

julien.duprat@bewise.fr

GuyR
2008-07-03, 11:40 PM
try this BuiltInCategory.OST_StairsRailing

julien.duprat
2008-07-09, 02:01 PM
Hello Guy_R,

You're right, the BuiltInCategory "OST_StairsRAiling" works for object type of "Railing".

Thanks a lot for your answer !!!

Have you any idea about my question for getting texture's object ?

Thanks again a lot !!!!

julien.duprat@bewise.fr