Hi
I am trying as a beginner to write c# code in the Revit API
The nice samples in the SDK are reather complex 🙂
A simple thing,I think would be a help for many of us is some simple samples
How to make a filterelementcolloctor with a type and a instants paremeter of the differents categories
maybe how to write to them aswell
Eg.
How to make a filter for systemsfamilies Walls, floors, ceilings, to get one Type and one instans parameter (one sampel, if the metode is the same for several categories)
Hostssweppes
Ramps/Stairs
// For systems families as Floors, Walls, Ceilings, Roofs etc... (Replace the category name)
I do like this:
Make a filter and then get the type from eatch instants
FilteredElementCollector FMFloorCollector = new FilteredElementCollector(OpenDoc);
FMFloorCollector.OfClass(typeof(Floor));
foreach (Floor FMFloor in FMFloorCollector)
{
// Type
Element el = FMFloor as Element; ElementId typeid = el.GetTypeId();
Element floortype = OpenDoc.GetElement(typeid);
Floor_Keynote = floortype.get_Parameter(BuiltInParameter.KEYNOTE_PARAM);
// Instans
Floor_Area = FMFloor.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED);
}
// for Eg beams (StructuralFraming) witch is a component family
ElementClassFilter FM_BeamInstanceFilter = new ElementClassFilter(typeof(FamilyInstance));
ElementCategoryFilter FMBeamsCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_StructuralFraming);
LogicalAndFilter BeamInstancesFilter = new LogicalAndFilter(FM_BeamInstanceFilter, FMBeamsCategoryFilter);
FilteredElementCollector FMbeamcollector = new FilteredElementCollector(OpenDoc);
IList<Element> FMBeams = FMbeamcollector.WherePasses(BeamInstancesFilter).ToElements();
foreach (FamilyInstance FMBeam in FMBeams)
{
// get type parametres use Symbol.get_Parameter(...) to get instants just get_parameter(....)
Beam_Family = FMBeam.Symbol.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_NAME);
Beam_Mark = FMBeam.get_Parameter(BuiltInParameter.DOOR_NUMBER);
// (use the Revit lookup to find the right parameter name, they are nor always logic :- )
}
Does anybody know where a list of all categories can be found ?
Regards
Anders
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear Anders,
Thank you for your query and for posting this as a public discussion thread instead of a private communication.
I try to do nothing at all that cannot be shared and published, and share and publish absolutely everything I work on.
I therefore avoid discussing questions like this, and actually all questions whatsoever, one-on-one.
I prefer discussing everything in public and enabling the entire community to contribute and share:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#1
Discussing questions in public has several advantages. Among others, your peers can join in and help you, and our conversation becomes visible to others, to help them resolve their issues as well.
In this case, I went ahead and answered you on The Building Coder blog last week:
I hope you noticed 🙂
I hope this helps.
Does it?
Best regards,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.