public ActionResult Index(string address) { int noofresults = Constants.noOfResults; var distanceList = new DistanceList(); using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:58578/api/"); var input = new Input(address, noofresults); var responseTask = client.PostAsJsonAsync <Input>("shortestDistance", input); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <IEnumerable <Distance> >(); readTask.Wait(); var distances = readTask.Result; distanceList.Distances = distances; distanceList.Success = true; Log.Info("Status from Web api is OK"); } else { distanceList.Success = false; Log.Info("Status from Web api is Not found"); } } return(View(distanceList)); }
private bool ValidateLengthTextBoxes() { foreach (var txtBox in lengthTextBoxes) { if (!double.TryParse(txtBox.Text, out double result)) { return(false); } } var dList = DistanceList.Parse(txtBoxCopies.Text, CultureInfo.CurrentCulture, Tekla.Structures.Datatype.Distance.UnitType.Millimeter); if (dList.Count == 0) { return(false); } if (txtBoxPrlnProf.Text == string.Empty) { return(false); } if (txtBoxPrlnMtrl.Text == string.Empty) { return(false); } return(true); }
private FramingOptions PopulateFramingOption(Point origin) { #region Instantiating lists List <string> col1MemberAttribs = new List <string>() { cmbBoxCol1AFile1.Text, cmbBoxCol1AFile2.Text, cmbBoxCol1AFile3.Text, cmbBoxCol1AFile4.Text }; List <string> col1SpliceAttribs = new List <string>() { cmbBoxCol1SplAFile1.Text, cmbBoxCol1SplAFile2.Text, cmbBoxCol1SplAFile3.Text }; List <double> col1SpliceLengths = new List <double>() { double.Parse(txtBoxCol1SplLn1.Text), double.Parse(txtBoxCol1SplLn2.Text), double.Parse(txtBoxCol1SplLn3.Text) }; List <string> col2MemberAttribs = new List <string>() { cmbBoxCol2AFile1.Text, cmbBoxCol2AFile2.Text, cmbBoxCol2AFile3.Text, cmbBoxCol2AFile4.Text }; List <string> col2SpliceAttribs = new List <string>() { cmbBoxCol2SplAFile1.Text, cmbBoxCol2SplAFile2.Text, cmbBoxCol2SplAFile3.Text }; List <double> col2SpliceLengths = new List <double>() { double.Parse(txtBoxCol2SplLn1.Text), double.Parse(txtBoxCol2SplLn2.Text), double.Parse(txtBoxCol2SplLn3.Text) }; List <string> raf1MemberAttribs = new List <string>() { cmbBoxRft1AFile1.Text, cmbBoxRft1AFile2.Text, cmbBoxRft1AFile3.Text, cmbBoxRft1AFile4.Text, cmbBoxRft1AFile5.Text, cmbBoxRft1AFile6.Text, cmbBoxRft1AFile7.Text }; List <string> raf1SpliceAttribs = new List <string>() { cmbBoxRft1SplAFile1.Text, cmbBoxRft1SplAFile2.Text, cmbBoxRft1SplAFile3.Text, cmbBoxRft1SplAFile4.Text, cmbBoxRft1SplAFile5.Text, cmbBoxRft1SplAFile6.Text }; List <double> raf1SpliceLengths = new List <double>() { double.Parse(txtBoxRft1SplLn1.Text), double.Parse(txtBoxRft1SplLn2.Text), double.Parse(txtBoxRft1SplLn3.Text), double.Parse(txtBoxRft1SplLn4.Text), double.Parse(txtBoxRft1SplLn5.Text), double.Parse(txtBoxRft1SplLn6.Text) }; List <string> raf2MemberAttribs = new List <string>() { cmbBoxRft2AFile1.Text, cmbBoxRft2AFile2.Text, cmbBoxRft2AFile3.Text, cmbBoxRft2AFile4.Text, cmbBoxRft2AFile5.Text, cmbBoxRft2AFile6.Text, cmbBoxRft2AFile7.Text }; List <string> raf2SpliceAttribs = new List <string>() { cmbBoxRft2SplAFile1.Text, cmbBoxRft2SplAFile2.Text, cmbBoxRft2SplAFile3.Text, cmbBoxRft2SplAFile4.Text, cmbBoxRft2SplAFile5.Text, cmbBoxRft2SplAFile6.Text }; List <double> raf2SpliceLengths = new List <double>() { double.Parse(txtBoxRft2SplLn1.Text), double.Parse(txtBoxRft2SplLn2.Text), double.Parse(txtBoxRft2SplLn3.Text), double.Parse(txtBoxRft2SplLn4.Text), double.Parse(txtBoxRft2SplLn5.Text), double.Parse(txtBoxRft2SplLn6.Text) }; #endregion #region Modifying lists int col1SpliceQuantity = int.TryParse(cmbBoxSpliceNoCol1.Text, out int quantity1) ? quantity1 : 0; int col2SpliceQuantity = int.TryParse(cmbBoxSpliceNoCol2.Text, out int quantity2) ? quantity2 : 0; int raf1SpliceQuantity = int.TryParse(cmbBoxSpliceNoRft1.Text, out int quantity3) ? quantity3 : 0; int raf2SpliceQuantity = int.TryParse(cmbBoxSpliceNoRft2.Text, out int quantity4) ? quantity4 : 0; col1MemberAttribs.RemoveRange(col1SpliceQuantity + 1, col1MemberAttribs.Count - (col1SpliceQuantity + 1)); col1SpliceAttribs.RemoveRange(col1SpliceQuantity, col1SpliceAttribs.Count - col1SpliceQuantity); col1SpliceLengths.RemoveRange(col1SpliceQuantity, col1SpliceLengths.Count - col1SpliceQuantity); col2MemberAttribs.RemoveRange(col2SpliceQuantity + 1, col2MemberAttribs.Count - (col2SpliceQuantity + 1)); col2SpliceAttribs.RemoveRange(col2SpliceQuantity, col2SpliceAttribs.Count - col2SpliceQuantity); col2SpliceLengths.RemoveRange(col2SpliceQuantity, col2SpliceLengths.Count - col2SpliceQuantity); raf1MemberAttribs.RemoveRange(raf1SpliceQuantity + 1, raf1MemberAttribs.Count - (raf1SpliceQuantity + 1)); raf1SpliceAttribs.RemoveRange(raf1SpliceQuantity, raf1SpliceAttribs.Count - raf1SpliceQuantity); raf1SpliceLengths.RemoveRange(raf1SpliceQuantity, raf1SpliceLengths.Count - raf1SpliceQuantity); raf2MemberAttribs.RemoveRange(raf2SpliceQuantity + 1, raf2MemberAttribs.Count - (raf2SpliceQuantity + 1)); raf2SpliceAttribs.RemoveRange(raf2SpliceQuantity, raf2SpliceAttribs.Count - raf2SpliceQuantity); raf2SpliceLengths.RemoveRange(raf2SpliceQuantity, raf2SpliceLengths.Count - raf2SpliceQuantity); #endregion var dList = DistanceList.Parse(txtBoxCopies.Text, CultureInfo.CurrentCulture, Tekla.Structures.Datatype.Distance.UnitType.Millimeter); var flagOfCoverRight = cmbBoxRight.SelectedIndex == 0 ? true : false; var flagOfCoverLeft = cmbBoxLeft.SelectedIndex == 0 ? true : false; List <double> copies = new List <double>(); foreach (var distance in dList) { copies.Add(distance.Value); } copies.RemoveAll(p => p == 0); FramingOptions options = new FramingOptions() { FrameVector = alongFrameVector, ReplicationVector = replicationVector, Col1BplAttrib = cmbBoxCol1BplAFile.Text, Col1KneeAttrib = cmbBoxCol1KneeAFile.Text, Col1SpliceNumber = col1SpliceQuantity, Col2BplAttrib = cmbBoxCol2BplAFile.Text, Col2KneeAttrib = cmbBoxCol2KneeAFile.Text, Col2SpliceNumber = col2SpliceQuantity, Origin = origin, Slope = double.Parse(txtBoxSlope.Text), GableSteelLineFullLength = double.Parse(txtBoxGblFrmLength.Text), GableSteelLineHalfLength = double.Parse(txtBoxGblHalfRft.Text), GableSteelLineColumnHeight = double.Parse(txtBoxGblColHt.Text), GableColumnOffset = double.Parse(txtBoxGblColOffst.Text), GableRafterOffset = double.Parse(txtBoxGblRftOffst.Text), GableLeftBaseOffset = double.Parse(txtBoxGblLftBsOffst.Text), GableRightBaseOffset = double.Parse(txtBoxGblRghtBsOffst.Text), RidgeSpliceAttrib = cmbBoxRidgeSplice.Text, MonoSlopeSteelLineFullLength = double.Parse(txtBoxMnoFrmLength.Text), MonoSlopeSteelLineColumnHeight = double.Parse(txtBoxMnoColHt.Text), MonoSlopeColumnOffset = double.Parse(txtBoxMnoColOffst.Text), MonoSlopeRafterOffset = double.Parse(txtBoxMnoRftOffst.Text), MonoSlopeLeftBaseOffset = double.Parse(txtBoxMnoLftBsOffst.Text), MonoSlopeRightBaseOffset = double.Parse(txtBoxMnoRghtBsOffst.Text), BracingMode = (FlangeBraceMode)cmbBoxFlngBrcMode.SelectedIndex, Raf1SpliceNumber = raf1SpliceQuantity, Raf2SpliceNumber = raf2SpliceQuantity, EndBraceAttrib = cmbBoxEndFlangeBrce.Text, GeneralBraceAttrib = cmbBoxFlangeBrace.Text, Col1MemberAttribs = col1MemberAttribs, Col1SpliceAttribs = col1SpliceAttribs, Col1SpliceLengths = col1SpliceLengths, Col2MemberAttribs = col2MemberAttribs, Col2SpliceAttribs = col2SpliceAttribs, Col2SpliceLengths = col2SpliceLengths, Raf1MemberAttribs = raf1MemberAttribs, Raf1SpliceAttribs = raf1SpliceAttribs, Raf1SpliceLengths = raf1SpliceLengths, Raf2MemberAttribs = raf2MemberAttribs, Raf2SpliceAttribs = raf2SpliceAttribs, Raf2SpliceLengths = raf2SpliceLengths, LeftEaveOffset = double.Parse(txtBoxLeftEaveOffst.Text), RightEaveOffset = double.Parse(txtBoxRightEaveOffset.Text), HorizontalDistance = double.Parse(txtBoxHorzDist.Text), PurlinSection = txtBoxPrlnProf.Text, PurlinMaterial = txtBoxPrlnMtrl.Text, AtCoverLeft = flagOfCoverLeft, AtCoverRight = flagOfCoverRight, ClipAngleAttrib = cmbBoxClipAttribute.Text, CopyLengths = copies }; return(options); }
public static DistanceList FromTSObject(dynamic tsStruct) { var dynStruct = new DistanceList(); return(dynStruct); }
public static dynamic GetTSObject(DistanceList dynStruct) { var tsType = TSActivator.CreateInstance("Tekla.Structures.Datatype.DistanceList"); return(tsType); }
public override bool Run(List <InputDefinition> Input) { try { GetValuesFromDialog(); //get the footing Identifier id = ((InputDefinition)Input[0]).GetInput() as Identifier; Beam inputFooting = _Model.SelectModelObject(id) as Beam; var test = ""; //Get the needed object properties var topLevelFootingGlobal = 0.0; var bottomLevelFootingGlobal = 0.0; inputFooting.GetReportProperty("TOP_LEVEL_GLOBAL_UNFORMATTED", ref topLevelFootingGlobal); inputFooting.GetReportProperty("BOTTOM_LEVEL_GLOBAL_UNFORMATTED", ref bottomLevelFootingGlobal); //get the material properties var material = ""; inputFooting.GetReportProperty("MATERIAL", ref material); //Determine the corner points of the footing var centerlineFooting = inputFooting.GetCenterLine(false).Cast <Point>().ToList(); var startPointFooting = centerlineFooting[0]; var endPointFooting = centerlineFooting[1]; double heightFooting = inputFooting.getDouble("HEIGHT") * 0.5; double widthFooting = inputFooting.getDouble("WIDTH") * 0.5; var vectorX = inputFooting.GetCoordinateSystem().AxisX.GetNormal(); var vectorY = inputFooting.GetCoordinateSystem().AxisY.GetNormal(); var vectorZ = vectorX.Cross(vectorY).GetNormal(); var leftBottomStart = centerlineFooting[0] + new Point(-heightFooting * vectorY) + new Point(widthFooting * vectorZ); var rightBottomStart = centerlineFooting[0] + new Point(-heightFooting * vectorY) + new Point(-widthFooting * vectorZ); var leftTopStart = centerlineFooting[0] + new Point(heightFooting * vectorY) + new Point(widthFooting * vectorZ); var rightTopStart = centerlineFooting[0] + new Point(heightFooting * vectorY) + new Point(-widthFooting * vectorZ); var leftBottomEnd = centerlineFooting[1] + new Point(-heightFooting * vectorY) + new Point(widthFooting * vectorZ); var rightBottomEnd = centerlineFooting[1] + new Point(-heightFooting * vectorY) + new Point(-widthFooting * vectorZ); var leftTopEnd = centerlineFooting[1] + new Point(heightFooting * vectorY) + new Point(widthFooting * vectorZ); var rightTopEnd = centerlineFooting[1] + new Point(heightFooting * vectorY) + new Point(-widthFooting * vectorZ); var rightHalfStart = centerlineFooting[0] + new Point(heightFooting * vectorY); var leftHalfStart = centerlineFooting[0] + new Point(-heightFooting * vectorY); var topHalfStart = centerlineFooting[0] + new Point(widthFooting * vectorZ); var bottomtHalfStart = centerlineFooting[0] + new Point(-widthFooting * vectorZ); //var controlPoint1 = new ControlPoint(rightHalfStart); //var controlPoint2 = new ControlPoint(leftHalfStart); //var controlPoint3 = new ControlPoint(topHalfStart); //var controlPoint4 = new ControlPoint(bottomtHalfStart); //controlPoint1.Insert(); //controlPoint2.Insert(); //controlPoint3.Insert(); //controlPoint4.Insert(); // //BR1 (Bottom Rebar 1st Layer) // //list needed for the spacings list var BR1Spacing = DistanceList.Parse(_BR1Spacing); var BR1SpacingList = BR1Spacing.Select(d => d.Value).ToList(); //Define spacing type var BR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; switch (_BR1SpacingType) { case 0: BR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; break; case 1: BR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_NUMBER; break; case 2: BR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS; break; } //create rebar instance bottom rebar 1(BR1) RebarGroup BR1 = new RebarGroup() { Father = inputFooting, StartPoint = leftBottomStart, EndPoint = leftTopStart, Polygons = new ArrayList { new Polygon { Points = new ArrayList { leftBottomEnd, leftBottomStart, rightBottomStart, rightBottomEnd } } }, Size = _BR1Diameter, RadiusValues = new ArrayList { _BR1Radius }, Grade = _BR1Grade, StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL, Name = "onderwapening", Class = 4, NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }, StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, StartPointOffsetValue = _CoverTop, EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, EndPointOffsetValue = _CoverTop, OnPlaneOffsets = new ArrayList { _CoverSide, _CoverBottom, _CoverSide }, StartFromPlaneOffset = _CoverSide, EndFromPlaneOffset = _CoverSide, SpacingType = BR1SpacingType, Spacings = new ArrayList(BR1SpacingList), ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE }; BR1.Insert(); ArrayList BR1GeometryList = new ArrayList(BR1.GetRebarGeometries(false)); double BR1RealDiameter = 0.0; foreach (RebarGeometry item in BR1GeometryList) { BR1RealDiameter = item.Diameter; } // //TR1 (Top Rebar 1st Layer) // //list needed for the spacings list var TR1Spacing = DistanceList.Parse(_TR1Spacing); var TR1SpacingList = TR1Spacing.Select(d => d.Value).ToList(); //Define spacing type var TR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; switch (_TR1SpacingType) { case 0: TR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; break; case 1: TR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_NUMBER; break; case 2: TR1SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS; break; } //create rebar instance top rebar 1(TR1) RebarGroup TR1 = new RebarGroup() { Father = inputFooting, StartPoint = leftBottomEnd, EndPoint = leftTopEnd, Polygons = new ArrayList { new Polygon { Points = new ArrayList { leftBottomStart, leftBottomEnd, rightBottomEnd, rightBottomStart } } }, Size = _TR1Diameter, RadiusValues = new ArrayList { _TR1Radius }, Grade = _TR1Grade, StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL, Name = "bovenwapening", Class = 2, NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }, StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, StartPointOffsetValue = _CoverBottom, EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, EndPointOffsetValue = _CoverBottom, OnPlaneOffsets = new ArrayList { _CoverSide, _CoverTop, _CoverSide }, StartFromPlaneOffset = _CoverSide, EndFromPlaneOffset = _CoverSide, SpacingType = TR1SpacingType, Spacings = new ArrayList(TR1SpacingList), ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE }; TR1.Insert(); ArrayList TR1GeometryList = new ArrayList(TR1.GetRebarGeometries(false)); double TR1RealDiameter = 0.0; foreach (RebarGeometry item in TR1GeometryList) { TR1RealDiameter = item.Diameter; } // //BR2 (Bottom Rebar 2nd Layer) // //list needed for the spacings list var BR2Spacing = DistanceList.Parse(_BR2Spacing); var BR2SpacingList = BR2Spacing.Select(d => d.Value).ToList(); //Define spacing type var BR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; switch (_BR2SpacingType) { case 0: BR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; break; case 1: BR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_NUMBER; break; case 2: BR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS; break; } //create rebar instance bottom rebar 2(BR2) RebarGroup BR2 = new RebarGroup() { Father = inputFooting, StartPoint = leftBottomStart, EndPoint = rightBottomStart, Polygons = new ArrayList { new Polygon { Points = new ArrayList { leftBottomEnd, leftBottomStart, leftTopStart, leftTopEnd } } }, Size = _BR2Diameter, RadiusValues = new ArrayList { _BR2Radius }, Grade = _BR2Grade, StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL, Name = "onderwapening", Class = 11, NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }, StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, StartPointOffsetValue = _CoverTop, EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, EndPointOffsetValue = _CoverTop, OnPlaneOffsets = new ArrayList { _CoverSide, _CoverBottom, _CoverSide }, StartFromPlaneOffset = _CoverSide, EndFromPlaneOffset = _CoverSide, SpacingType = BR2SpacingType, Spacings = new ArrayList(BR2SpacingList), ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE }; BR2.Insert(); ArrayList BR2GeometryList = new ArrayList(BR2.GetRebarGeometries(false)); double BR2RealDiameter = 0.0; foreach (RebarGeometry item in BR2GeometryList) { BR2RealDiameter = item.Diameter; } // //TR2 (Top Rebar 2nd Layer) // //list needed for the spacings list var TR2Spacing = DistanceList.Parse(_TR2Spacing); var TR2SpacingList = TR2Spacing.Select(d => d.Value).ToList(); //Define spacing type var TR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; switch (_TR2SpacingType) { case 0: TR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; break; case 1: TR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_NUMBER; break; case 2: TR2SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS; break; } //create rebar instance top rebar 2(TR2) RebarGroup TR2 = new RebarGroup() { Father = inputFooting, StartPoint = leftBottomEnd, EndPoint = rightBottomEnd, Polygons = new ArrayList { new Polygon { Points = new ArrayList { leftBottomStart, leftBottomEnd, leftTopEnd, leftTopStart } } }, Size = _TR2Diameter, RadiusValues = new ArrayList { _TR2Radius }, Grade = _TR2Grade, StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL, Name = "bovenwapening", Class = 13, NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }, StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }, StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, StartPointOffsetValue = _CoverBottom, EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS, EndPointOffsetValue = _CoverBottom, OnPlaneOffsets = new ArrayList { _CoverSide, _CoverTop, _CoverSide }, StartFromPlaneOffset = _CoverSide, EndFromPlaneOffset = _CoverSide, SpacingType = TR2SpacingType, Spacings = new ArrayList(TR2SpacingList), ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE }; TR2.Insert(); ArrayList TR2GeometryList = new ArrayList(TR2.GetRebarGeometries(false)); double TR2RealDiameter = 0.0; foreach (RebarGeometry item in TR2GeometryList) { TR2RealDiameter = item.Diameter; } //if (_FlipBR == true) //{ // BR1 = BR2; // BR2 = BR1; //} ////Determine the distance between the upper and bottom max bend radiusses //var footingHeight = inputFooting.getDouble("LENGTH"); //var distance = footingHeight - _CoverTop - Math.Max(TR1RealDiameter, TR2RealDiameter) - Math.Max(_TR1Radius, _TR2Radius) - // Math.Max(_BR1Radius, _BR2Radius) - Math.Max(BR1RealDiameter, BR2RealDiameter) - _CoverBottom; //define needed variables double SR1RealDiameter = 0.0; RebarGroup SR1 = new RebarGroup(); RebarGroup SR2 = new RebarGroup(); if (_SRYN == 0) { // //SR (Side rebar 1st layer) // //list needed for the spacings list var SRSpacing = DistanceList.Parse(_SRSpacing); var SRSpacingList = SRSpacing.Select(d => d.Value).ToList(); //Define spacing type var SRSpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; switch (_SRSpacingType) { case 0: SRSpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE; break; case 1: SRSpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_NUMBER; break; case 2: SRSpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS; break; } //Create rebar instance side rebar 1 (SR1) SR1.Father = inputFooting; SR1.StartPoint = leftBottomStart; SR1.EndPoint = leftBottomEnd; SR1.Polygons = new ArrayList { new Polygon { Points = new ArrayList { leftHalfStart, leftBottomStart, leftTopStart, rightHalfStart } } }; SR1.Size = _SRDiameter; SR1.RadiusValues = new ArrayList { _SRRadius }; SR1.Grade = _SRGrade; SR1.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL; SR1.Name = "flank"; SR1.Class = 6; SR1.NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }; SR1.StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }; SR1.EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }; SR1.StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS; SR1.StartPointOffsetValue = -0.5 * Overlappingsberekening.Overlappingslengte(Convert.ToInt32(_SRDiameter), material, true); SR1.EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS; SR1.EndPointOffsetValue = -0.5 * Overlappingsberekening.Overlappingslengte(Convert.ToInt32(_SRDiameter), material, true); SR1.OnPlaneOffsets = new ArrayList { _CoverSide, _CoverSide, _CoverSide }; SR1.StartFromPlaneOffset = _CoverBottom; SR1.EndFromPlaneOffset = _CoverTop; SR1.SpacingType = SRSpacingType; SR1.Spacings = new ArrayList(SRSpacingList); SR1.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE; SR1.Insert(); ArrayList SRGeometryList = new ArrayList(SR1.GetRebarGeometries(false)); foreach (RebarGeometry item in SRGeometryList) { SR1RealDiameter = item.Diameter; } //Create rebar instance side rebar 2 (SR2) SR2.Father = inputFooting; SR2.StartPoint = leftBottomStart; SR2.EndPoint = leftBottomEnd; SR2.Polygons = new ArrayList { new Polygon { Points = new ArrayList { rightHalfStart, rightTopStart, rightBottomStart, leftHalfStart } } }; SR2.Size = _SRDiameter; SR2.RadiusValues = new ArrayList { _SRRadius }; SR2.Grade = _SRGrade; SR2.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL; SR2.Name = "flank"; SR2.Class = 6; SR2.NumberingSeries = new NumberingSeries { Prefix = "R", StartNumber = 1 }; SR2.StartHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }; SR2.EndHook = new RebarHookData { Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK }; SR2.StartPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS; SR2.StartPointOffsetValue = -0.5 * Overlappingsberekening.Overlappingslengte(Convert.ToInt32(_SRDiameter), material, true); SR2.EndPointOffsetType = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS; SR2.EndPointOffsetValue = -0.5 * Overlappingsberekening.Overlappingslengte(Convert.ToInt32(_SRDiameter), material, true); SR2.OnPlaneOffsets = new ArrayList { _CoverSide, _CoverSide, _CoverSide }; SR2.StartFromPlaneOffset = _CoverBottom; SR2.EndFromPlaneOffset = _CoverTop; SR2.SpacingType = SRSpacingType; SR2.Spacings = new ArrayList(SRSpacingList); SR2.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE; SR2.Insert(); } // //Modify rebars // //Modify BR1 BR1.StartPointOffsetValue = _CoverTop + _TR1Radius + TR1RealDiameter; BR1.EndPointOffsetValue = _CoverTop + _TR1Radius + TR1RealDiameter; if (_TR2Radius > _BR2Radius) { BR1.StartFromPlaneOffset = _CoverSide + TR2RealDiameter + _TR2Radius + TR1RealDiameter + SR1RealDiameter; } else { BR1.StartFromPlaneOffset = _CoverSide + BR2RealDiameter + _BR2Radius + TR1RealDiameter + SR1RealDiameter; } if (_TR2Radius > _BR2Radius) { BR1.EndFromPlaneOffset = _CoverSide + TR2RealDiameter + _TR2Radius + SR1RealDiameter; } else { BR1.EndFromPlaneOffset = _CoverSide + BR2RealDiameter + _BR2Radius + SR1RealDiameter; } BR1.OnPlaneOffsets = new ArrayList { _CoverSide + SR1RealDiameter, _CoverBottom, _CoverSide + SR1RealDiameter }; //Modify TR1 TR1.StartPointOffsetValue = _CoverBottom + _BR1Radius + BR1RealDiameter; TR1.EndPointOffsetValue = _CoverBottom + _BR1Radius + BR1RealDiameter; if (_TR2Radius > _BR2Radius) { TR1.StartFromPlaneOffset = _CoverSide + TR2RealDiameter + _TR2Radius + SR1RealDiameter; } else { TR1.StartFromPlaneOffset = _CoverSide + BR2RealDiameter + _BR2Radius + SR1RealDiameter; } if (_TR2Radius > _BR2Radius) { TR1.EndFromPlaneOffset = _CoverSide + TR2RealDiameter + _TR2Radius + BR1RealDiameter + SR1RealDiameter; } else { TR1.EndFromPlaneOffset = _CoverSide + BR2RealDiameter + _BR2Radius + BR1RealDiameter + SR1RealDiameter; } TR1.OnPlaneOffsets = new ArrayList { _CoverSide + SR1RealDiameter, _CoverTop, _CoverSide + SR1RealDiameter }; //Modify BR2 BR2.StartPointOffsetValue = _CoverTop + TR1RealDiameter + TR2RealDiameter + _TR2Radius; BR2.EndPointOffsetValue = _CoverTop + TR1RealDiameter + TR2RealDiameter + _TR2Radius; if (_TR1Radius > _BR1Radius) { BR2.StartFromPlaneOffset = _CoverSide + TR1RealDiameter + _TR1Radius - BR2RealDiameter * 0.5 + SR1RealDiameter; } else { BR2.StartFromPlaneOffset = _CoverSide + BR1RealDiameter + _BR1Radius - BR2RealDiameter * 0.5 + SR1RealDiameter; } if (_TR1Radius > _BR1Radius) { BR2.EndFromPlaneOffset = _CoverSide + TR1RealDiameter + _TR1Radius + TR2RealDiameter - TR2RealDiameter * 0.5 + SR1RealDiameter; } else { BR2.EndFromPlaneOffset = _CoverSide + BR1RealDiameter + _BR1Radius + TR2RealDiameter - TR2RealDiameter * 0.5 + SR1RealDiameter; } BR2.OnPlaneOffsets = new ArrayList { _CoverSide + SR1RealDiameter, _CoverBottom + BR1RealDiameter, _CoverSide + SR1RealDiameter }; //Modify TR2 TR2.StartPointOffsetValue = _CoverBottom + BR1RealDiameter + BR2RealDiameter + _BR2Radius; TR2.EndPointOffsetValue = _CoverBottom + BR1RealDiameter + BR2RealDiameter + _BR2Radius; if (_TR1Radius > _BR1Radius) { TR2.StartFromPlaneOffset = _CoverSide + TR1RealDiameter + _TR1Radius + BR2RealDiameter - BR2RealDiameter * 0.5 + SR1RealDiameter; } else { TR2.StartFromPlaneOffset = _CoverSide + BR1RealDiameter + _BR1Radius + BR2RealDiameter - BR2RealDiameter * 0.5 + SR1RealDiameter; } if (_TR1Radius > _BR1Radius) { TR2.EndFromPlaneOffset = _CoverSide + TR1RealDiameter + _TR1Radius - TR2RealDiameter * 0.5 + SR1RealDiameter; } else { TR2.EndFromPlaneOffset = _CoverSide + BR1RealDiameter + _BR1Radius - TR2RealDiameter * 0.5 + SR1RealDiameter; } TR2.OnPlaneOffsets = new ArrayList { _CoverSide + SR1RealDiameter, _CoverTop + TR1RealDiameter, _CoverSide + SR1RealDiameter }; //Modify SR1 SR1.StartFromPlaneOffset = _CoverBottom + _BR2Radius + BR1RealDiameter + SR1RealDiameter; SR1.EndFromPlaneOffset = _CoverTop + _TR2Radius + TR1RealDiameter; //Modify SR2 SR2.StartFromPlaneOffset = _CoverBottom + _BR2Radius + BR1RealDiameter; SR2.EndFromPlaneOffset = _CoverTop + _TR2Radius + TR2RealDiameter + SR1RealDiameter; // //insert modifications // BR1.Modify(); TR1.Modify(); BR2.Modify(); TR2.Modify(); SR1.Modify(); SR2.Modify(); //Set the phase of the rebar var rebarGroupList = new List <RebarGroup>() { BR1, TR1, BR2, TR2, SR1, SR2 }; foreach (RebarGroup item in rebarGroupList) { item.SetPhase(new Phase(221)); } } catch (Exception Exc) { MessageBox.Show(Exc.ToString()); } return(true); }