Get SteelElementProperties for the input element if they exist.
Namespace: Autodesk.Revit.DB.Steel
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:
2019
Syntax
Remarks
Examples
CopyC#
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;
}
SteelElementProperties cell = SteelElementProperties.GetSteelElementProperties(elem);
if (null == cell)
{
List<ElementId> elemsIds = new List<ElementId>();
elemsIds.Add(elem.Id);
SteelElementProperties.AddFabricationInformationForRevitElements(doc, elemsIds);
}
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
See Also