I can't retrive a StructuralSectionShape valid

I can't retrive a StructuralSectionShape valid

Anonymous
Not applicable
742 Views
2 Replies
Message 1 of 3

I can't retrive a StructuralSectionShape valid

Anonymous
Not applicable

The solution of https://forums.autodesk.com/t5/revit-api-forum/get-section-of-familysymbol/m-p/8495734 does't work in my case: I allways get a StructuralSectionShape.NotDefined

This is my code:

public static void GetMaterialFormaSeccion(Family family, FamilySymbol symbol, out StructuralMaterialType mater, out StructuralSectionShape shape)
{
    StructuralSection ss = null;
    Parameter para = null;

    //Default values
    mater = StructuralMaterialType.Undefined;
    shape = StructuralSectionShape.NotDefined;

    if (family == null && symbol == null)
        return;
    if (family == null && symbol != null)
        family = symbol.Family;

    //Material
    if (family != null)
        mater = family.StructuralMaterialType;

    //1.- From family
    if (family != null)
        shape = family.StructuralSectionShape;

    //2.- From StructuralSection
    if (shape == StructuralSectionShape.NotDefined && symbol != null && (family == null || family.CanHaveStructuralSection()))
    {
        ss = symbol.GetStructuralSection();
        if (ss != null)
            shape = ss.StructuralSectionShape;
    }

    //3.- From Parameters
    if (shape == StructuralSectionShape.NotDefined && symbol != null)
    {
        para = symbol.get_Parameter(BuiltInParameter.STRUCTURAL_SECTION_SHAPE);
        if (para != null)
        {
            if (para.StorageType == StorageType.Integer)
                shape = (StructuralSectionShape)para.AsInteger();
        }
    }
}

I've tried this code with many structural column families (steel and concrete ones) and allways returnes 'NotDefined'.

In particular, ss is allways null. And with STRUCTURAL_SECTION_SHAPE, Parameter, para.AsInteger() is allways zero (the value of 'NotDefined').

 

0 Likes
743 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

As far as I know, I think "STRUCTURAL_SECTION_SHAPE" property is available or valid only for Structural Column(Steel) and it is not available for Structural Column(concrete).

 

Is your Revit file consists of only Structural Column(concrete)?

 

If yes then you will always get the parameter value as "NOT DEFINED".

 

I have written a code which filters all the columns present in the project and check for the valid value for the parameter "STRUCTURAL_SECTION_SHAPE"

FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType();  
            
                foreach(Element e in collector)
                {
                    FamilyInstance FI = e as FamilyInstance;
                    FamilySymbol FS = FI.Symbol;
                    StructuralSection SS = FS.GetStructuralSection();
                    if(SS!=null)
                    {
                        //AREA
                        double area = SS.SectionArea;

                        //Structural section shape parameter
                        Parameter p = FS.get_Parameter(BuiltInParameter.STRUCTURAL_SECTION_SHAPE);
                        if(p.AsValueString()!="Not Defined")
                        {
                            string elementName = e.Name;
                            string elementShape = e.get_Parameter(BuiltInParameter.STRUCTURAL_SECTION_SHAPE).AsValueString();
                        }
                    }
                }

 

I hope this helps.

 

If this helped solve your problem please mark it as a solution, so other users can get this solution.

wellSmiley Happy


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

Anonymous
Not applicable

Well, my real problem is that concrete rfa files (structural columns and Structural Framming) contains very few symbols (3 or 4) and I need to create new symbols by duplicating and modifying its dimensions, and I want to know if the rfa file representes a rectangular, circular o T shaped structural section so I can modify the correct dimensions by modifying the corresponding parameters before I create a FamilyInstance in the project.

0 Likes