/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private RebarContainer(System.Collections.Generic.List <object> curve, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, System.Collections.Generic.List <Autodesk.Revit.DB.XYZ> normals, bool useExistingShape, bool createNewShape) { SafeInit(() => InitRebarContainer(curve, barType, barStyle, host, startHook, endHook, startHookOrientation, endHookOrientation, normals, useExistingShape, createNewShape)); }
/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private Rebar(object curve, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, Autodesk.Revit.DB.XYZ normal, bool useExistingShape, bool createNewShape) { SafeInit(() => InitRebar(curve, barType, barStyle, host, startHook, endHook, startHookOrientation, endHookOrientation, normal, useExistingShape, createNewShape)); }
/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private void InitRebar(object curve, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, Autodesk.Revit.DB.XYZ normal, bool useExistingShape, bool createNewShape) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); var rebarElem = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.Structure.Rebar>(document); // geometry wrapper for polycurves List <Curve> geometry = new List <Curve>(); if (curve.GetType() == typeof(DynamoRebar.RevitPolyCurve)) { DynamoRebar.RevitPolyCurve polycurve = (DynamoRebar.RevitPolyCurve)curve; geometry = polycurve.Curves; } else { geometry.Add((Curve)curve); } rebarElem = Autodesk.Revit.DB.Structure.Rebar.CreateFromCurves(document, barStyle, barType, startHook, endHook, host, normal, geometry, startHookOrientation, endHookOrientation, useExistingShape, createNewShape); InternalSetRebar(rebarElem); TransactionManager.Instance.TransactionTaskDone(); if (rebarElem != null) { ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement); } else { ElementBinder.SetElementForTrace(this.InternalElement); } }
/// <summary> /// Gets a Revit category by the built-in category name. /// </summary> /// <param name="name">The built in category name.</param> /// <returns></returns> public static RebarHookOrientation ByName(string name) { if (name == null) { throw new ArgumentNullException("name"); } Autodesk.Revit.DB.Structure.RebarHookOrientation hook = Autodesk.Revit.DB.Structure.RebarHookOrientation.Left; if (!Enum.TryParse <Autodesk.Revit.DB.Structure.RebarHookOrientation>(name, out hook)) { throw new Exception("Cannot parse " + name); } return(new RebarHookOrientation(hook)); }
/// <summary> /// Cuts a set of Rebars by Plane /// </summary> /// <param name="plane">Plane to cut by</param> /// <param name="rebarContainerElement">Rebar Container</param> /// <param name="firstPart">Return the first or the last part of the splitted elements</param> public static void Cut(Surface plane, Revit.Elements.Element rebarContainerElement, bool firstPart) { // Get Rebar Container Element Autodesk.Revit.DB.Structure.RebarContainer rebarContainer = (Autodesk.Revit.DB.Structure.RebarContainer)rebarContainerElement.InternalElement; // Get the active Document Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; // Open a new Transaction TransactionManager.Instance.EnsureInTransaction(document); // Get all single Rebar elements from the container List <Autodesk.Revit.DB.Structure.RebarContainerItem> rebars = rebarContainer.ToList(); // Walk through all rebar elements foreach (Autodesk.Revit.DB.Structure.RebarContainerItem rebar in rebars) { // Buffer Rebar properties for recreation RVT.Structure.RebarBarType barType = (RVT.Structure.RebarBarType)document.GetElement(rebar.BarTypeId); RVT.Structure.RebarHookType hookTypeStart = (RVT.Structure.RebarHookType)document.GetElement(rebar.GetHookTypeId(0)); RVT.Structure.RebarHookType hookTypeEnd = (RVT.Structure.RebarHookType)document.GetElement(rebar.GetHookTypeId(1)); RVT.Structure.RebarHookOrientation hookOrientationStart = rebar.GetHookOrientation(0); RVT.Structure.RebarHookOrientation hookOrientationEnd = rebar.GetHookOrientation(1); // create a list to store the remaining part of the curve after cutting it List <RVT.Curve> result = new List <RVT.Curve>(); // get the center line curves of the rebar elements foreach (RVT.Curve curve in rebar.GetCenterlineCurves(false, true, true)) { // if the curve is a line or an arc consider it being valid if (curve.GetType() == typeof(RVT.Line) || curve.GetType() == typeof(RVT.Arc)) { // Get a DesignScript Curve from the Revit curve Curve geocurve = curve.ToProtoType(); // Intersect the selected plane with the curve foreach (Geometry geometry in plane.Intersect(geocurve)) { // if the intersection is a point if (geometry.GetType() == typeof(Point)) { // Get the closest point to the intersection on the curve Point p = geocurve.ClosestPointTo((Point)geometry); // Split the curve at this point Curve[] curves = geocurve.ParameterSplit(geocurve.ParameterAtPoint(p)); // If the curve has been split into two parts if (curves.Length == 2) { // return the first or the second part of the splitted curve if (firstPart) { result.Add(curves[0].ToRevitType()); } else { result.Add(curves[1].ToRevitType()); } } } } } } // If the result has some elements, create a new rebar container from those curves // using the same properties as the initial one. if (result.Count > 0) { rebar.SetFromCurves(RVT.Structure.RebarStyle.Standard, barType, hookTypeStart, hookTypeEnd, rebar.Normal, result, hookOrientationStart, hookOrientationEnd, true, false); } } // Commit and Dispose the transaction TransactionManager.Instance.TransactionTaskDone(); }
/// <summary> /// Create Rebar Container by Curves /// </summary> /// <param name="curves">Input Curves</param> /// <param name="hostElementId">Host Element Id</param> /// <param name="rebarStyle">Rebar Style</param> /// <param name="rebarBarType">Bar Type</param> /// <param name="startHookOrientation">Hokk orientation at the start</param> /// <param name="endHookOrientation">Hook orientation at the end</param> /// <param name="startHookType">Hook type at the start</param> /// <param name="endHookType">Hook type at the end</param> /// <param name="vectors">Normal Vectors</param> /// <returns></returns> public static RebarContainer ByCurve( System.Collections.Generic.List <Autodesk.DesignScript.Geometry.Curve> curves, int hostElementId, string rebarStyle, Revit.Elements.Element rebarBarType, string startHookOrientation, string endHookOrientation, Revit.Elements.Element startHookType, Revit.Elements.Element endHookType, System.Collections.Generic.List <Autodesk.DesignScript.Geometry.Vector> vectors ) { if (curves == null) { throw new ArgumentNullException("Input Curves missing"); } if (hostElementId == null) { throw new ArgumentNullException("Host ElementId missing"); } if (rebarStyle == null) { throw new ArgumentNullException("Rebar Style missing"); } if (rebarBarType == null) { throw new ArgumentNullException("Rebar Bar Type missing"); } if (startHookOrientation == null) { throw new ArgumentNullException("Start Hook Orientation missing"); } if (endHookOrientation == null) { throw new ArgumentNullException("End Hook Orientation missing"); } //if (startHookType == null) throw new ArgumentNullException("Start Hook Type missing"); //if (endHookType == null) throw new ArgumentNullException("End Hook Type missing"); if (vectors == null) { throw new ArgumentNullException("Normal Vector missing"); } ElementId elementId = new ElementId(hostElementId); if (elementId == ElementId.InvalidElementId) { throw new ArgumentNullException("Host ElementId error"); } Autodesk.Revit.DB.Element host = DocumentManager.Instance.CurrentDBDocument.GetElement(elementId); System.Collections.Generic.List <object> revitCurves = new System.Collections.Generic.List <object>(); foreach (Autodesk.DesignScript.Geometry.Curve curve in curves) { revitCurves.Add(curve.ApproximateToRvt()); } // Parse Rebar Style Autodesk.Revit.DB.Structure.RebarStyle barStyle = Autodesk.Revit.DB.Structure.RebarStyle.StirrupTie; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarStyle>(rebarStyle, out barStyle); // Parse Rebar Hook Orientation Autodesk.Revit.DB.Structure.RebarHookOrientation startOrientation = Autodesk.Revit.DB.Structure.RebarHookOrientation.Left; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarHookOrientation>(startHookOrientation, out startOrientation); // Parse Rebar Hook Orientation Autodesk.Revit.DB.Structure.RebarHookOrientation endOrientation = Autodesk.Revit.DB.Structure.RebarHookOrientation.Left; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarHookOrientation>(endHookOrientation, out endOrientation); List <XYZ> normals = new List <XYZ>(); foreach (Autodesk.DesignScript.Geometry.Vector vector in vectors) { normals.Add(vector.ToRevitType()); } Autodesk.Revit.DB.Structure.RebarHookType startHookT = (startHookType == null) ? null : (Autodesk.Revit.DB.Structure.RebarHookType)startHookType.InternalElement; Autodesk.Revit.DB.Structure.RebarHookType endHookT = (endHookType == null) ? null : (Autodesk.Revit.DB.Structure.RebarHookType)endHookType.InternalElement; return(new RebarContainer(revitCurves, (Autodesk.Revit.DB.Structure.RebarBarType)rebarBarType.InternalElement, barStyle, host, startHookT, endHookT, startOrientation, endOrientation, normals, true, true)); }
/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private void InitRebarContainer(System.Collections.Generic.List <object> curves, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, System.Collections.Generic.List <Autodesk.Revit.DB.XYZ> normals, bool useExistingShape, bool createNewShape) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); var rebarElem = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.Structure.RebarContainer>(document); // Parse Geometry List <List <Curve> > curvature = new List <List <Curve> >(); foreach (object curve in curves) { List <Curve> geometry = new List <Curve>(); if (curve.GetType() == typeof(DynamoRebar.RevitPolyCurve)) { DynamoRebar.RevitPolyCurve polycurve = (DynamoRebar.RevitPolyCurve)curve; geometry = polycurve.Curves; } else { geometry.Add((Curve)curve); } curvature.Add(geometry); } if (rebarElem == null) { ElementId stdC = Autodesk.Revit.DB.Structure.RebarContainerType.CreateDefaultRebarContainerType(DocumentManager.Instance.CurrentDBDocument); rebarElem = Autodesk.Revit.DB.Structure.RebarContainer.Create(DocumentManager.Instance.CurrentDBDocument, host, stdC); } else { //rebarElem.ClearItems(); rebarElem.SetHostId(document, host.Id); } int counter = rebarElem.ItemsCount; for (int i = 0; i < counter; i++) { Autodesk.Revit.DB.Structure.RebarContainerItem item = rebarElem.GetItem(i); int index = GeometryMatches(item.ComputeDrivingCurves(), curvature); if (index == -1) { rebarElem.RemoveItem(item); } else { item.SetHookOrientation(0, startHookOrientation); item.SetHookOrientation(1, endHookOrientation); item.SetHookTypeId(0, startHook.Id); item.SetHookTypeId(1, endHook.Id); curvature.RemoveAt(index); if (normals.Count > 1) { normals.RemoveAt(index); } } } for (int i = 0; i < curvature.Count; i++) { // If there is only one normal in the list use this one for all curves XYZ normal = (normals.Count == 1) ? normals[0] : normals[i]; List <Curve> geometry = curvature[i]; rebarElem.AppendItemFromCurves(barStyle, barType, startHook, endHook, normal, geometry, startHookOrientation, endHookOrientation, useExistingShape, createNewShape); } // Update Quantity Parameter Autodesk.Revit.DB.Parameter quantityParameter = rebarElem.get_Parameter(BuiltInParameter.REBAR_ELEM_QUANTITY_OF_BARS); Autodesk.Revit.DB.Structure.RebarContainerParameterManager containerParameters = rebarElem.GetParametersManager(); containerParameters.AddOverride(quantityParameter.Id, curves.Count); InternalSetRebarContainer(rebarElem); TransactionManager.Instance.TransactionTaskDone(); if (rebarElem != null) { ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement); } else { ElementBinder.SetElementForTrace(this.InternalElement); } }
/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private void InitRebarContainer(System.Collections.Generic.List <object> curves, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, System.Collections.Generic.List <Autodesk.Revit.DB.XYZ> normals, bool useExistingShape, bool createNewShape) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); var rebarElem = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.Structure.RebarContainer>(document); if (rebarElem == null) { ElementId stdC = Autodesk.Revit.DB.Structure.RebarContainerType.CreateDefaultRebarContainerType(DocumentManager.Instance.CurrentDBDocument); rebarElem = Autodesk.Revit.DB.Structure.RebarContainer.Create(DocumentManager.Instance.CurrentDBDocument, host, stdC); } else { rebarElem.ClearItems(); } for (int i = 0; i < curves.Count; i++) { // If there is only one normal in the list use this one for all curves XYZ normal = (normals.Count == 1) ? normals[0] : normals[i]; // geometry wrapper for polycurves List <Curve> geometry = new List <Curve>(); if (curves[i].GetType() == typeof(DynamoRebar.RevitPolyCurve)) { DynamoRebar.RevitPolyCurve polycurve = (DynamoRebar.RevitPolyCurve)curves[i]; geometry = polycurve.Curves; } else { geometry.Add((Curve)curves[i]); } rebarElem.AppendItemFromCurves(barStyle, barType, startHook, endHook, normal, geometry, startHookOrientation, endHookOrientation, useExistingShape, createNewShape); } InternalSetRebarContainer(rebarElem); TransactionManager.Instance.TransactionTaskDone(); if (rebarElem != null) { ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement); } else { ElementBinder.SetElementForTrace(this.InternalElement); } }
private RebarHookOrientation(Autodesk.Revit.DB.Structure.RebarHookOrientation hookOrientation) { internalElement = hookOrientation; }
/// <summary> /// Create Rebar by Curves /// </summary> /// <param name="curve">Input Curves</param> /// <param name="hostElementId">Host Element Id</param> /// <param name="rebarStyle">Rebar Style</param> /// <param name="rebarBarType">Bar Type</param> /// <param name="startHookOrientation">Hokk orientation at the start</param> /// <param name="endHookOrientation">Hook orientation at the end</param> /// <param name="startHookType">Hook type at the start</param> /// <param name="endHookType">Hook type at the end</param> /// <param name="vector">Normal Vectors</param> /// <returns></returns> public static Rebar ByCurve( Autodesk.DesignScript.Geometry.Curve curve, int hostElementId, string rebarStyle, Revit.Elements.Element rebarBarType, string startHookOrientation, string endHookOrientation, Revit.Elements.Element startHookType, Revit.Elements.Element endHookType, Autodesk.DesignScript.Geometry.Vector vector ) { if (curve == null) { throw new ArgumentNullException("Input Curve missing"); } if (hostElementId == null) { throw new ArgumentNullException("Host ElementId missing"); } if (rebarStyle == null) { throw new ArgumentNullException("Rebar Style missing"); } if (rebarBarType == null) { throw new ArgumentNullException("Rebar Bar Type missing"); } if (startHookOrientation == null) { throw new ArgumentNullException("Start Hook Orientation missing"); } if (endHookOrientation == null) { throw new ArgumentNullException("End Hook Orientation missing"); } //if (startHookType == null) throw new ArgumentNullException("Start Hook Type missing"); //if (endHookType == null) throw new ArgumentNullException("End Hook Type missing"); if (vector == null) { throw new ArgumentNullException("Normal Vector missing"); } ElementId elementId = new ElementId(hostElementId); if (elementId == ElementId.InvalidElementId) { throw new ArgumentNullException("Host ElementId error"); } Autodesk.Revit.DB.Element host = DocumentManager.Instance.CurrentDBDocument.GetElement(elementId); Autodesk.Revit.DB.Structure.RebarStyle barStyle = Autodesk.Revit.DB.Structure.RebarStyle.StirrupTie; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarStyle>(rebarStyle, out barStyle); Autodesk.Revit.DB.Structure.RebarHookOrientation startOrientation = Autodesk.Revit.DB.Structure.RebarHookOrientation.Left; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarHookOrientation>(startHookOrientation, out startOrientation); Autodesk.Revit.DB.Structure.RebarHookOrientation endOrientation = Autodesk.Revit.DB.Structure.RebarHookOrientation.Left; Enum.TryParse <Autodesk.Revit.DB.Structure.RebarHookOrientation>(endHookOrientation, out endOrientation); Autodesk.Revit.DB.Structure.RebarHookType startHookT = (startHookType == null) ? null : (Autodesk.Revit.DB.Structure.RebarHookType)startHookType.InternalElement; Autodesk.Revit.DB.Structure.RebarHookType endHookT = (endHookType == null) ? null : (Autodesk.Revit.DB.Structure.RebarHookType)endHookType.InternalElement; return(new Rebar(curve.ApproximateToRvt(), (Autodesk.Revit.DB.Structure.RebarBarType)rebarBarType.InternalElement, barStyle, host, startHookT, endHookT , startOrientation, endOrientation, vector.ToRevitType(), true, true)); }
/// <summary> /// /// </summary> /// <param name="curve"></param> /// <param name="barType"></param> /// <param name="barStyle"></param> /// <param name="host"></param> /// <param name="startHook"></param> /// <param name="endHook"></param> /// <param name="startHookOrientation"></param> /// <param name="endHookOrientation"></param> /// <param name="normal"></param> /// <param name="useExistingShape"></param> /// <param name="createNewShape"></param> private void InitRebar(object curve, Autodesk.Revit.DB.Structure.RebarBarType barType, Autodesk.Revit.DB.Structure.RebarStyle barStyle, Autodesk.Revit.DB.Element host, Autodesk.Revit.DB.Structure.RebarHookType startHook, Autodesk.Revit.DB.Structure.RebarHookType endHook, Autodesk.Revit.DB.Structure.RebarHookOrientation startHookOrientation, Autodesk.Revit.DB.Structure.RebarHookOrientation endHookOrientation, Autodesk.Revit.DB.XYZ normal, bool useExistingShape, bool createNewShape) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); var rebarElem = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.Structure.Rebar>(document); // geometry wrapper for polycurves List <Curve> geometry = new List <Curve>(); if (curve.GetType() == typeof(DynamoRebar.RevitPolyCurve)) { DynamoRebar.RevitPolyCurve polycurve = (DynamoRebar.RevitPolyCurve)curve; geometry = polycurve.Curves; } else { geometry.Add((Curve)curve); } bool changed = false; // Check for existing Geometry if (rebarElem != null) { foreach (Curve existingCurve in rebarElem.GetShapeDrivenAccessor().ComputeDrivingCurves()) { bool curveIsExisting = false; foreach (Curve newCurve in geometry) { if (CurveUtils.CurvesAreSimilar(newCurve, existingCurve)) { curveIsExisting = true; break; } } if (!curveIsExisting) { changed = true; } } } if (rebarElem == null || changed) { // Delete exsiting Rebar Element if (rebarElem != null && rebarElem.Id != ElementId.InvalidElementId) { document.Delete(rebarElem.Id); } rebarElem = Autodesk.Revit.DB.Structure.Rebar.CreateFromCurves(document, barStyle, barType, startHook, endHook, host, normal, geometry, startHookOrientation, endHookOrientation, useExistingShape, createNewShape); } else { rebarElem.SetHostId(document, host.Id); rebarElem.SetHookTypeId(0, startHook.Id); rebarElem.SetHookTypeId(1, endHook.Id); rebarElem.SetHookOrientation(0, startHookOrientation); rebarElem.SetHookOrientation(1, endHookOrientation); rebarElem.ChangeTypeId(barType.Id); } InternalSetRebar(rebarElem); TransactionManager.Instance.TransactionTaskDone(); if (rebarElem != null) { ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement); } else { ElementBinder.SetElementForTrace(this.InternalElement); } }