SteelElementProperties.GetSteelElementProperties
Public Class
ArgumentNullException
Get SteelElementProperties for the input element if they exist.
Namespace: Autodesk.Revit.DB.Steel
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static SteelElementProperties GetSteelElementProperties( Element pElement)
Parameters
pElement Element
The element from which we try to obtain SteelElementProperties.
Return Value
SteelElementPropertiesExceptions
Exception
Condition
ArgumentNullException
A non-optional argument was null
Remarks
If the input element doesn’t have steel informations than it retuns ..
Example
C#
// Starting the transaction, using CYBORG's FabricationTransaction classusing (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); }}
C#
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;}