SteelElementPropertiesGetSteelElementProperties Method |
Get SteelElementProperties for the input element if they exist.
Namespace: Autodesk.Revit.DB.SteelAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static SteelElementProperties GetSteelElementProperties(
Element pElement
)
Public Shared Function GetSteelElementProperties (
pElement As Element
) As SteelElementProperties
public:
static SteelElementProperties^ GetSteelElementProperties(
Element^ pElement
)
static member GetSteelElementProperties :
pElement : Element -> SteelElementProperties
Parameters
- pElement Element
-
The element from which we try to obtain SteelElementProperties.
Return Value
SteelElementProperties
Exceptions
Remarks
If the input element doesn't have steel informations than it retuns .
Example
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);
}
}
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;
}
See Also