Get SteelElementProperties for the input element if they exist.

Namespace: Autodesk.Revit.DB.Steel
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since:  2019

Syntax

C#
public static SteelElementProperties GetSteelElementProperties(
	Element pElement
)
Visual Basic
Public Shared Function GetSteelElementProperties ( _
	pElement As Element _
) As SteelElementProperties
Visual C++
public:
static SteelElementProperties^ GetSteelElementProperties(
	Element^ pElement
)

Parameters

pElement
Type: Autodesk.Revit.DB..::..Element
The element from which we try to obtain SteelElementProperties.

Remarks

If the input element doesn't have steel informations than it retuns nullNothingnullptra null reference (Nothing in Visual Basic).

Examples

CopyC#
// Starting the transaction, using CYBORG's FabricationTransaction class
using (FabricationTransaction trans = new FabricationTransaction(doc, false, "Create shortening"))
{
   Reference eRef = activeDoc.Selection.PickObject(ObjectType.Element, "Pick a beam to add shortening on it");
   Element elem = null;

   if (eRef != null && eRef.ElementId != ElementId.InvalidElementId)
   {
      elem = (doc.GetElement(eRef.ElementId));
   }

   if (null == elem)
   {
      return Result.Failed;
   }

   // adding fabrication information, if the element doesn't already have it.
   SteelElementProperties cell = SteelElementProperties.GetSteelElementProperties(elem);
   if (null == cell)
   {
      List<ElementId> elemsIds = new List<ElementId>();
      elemsIds.Add(elem.Id);
      SteelElementProperties.AddFabricationInformationForRevitElements(doc, elemsIds);
   }


   // Create the modifier using AdvanceSteel API.
   // For more details, please consult http://www.autodesk.com/adv-steel-api-walkthroughs-2019-enu
   FilerObject filerObj = Utilities.Functions.GetFilerObject(doc, eRef);
   if (null != filerObj)
   {
      if(!(filerObj is Beam))
      {
         return Result.Failed;
      }
      Beam beam = filerObj as Beam;
      Beam.eEnd end = Utilities.Functions.CalculateBeamEnd(beam, new XYZ(10, 20, 20));
      BeamShortening beamShort = new BeamShortening(end, 150.0);
      beam.AddFeature(beamShort);
   }
}
CopyC#
public static FilerObject GetFilerObject(Autodesk.Revit.DB.Document doc, Reference eRef)
{
   FilerObject filerObject = null;
   Autodesk.AdvanceSteel.DocumentManagement.Document curDocAS = DocumentManager.GetCurrentDocument();
   if (null != curDocAS)
   {
      OpenDatabase currentDatabase = curDocAS.CurrentDatabase;
      if (null != currentDatabase)
      {
         Guid uid = SteelElementProperties.GetFabricationUniqueID(doc, eRef);
         string asHandle = currentDatabase.getUidDictionary().GetHandle(uid);
         filerObject = FilerObject.GetFilerObjectByHandle(asHandle);
      }
   }
   return filerObject;
}

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentNullException A non-optional argument was null

See Also