How to get swept or extruded profile from an analytical member?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Analytical members have a section type which points to a family symbol. My interest is to get the curves defining the profile for this section. I have found two different ways Revit section families are created (maybe there are more?):
1) by extrusion of a curve loop of lines, arcs etc
2) by sweeping a profile
For 1) my go-to approach would be to edit the family symbol and get the curves that were extruded. Since I am editing the family and not a specific symbol or instance, will I get the correct curves? Is there a better way of doing that?
//sectionFamilySymbol is the family symbol for the member's section
Document editSymbolDoc = doc.EditFamily(sectionFamilySymbol .Family);
FilteredElementCollector extrusionCollector = new FilteredElementCollector(editSymbolDoc);
extrusionCollector.OfClass(typeof(Extrusion));
foreach (Extrusion extrusion in extrusionCollector)
{
CurveArrArray curves = extrusion.Sketch.Profile;
//do something with the curves
}
For 2) I have found the GetSweptProfile() function here: Revit API docs - Profile class. The example shows the following code. My question is, since this function exists for FamilyInstance only, how can I use it when I have an analytical member that is not actually tied to any structural member i.e., an instance of the family does not exist? Is there a better way of accessing the swept profile?:
FamilyInstance beam = element as FamilyInstance;
if (beam.StructuralType == StructuralType.Beam)
{
Autodesk.Revit.DB.SweptProfile sweptProfile = beam.GetSweptProfile();
Autodesk.Revit.DB.Profile profile = sweptProfile.GetSweptProfile();
}
Developer Advocacy and Support +