SteelElementProperties.GetSteelElementProperties
Description:
Get SteelElementProperties for the input element if they exist.
Get SteelElementProperties for the input element if they exist.
Remarks:
If the input element doesn't have steel informations than it retuns .a null reference (Nothing in Visual Basic).
If the input element doesn't have steel informations than it retuns .a null reference (Nothing in Visual Basic).
public static SteelElementProperties GetSteelElementProperties(
Element pElement
)
-
pElementThe element from which we try to obtain SteelElementProperties.
Return Value
SteelElementProperties
// 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);
}
}
-
A non-optional argument was null