private void saveDXFBtn_Click(object sender, RoutedEventArgs e) { DxfModel model = new DxfModel(DxfVersion.Dxf14); double thickness = Convert.ToDouble(ttxtBox.Text); ///////////// /////////// //Comulative spanVals double[] comSpanVals = new double[nSpans + 1]; comSpanVals[0] = 0; for (int i = 1; i < comSpanVals.Length; i++) { comSpanVals[i] = comSpanVals[i - 1] + spanValues[i]; } /*---------*/ //Points Point2D[] startPointsBot = DXFPoints.BottomStartPoints(nSpans, comSpanVals); Point2D[] endPointsBot = DXFPoints.BottomEndPoints(nSpans, comSpanVals); Point2D[] startPointsTop = DXFPoints.TopStartPoints(nSpans, thickness, comSpanVals); Point2D[] endPointsTop = DXFPoints.TopEndPoints(nSpans, thickness, comSpanVals); /*---------Lines---------*/ DXFLines.ConstructBottomLines(model, nSpans, startPointsBot, endPointsBot); DXFLines.ConstructTopLines(model, nSpans, startPointsTop, endPointsTop); DXFLines.ConstructColLines(model, nSpans, thickness, startPointsBot, endPointsBot, startPointsTop, endPointsTop); DXFLines.ConstructGrids(model, nSpans, thickness, comSpanVals); /*---------Rebar---------*/ DxfLine[] BottomRFT = DXFRebar.BotRFT(model, nSpans, startPointsBot, endPointsBot); double[] Ln = DXFRebar.Lnet(nSpans, startPointsTop, endPointsTop); DxfLine[] TopSpan = DXFRebar.TopSpanRFT(model, nSpans, thickness, Ln, startPointsTop, endPointsTop); DxfLine[] TopSupport = DXFRebar.TopSupportRFT(model, nSpans, thickness, Ln, startPointsTop, endPointsTop); DXFRebar.Legs(model, nSpans, thickness, BottomRFT, TopSpan); /*---------Stirrups-------*/ DxfLine[,] stirrupsLeft = DXFRebar.StirrupsLeftSec(model, nSpans, thickness, startPointsBot); DxfLine[,] stirrupsMidspan = DXFRebar.StirrupsMidSpanSec(model, nSpans, thickness, startPointsBot, endPointsBot); DxfLine[,] stirrupsRight = DXFRebar.StirrupsRightSec(model, nSpans, thickness, endPointsBot); /*------------------------------Annotation------------------------------*/ DXFAnnotation.AnnotationStirLeft(model, nSpans, thickness, stirrupsLeft); DXFAnnotation.AnnotationStirMidSpan(model, nSpans, thickness, stirrupsMidspan); DXFAnnotation.AnnotationStirRight(model, nSpans, thickness, stirrupsRight); /*------------------------------Dimensions------------------------------*/ DXFDimClass.DrawGridDims(model, nSpans, comSpanVals); DXFDimClass.DrawLnetDims(model, nSpans, startPointsBot, endPointsBot, comSpanVals); DXFDimClass.DrawTopRFTRightDims(model, nSpans, thickness, Ln, startPointsTop, comSpanVals); DXFDimClass.DrawTopRFTLeftDims(model, nSpans, thickness, Ln, endPointsTop, comSpanVals); /*------------------------------Text------------------------------*/ double fystr = Convert.ToDouble(fstirtxtBox.Text); //01. RFT bottom Text int[] nRebarBot = DXFTextClass.GetnRebarBotArr(xbeams); double[] chosenDiameterBot = DXFTextClass.GetChosenDiameterArr(xbeams); DXFTextClass.BottomRFTTxt(model, nSpans, nRebarBot, chosenDiameterBot, Ln, startPointsBot); //02. RFT Top Support Text int[] nRebarTopSupportArr = DXFTextClass.GetnRebarTopSupportArr(xbeams); double[] chosenDiameterTopSupport = DXFTextClass.GetChosenDiameterTopSupportArr(xbeams); DXFTextClass.TopRFTSupportTxt(model, nSpans, thickness, nRebarTopSupportArr, chosenDiameterTopSupport, TopSpan, TopSupport); //03. Stirrups Left Section { double[] spacingLeftArr = DXFTextClass.GetSpacingLeftArr(xbeams, stirDiaArr240, stirDiaArr360, stirDiaArr400); int[] spacingLeftIndexes = DXFTextClass.GetSpacingLeftArrIndexes(xbeams, stirDiaArr240, stirDiaArr360, stirDiaArr400); DXFTextClass.StirrupLeftTxt(model, nSpans, stirrupsLeft, spacingLeftArr, spacingLeftIndexes, stirDiaArr240, stirDiaArr360, stirDiaArr400); } //05. Stirrups Right Section { double[] spacingRightArr = DXFTextClass.GetSpacingRightArr(xbeams, stirDiaArr240, stirDiaArr360, stirDiaArr400); int[] spacingRightIndexes = DXFTextClass.GetSpacingLeftArrIndexes(xbeams, stirDiaArr240, stirDiaArr360, stirDiaArr400); DXFTextClass.StirrupRightTxt(model, nSpans, stirrupsRight, spacingRightArr, spacingRightIndexes, stirDiaArr240, stirDiaArr360, stirDiaArr400); } ////04. Stirrups MidSpan //DXFTextClass.StirrupMidSpanTxt(model, nSpans, stirrupsMidspan); ////05. Stirrups Right Section //double[] spacingRightSec = DXFTextClass.GetSpacingRightArr(xbeams); //DXFTextClass.StirrupRightTxt(model, nSpans, stirrupsRight, spacingRightSec); /*------------------------------Create DXF File------------------------------*/ //Create DXF File DxfWriter.Write("Test12.dxf", model, true); }
private void Btn_DXFExport_Click(object sender, RoutedEventArgs e) { #region Save DXF DxfModel model = new DxfModel(DxfVersion.Dxf14); //double thickness = Convert.ToDouble(ttxtBox.Text); ///////////// /////////// //Comulative spanVals int nSpans = AnalysisMapping.spanList.Count; double[] comSpanVals = AnalysisMapping.comSpanValues; /*---------*/ //Points DXFPoints.TopStartPoints(nSpans, comSpanVals); DXFPoints.TopEndPoints(nSpans, comSpanVals); DXFPoints.BottomStartPoints(nSpans, RFTCanvas.thickness, comSpanVals); DXFPoints.BottomEndPoints(nSpans, RFTCanvas.thickness, comSpanVals); /*---------Lines---------*/ DXFLines.ConstructBottomLines(model, nSpans); DXFLines.ConstructTopLines(model, nSpans); DXFLines.ConstructColLines(model, nSpans); DXFLines.ConstructGrids(model, nSpans, comSpanVals); /*---------Rebar---------*/ DXFRebar.BotRFT(model, nSpans); DXFRebar.Lnet(nSpans); DXFRebar.TopSpanRFT(model, nSpans); DXFRebar.TopSupportRFT(model, nSpans); DXFRebar.Legs(model, nSpans); /*---------Stirrups-------*/ DXFRebar.StirrupsLeftSec(model, nSpans); //DXFRebar.StirrupsMidSpanSec(model, nSpans); DXFRebar.StirrupsRightSec(model, nSpans); /*------------------------------Annotation------------------------------*/ DXFAnnotation.AnnotationStirLeft(model, nSpans); //DXFAnnotation.AnnotationStirMidSpan(model, nSpans, RFTCanvas.thickness[0], stirrupsMidspan); DXFAnnotation.AnnotationStirRight(model, nSpans); /*------------------------------Dimensions------------------------------*/ DXFDimClass.DrawGridDims(model, nSpans, comSpanVals); DXFDimClass.DrawLnetDims(model, nSpans, comSpanVals); DXFDimClass.DrawTopRFTRightDims(model, nSpans, comSpanVals); DXFDimClass.DrawTopRFTLeftDims(model, nSpans, comSpanVals); /*------------------------------Text------------------------------*/ //double fystr = Convert.ToDouble(fstirtxtBox.Text); //01. RFT bottom Text DXFTextClass.GetnRebarBotArr(AnalysisMapping.xbeams); DXFTextClass.GetChosenDiameterArr(AnalysisMapping.xbeams); DXFTextClass.BottomRFTTxt(model, nSpans); //02. RFT Top Support Text DXFTextClass.GetnRebarTopSupportArr(AnalysisMapping.xbeams); DXFTextClass.GetChosenDiameterTopSupportArr(AnalysisMapping.xbeams); DXFTextClass.TopRFTSupportTxt(model, nSpans); //03. Stirrups Left Section { DXFTextClass.GetSpacingLeftArr(AnalysisMapping.xbeams); //DXFTextClass.GetSpacingLeftArrIndexes(AnalysisMapping.xbeams); DXFTextClass.StirrupLeftTxt(model, nSpans); } //05. Stirrups Right Section { DXFTextClass.GetSpacingRightArr(AnalysisMapping.xbeams); DXFTextClass.StirrupRightTxt(model, nSpans); } ////04. Stirrups MidSpan //DXFTextClass.StirrupMidSpanTxt(model, nSpans, stirrupsMidspan); ////05. Stirrups Right Section //double[] spacingRightSec = DXFTextClass.GetSpacingRightArr(xbeams); //DXFTextClass.StirrupRightTxt(model, nSpans, stirrupsRight, spacingRightSec); /*------------------------------Create DXF File------------------------------*/ //Create DXF File //DxfWriter.Write("D:\\dxf\\Test12.dxf", model, true); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".dxf"; // Default file extension dlg.Filter = "Text documents (.txt)|*.txt"; // Filter files by extension // Show save file dialog box Nullable <bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document string filename = dlg.FileName; DxfWriter.Write(filename, model, true); } #endregion }