private void InitRebarBarType(double diameter, Autodesk.Revit.DB.Structure.RebarDeformationType deformationType) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); var barTypeElem = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.Structure.RebarBarType>(document); if (barTypeElem == null) { barTypeElem = Autodesk.Revit.DB.Structure.RebarBarType.Create(document); } barTypeElem.BarDiameter = diameter; barTypeElem.DeformationType = deformationType; TransactionManager.Instance.TransactionTaskDone(); if (barTypeElem != null) { ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement); } else { ElementBinder.SetElementForTrace(this.InternalElement); } }
/// <summary> /// Create Rebar by Curve /// </summary> /// <param name="curves">Set of Curves</param> /// <param name="hostElementId">Host Element Id</param> public static RebarBarType ByAngle(double diameter, bool deformed) { if (diameter == null) { throw new ArgumentNullException("diameter"); } if (deformed == null) { throw new ArgumentNullException("deformed"); } Autodesk.Revit.DB.Structure.RebarDeformationType type = (deformed) ? Autodesk.Revit.DB.Structure.RebarDeformationType.Deformed : Autodesk.Revit.DB.Structure.RebarDeformationType.Plain; return(new RebarBarType(diameter, type)); }
private RebarBarType(double diameter, Autodesk.Revit.DB.Structure.RebarDeformationType deformationType) { SafeInit(() => InitRebarBarType(diameter, deformationType)); }