/// <summary> /// Gets bar position transform. /// </summary> /// <param name="element">The rebar element.</param> /// <param name="barPositionIndex">The bar position.</param> /// <returns>The transform.</returns> static Transform GetBarPositionTransform(object element, int barPositionIndex) { if (element is Rebar) { Rebar rebar = element as Rebar; Transform movedBarTransform = rebar.GetMovedBarTransform(barPositionIndex); if (rebar.IsRebarFreeForm()) { return(movedBarTransform); } else { // shape driven Transform barPosTrf = rebar.GetShapeDrivenAccessor().GetBarPositionTransform(barPositionIndex); Transform entireTrf = movedBarTransform.Multiply(barPosTrf); return(entireTrf); } } else if (element is RebarInSystem) { RebarInSystem rebarInSystem = element as RebarInSystem; Transform barPosTrf = rebarInSystem.GetBarPositionTransform(barPositionIndex); Transform movedBarTrf = rebarInSystem.GetMovedBarTransform(barPositionIndex); Transform entireTrf = movedBarTrf.Multiply(barPosTrf); return(entireTrf); } else if (element is RebarContainerItem) { return((element as RebarContainerItem).GetBarPositionTransform(barPositionIndex)); } else { throw new ArgumentException("Not a rebar."); } }