private static DxfModel CreateModelWithAxes() { DxfModel model; model = new DxfModel(); double width = 100d; double height = 100d; DxfLine xaxis = new DxfLine(new Point2D(0d, 0d), new Point2D(width, 0d)); xaxis.Color = EntityColors.LightGray; model.Entities.Add(xaxis); DxfLine yaxis = new DxfLine(new Point2D(0d, 0d), new Point2D(0d, height)); yaxis.Color = EntityColors.LightGray; model.Entities.Add(yaxis); DxfText originLabel = new DxfText("0", new Point3D(-1d, -1d, 0d), 0.5d); originLabel.Color = EntityColors.GreenYellow; model.Entities.Add(originLabel); DxfText xaxisLabel = new DxfText("10", new Point3D(width, -1d, 0d), 0.5d); xaxisLabel.Color = EntityColors.GreenYellow; model.Entities.Add(xaxisLabel); DxfText yaxisLabel = new DxfText("10", new Point3D(-1, height, 0d), 0.5d); yaxisLabel.Color = EntityColors.GreenYellow; model.Entities.Add(yaxisLabel); return model; }
public static void TopSupportRFT(DxfModel model, int nSpans) { TopSupport = new DxfLine[nSpans - 1]; //Case Of Cantilever Start Span if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints) { TopSupport[0] = new DxfLine(EntityColors.Blue, new Point2D(DXFPoints.endPointsTop[0].X - Math.Max(0.33 * Ln[0], 0.33 * Ln[1]) - 0.25, DXFPoints.endPointsTop[0].Y - 0.05) , new Point2D(DXFPoints.startPointsTop[1].X + Math.Max(0.33 * Ln[0], 0.33 * Ln[1]) + 0.25, DXFPoints.startPointsTop[1].Y - 0.05)); model.Entities.Add(TopSupport[0]); } for (int i = 1; i < TopSupport.Length - 1; i++) { TopSupport[i] = new DxfLine(EntityColors.Blue, new Point2D(DXFPoints.endPointsTop[i].X - Math.Max(0.33 * Ln[i], 0.33 * Ln[i + 1]) - 0.25, DXFPoints.endPointsTop[i].Y - 0.05) , new Point2D(DXFPoints.startPointsTop[i + 1].X + Math.Max(0.33 * Ln[i], 0.33 * Ln[i + 1]) + 0.25, DXFPoints.startPointsTop[i + 1].Y - 0.05)); model.Entities.Add(TopSupport[i]); } //Case of Cantilever end Span if (GeometryEditorVM.GeometryEditor.RestraintsCollection[SpanVals.Length].SelectedRestraint != Restraints.NoRestraints) { TopSupport[TopSupport.Length - 1] = new DxfLine(EntityColors.Blue, new Point2D(DXFPoints.endPointsTop[TopSupport.Length - 1].X - Math.Max(0.33 * Ln[TopSupport.Length - 1], 0.33 * Ln[TopSupport.Length - 1 + 1]) - 0.25, DXFPoints.endPointsTop[TopSupport.Length - 1].Y - 0.05) , new Point2D(DXFPoints.startPointsTop[TopSupport.Length - 1 + 1].X + Math.Max(0.33 * Ln[TopSupport.Length - 1], 0.33 * Ln[TopSupport.Length - 1 + 1]) + 0.25, DXFPoints.startPointsTop[TopSupport.Length - 1 + 1].Y - 0.05)); model.Entities.Add(TopSupport[TopSupport.Length - 1]); } }
public void WriteMultipleXDataFromEntityTest() { var file = new DxfFile(); file.Header.Version = DxfAcadVersion.R14; var line = new DxfLine(); line.XData["group_name_1"] = new DxfXDataApplicationItemCollection( new DxfXDataReal(1.0), new DxfXDataReal(2.0) ); line.XData["group_name_2"] = new DxfXDataApplicationItemCollection( new DxfXDataItemList(new[] { new DxfXDataWorldSpacePosition(new DxfPoint(11.0, 22.0, 33.0)) }), new DxfXDataReal(3.0) ); file.Entities.Add(line); VerifyFileContains(file, DxfSectionType.Entities, (1001, "group_name_1"), (1040, 1.0), (1040, 2.0), (1001, "group_name_2"), (1002, "{"), (1011, 11.0), (1021, 22.0), (1031, 33.0), (1002, "}"), (1040, 3.0) ); }
public static void ConstructGrids(DxfModel model, int nSpans, double[] comSpanVals) { DxfLine[] grids = new DxfLine[nSpans + 1]; //Case of Cantilever at start //if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints) //{ // grids[0] = new DxfLine(EntityColors.Red, new Point2D(comSpanVals[0], DXFPoints.startPointsTop[0].Y - 2) // , new Point2D(comSpanVals[0], DXFPoints.startPointsTop[0].Y + 1)); // model.Entities.Add(grids[0]); //} for (int i = 0; i < grids.Length; i++) { grids[i] = new DxfLine(EntityColors.Red, new Point2D(comSpanVals[i], DXFPoints.startPointsTop[0].Y - 2) , new Point2D(comSpanVals[i], DXFPoints.startPointsTop[0].Y + 1)); model.Entities.Add(grids[i]); } //Case of Cantilever at End //if (GeometryEditorVM.GeometryEditor.RestraintsCollection[RFTCanvas.SpanVals.Length].SelectedRestraint != Restraints.NoRestraints) //{ // grids[grids.Length - 1] = new DxfLine(EntityColors.Red, new Point2D(comSpanVals[grids.Length - 1], DXFPoints.startPointsTop[0].Y - 2) // , new Point2D(comSpanVals[grids.Length - 1], DXFPoints.startPointsTop[0].Y + 1)); // model.Entities.Add(grids[grids.Length - 1]); //} }
public static DxfLine[] BotRFT(DxfModel model, int nSpans, Point2D[] startPointsBot, Point2D[] endPointsBot) { DxfLine[] BottomRFT = new DxfLine[nSpans]; BottomRFT[0] = new DxfLine(EntityColors.Blue, new Point2D(startPointsBot[0].X - 0.25, 0.05), new Point2D(endPointsBot[0].X + 0.35, 0.05)); model.Entities.Add(BottomRFT[0]); for (int i = 1; i < BottomRFT.Length - 1; i++) { if (i % 2 == 1) { BottomRFT[i] = new DxfLine(EntityColors.Blue, new Point2D(startPointsBot[i].X - 0.35, 0.07), new Point2D(endPointsBot[i].X + 0.35, 0.07)); } else { BottomRFT[i] = new DxfLine(EntityColors.Blue, new Point2D(startPointsBot[i].X - 0.35, 0.05), new Point2D(endPointsBot[i].X + 0.35, 0.05)); } model.Entities.Add(BottomRFT[i]); } if ((nSpans - 1) % 2 == 1) { BottomRFT[nSpans - 1] = new DxfLine(EntityColors.Blue, new Point2D(startPointsBot[nSpans - 1].X - 0.35, 0.07), new Point2D(endPointsBot[nSpans - 1].X + 0.25, 0.07)); } else if ((nSpans - 1) % 2 == 0) { BottomRFT[nSpans - 1] = new DxfLine(EntityColors.Blue, new Point2D(startPointsBot[nSpans - 1].X - 0.35, 0.05), new Point2D(endPointsBot[nSpans - 1].X + 0.25, 0.05)); } model.Entities.Add(BottomRFT[nSpans - 1]); return(BottomRFT); }
public void GetInsertEntitiesWhenAddedToFile() { var line = new DxfLine(new DxfPoint(0.0, 0.0, 0.0), new DxfPoint(1.0, 1.0, 0.0)); var block = new DxfBlock(); block.Name = "some-block"; block.Entities.Add(line); var insert = new DxfInsert(); insert.Name = "some-block"; var file = new DxfFile(); file.Blocks.Add(block); // no entities because it's not yet part of the file Assert.Null(insert.Entities); file.Entities.Add(insert); // and now that it's in the file the entities can be found var foundEntity = insert.Entities.Single(); Assert.Same(line, foundEntity); }
//public static DxfLine[,] StirrupsMidSpanSec(DxfModel model, int nSpans, double thickness, Point2D[] startPointsBot, Point2D[] endPointsBot) //{ // double spacingMidSpan = 0; // double sec2Spacing = 150; // DxfLine[,] stirrupsMidspan = new DxfLine[nSpans, 3]; // for (int i = 0; i < stirrupsMidspan.GetLength(0); i++) // { // spacingMidSpan = 0; // for (int j = 0; j < stirrupsMidspan.GetLength(1); j++) // { // stirrupsMidspan[i, j] = new DxfLine(new Point2D(startPointsBot[i].X + 0.50 * (endPointsBot[i].X - startPointsBot[i].X) - 0.15 + (spacingMidSpan / 1000), 0.07) // , new Point2D(startPointsBot[i].X + 0.50 * (endPointsBot[i].X - startPointsBot[i].X) - 0.15 + (spacingMidSpan / 1000), thickness - 0.07)); // model.Entities.Add(stirrupsMidspan[i, j]); // spacingMidSpan += sec2Spacing; // } // } // return stirrupsMidspan; //} public static void StirrupsRightSec(DxfModel model, int nSpans) { double spacingRight = 0; double sec3Spacing = 150; stirrupsRight = new DxfLine[nSpans, 3]; for (int i = 0; i < stirrupsRight.GetLength(0) - 1; i++) { spacingRight = 0; for (int j = 0; j < stirrupsRight.GetLength(1); j++) { stirrupsRight[i, j] = new DxfLine(new Point2D(DXFPoints.endPointsBot[i].X - 0.05 - (spacingRight / 1000), DXFPoints.endPointsTop[i].Y /*- 0.05*/) , new Point2D(DXFPoints.endPointsBot[i].X - 0.05 - (spacingRight / 1000), DXFPoints.endPointsBot[i].Y /*+ 0.07*/)); model.Entities.Add(stirrupsRight[i, j]); spacingRight += sec3Spacing; } } /*--------Case Of Cantilever At End ----------*/ if (GeometryEditorVM.GeometryEditor.RestraintsCollection[RFTCanvas.SpanVals.Length].SelectedRestraint != Restraints.NoRestraints) { spacingRight = 0; for (int j = 0; j < stirrupsRight.GetLength(1); j++) { stirrupsRight[stirrupsRight.GetLength(0) - 1, j] = new DxfLine(new Point2D(DXFPoints.endPointsBot[stirrupsRight.GetLength(0) - 1].X - 0.05 - (spacingRight / 1000), DXFPoints.endPointsTop[stirrupsRight.GetLength(0) - 1].Y /*- 0.05*/) , new Point2D(DXFPoints.endPointsBot[stirrupsRight.GetLength(0) - 1].X - 0.05 - (spacingRight / 1000), DXFPoints.endPointsBot[stirrupsRight.GetLength(0) - 1].Y /*+ 0.07*/)); model.Entities.Add(stirrupsRight[stirrupsRight.GetLength(0) - 1, j]); spacingRight += sec3Spacing; } } }
/*-------------Stirrups-------------*/ public static void StirrupsLeftSec(DxfModel model, int nSpans) { double spacingLeft = 0; double sec1Spacing = 150; stirrupsLeft = new DxfLine[nSpans, 3]; /*------Case Of Cantilever At Start --------*/ if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints) { spacingLeft = 0; for (int j = 0; j < stirrupsLeft.GetLength(1); j++) { stirrupsLeft[0, j] = new DxfLine(new Point2D(DXFPoints.startPointsBot[0].X + 0.05 + (spacingLeft / 1000), DXFPoints.startPointsTop[0].Y /* - 0.05*/) , new Point2D(DXFPoints.startPointsBot[0].X + 0.05 + (spacingLeft / 1000), DXFPoints.startPointsBot[0].Y /*--*/ /*+ 0.07*/)); model.Entities.Add(stirrupsLeft[0, j]); spacingLeft += sec1Spacing; } } for (int i = 1; i < stirrupsLeft.GetLength(0); i++) { spacingLeft = 0; for (int j = 0; j < stirrupsLeft.GetLength(1); j++) { stirrupsLeft[i, j] = new DxfLine(new Point2D(DXFPoints.startPointsBot[i].X + 0.05 + (spacingLeft / 1000), DXFPoints.startPointsTop[i].Y /* - 0.05*/) , new Point2D(DXFPoints.startPointsBot[i].X + 0.05 + (spacingLeft / 1000), DXFPoints.startPointsBot[i].Y /*--*/ /*+ 0.07*/)); model.Entities.Add(stirrupsLeft[i, j]); spacingLeft += sec1Spacing; } } }
/// <summary> /// 绘制风扇 /// </summary> /// <param name="dxf"></param> /// <param name="startPoint">风扇起点,如果为横置,由左向右;如果为竖置,由下到上</param> /// <param name="endPoint">风扇终点,如果为横置,由左向右;如果为竖置,由下到上</param> /// <param name="pointerDDLocation">箭头位置,默认=0为无,=1代表箭头在中间,=2代表箭头在底部</param> public static void Draw(DxfModel dxf, Point3D startPoint, Point3D endPoint, int pointerDDLocation = 0) { DxfLine DxfLine = new DxfLine(startPoint, endPoint); dxf.Entities.Add(DxfLine); //如果为横置 if (startPoint.Y == endPoint.Y) { double segment = (endPoint.X - startPoint.X) / 4; Slash.Draw(dxf, new DLocation(startPoint.X + segment, startPoint.Y, startPoint.Z)); Slash.Draw(dxf, new DLocation(startPoint.X + 2 * segment, startPoint.Y, startPoint.Z)); Slash.Draw(dxf, new DLocation(startPoint.X + 3 * segment, startPoint.Y, startPoint.Z)); } //如果为竖置 else if (startPoint.X == endPoint.X) { double segment = (endPoint.Y - startPoint.Y) / 5; Slash.Draw(dxf, new DLocation(startPoint.X, startPoint.Y + segment, startPoint.Z)); Slash.Draw(dxf, new DLocation(startPoint.X, startPoint.Y + 2 * segment, startPoint.Z)); Slash.Draw(dxf, new DLocation(startPoint.X, startPoint.Y + 3 * segment, startPoint.Z)); Slash.Draw(dxf, new DLocation(startPoint.X, startPoint.Y + 4 * segment, startPoint.Z)); if (pointerDDLocation == 1) { DxfLinePointer.Draw(dxf,new DLocation(startPoint.X,(startPoint.Y+endPoint.Y)/2,startPoint.Z)); } else if(pointerDDLocation==2) { DxfLinePointer.Draw(dxf, new DLocation(startPoint.X, startPoint.Y, startPoint.Z)); } } }
public void InsertBoundingBox() { var line = new DxfLine(new DxfPoint(1.0, 1.0, 0.0), new DxfPoint(2.0, 3.0, 0.0)); var offset = new DxfVector(2.0, 2.0, 0.0); var block = new DxfBlock(); block.Name = "some-block"; block.Entities.Add(line); var insert = new DxfInsert(); insert.Name = "some-block"; insert.Location = offset; insert.XScaleFactor = 2.0; var file = new DxfFile(); file.Blocks.Add(block); file.Entities.Add(insert); var boundingBox = file.GetBoundingBox(); Assert.Equal(new DxfPoint(4.0, 3.0, 0.0), boundingBox.MinimumPoint); Assert.Equal(new DxfPoint(6.0, 5.0, 0.0), boundingBox.MaximumPoint); }
public string EntityToJson(DxfLine dxfLine) { return(string.Format(Format, "[\"line\",{0:F},{1:F},{2:F},{3:F}]", dxfLine.P1.X, dxfLine.P1.Y, dxfLine.P2.X, dxfLine.P2.Y)); }
public static void Draw(DxfModel dxf, DLocation DLocation) { Point3D v1 = new Point3D(DLocation.X - 0.5d, DLocation.Y - 1.0d, DLocation.Z); Point3D v2 = new Point3D(DLocation.X + 0.5d, DLocation.Y + 1.0d, DLocation.Z); DxfLine DxfLine12 = new DxfLine(v1, v2); dxf.Entities.Add(DxfLine12); }
public void RenderEntity(DxfLine dxfLine, Graphics graphics, int height) { graphics.DrawLine(Pens.Black, (float)dxfLine.P1.X * ScaleFactor + OffsetX, height - (float)dxfLine.P1.Y * ScaleFactor + OffsetY, (float)dxfLine.P2.X * ScaleFactor + OffsetX, height - (float)dxfLine.P2.Y * ScaleFactor + OffsetY); }
public void FileBoundingBoxTest() { var file = new DxfFile(); var line = new DxfLine(new DxfPoint(0.0, 1.0, 0.0), new DxfPoint(1.0, 0.0, 0.0)); file.Entities.Add(line); Assert.Equal(new DxfBoundingBox(DxfPoint.Origin, new DxfVector(1.0, 1.0, 0.0)), file.GetBoundingBox()); }
public static void ConstructGrids(DxfModel model, int nSpans, double thickness, double[] comSpanVals) { DxfLine[] grids = new DxfLine[nSpans + 1]; for (int i = 0; i < grids.Length; i++) { grids[i] = new DxfLine(EntityColors.Red, new Point2D(comSpanVals[i], -1), new Point2D(comSpanVals[i], thickness + 1)); model.Entities.Add(grids[i]); } }
public static void ConstructBottomLines(DxfModel model, int nSpans, Point2D[] startPointsBot, Point2D[] endPointsBot) { DxfLine[] linesBot = new DxfLine[nSpans]; for (int i = 0; i < nSpans; i++) { linesBot[i] = new DxfLine(startPointsBot[i], endPointsBot[i]); model.Entities.Add(linesBot[i]); } }
public static void ConstructTopLines(DxfModel model, int nSpans, Point2D[] startPointsTop, Point2D[] endPointsTop) { DxfLine[] linesTop = new DxfLine[nSpans]; for (int i = 0; i < nSpans; i++) { linesTop[i] = new DxfLine(startPointsTop[i], endPointsTop[i]); model.Entities.Add(linesTop[i]); } }
private DxfLine ReadLineExtension3D(BinaryReader reader) { var x = ReadN(reader); var y = ReadN(reader); var z = ReadN(reader); var line = new DxfLine(_lastLinePoint, new DxfPoint(x, y, z)); _lastLinePoint = line.P2; return(line); }
private DxfLine ReadLineExtension(BinaryReader reader) { var x = ReadN(reader); var y = ReadN(reader); var to = new DxfPoint(x, y, 0.0); var line = new DxfLine(_lastLinePoint, to); _lastLinePoint = to; return(line); }
private static IEnumerable <IPdfPathItem> ConvertLine(DxfLine line, DxfLayer layer, Matrix4 affine) { var p1 = affine.Transform(line.P1).ToPdfPoint(PdfMeasurementType.Point); var p2 = affine.Transform(line.P2).ToPdfPoint(PdfMeasurementType.Point); var pdfStreamState = new PdfStreamState( strokeColor: GetPdfColor(line, layer), strokeWidth: GetStrokeWidth(line, layer)); yield return(new PdfLine(p1, p2, pdfStreamState)); }
void ProcessDxfLine(DxfLine dxfLine) { PicSegment picSegment = Factory.AddSegment( DxfColor2PicLT(dxfLine), 0, 0 , new Vector2D(dxfLine.P1.X, dxfLine.P1.Y) , new Vector2D(dxfLine.P2.X, dxfLine.P2.Y) ); picSegment.Group = DxfLayer2PicGrp(dxfLine.Layer); }
public static DxfLine AtHeight(this DxfLine line, double z) { var newLine = new DxfLine(line.P1.AtHeight(z), line.P2.AtHeight(z)) { Thickness = line.Thickness, ColorName = line.ColorName }; return(newLine); }
private void WriteLine(DxfLine line) { WriteItemType(DxbItemType.Line); WriteN(line.P1.X); WriteN(line.P1.Y); WriteN(line.P1.Z); WriteN(line.P2.X); WriteN(line.P2.Y); WriteN(line.P2.Z); }
public void RenderLineTest() { var line = new DxfLine(new DxfPoint(1.0, 2.0, 3.0), new DxfPoint(4.0, 5.0, 6.0)); var expected = new XElement("line", new XAttribute("x1", "1.0"), new XAttribute("y1", "2.0"), new XAttribute("x2", "4.0"), new XAttribute("y2", "5.0"), new XAttribute("stroke-width", "1.0px"), new XAttribute("vector-effect", "non-scaling-stroke")); var actual = line.ToXElement(); AssertXElement(expected, actual); }
public static DxfLine[] TopSupportRFT(DxfModel model, int nSpans, double thickness, double[] Ln, Point2D[] startPointsTop, Point2D[] endPointsTop) { DxfLine[] TopSupport = new DxfLine[nSpans - 1]; for (int i = 0; i < TopSupport.Length; i++) { TopSupport[i] = new DxfLine(EntityColors.Blue, new Point2D(endPointsTop[i].X - Math.Max(0.33 * Ln[i], 0.33 * Ln[i + 1]) - 0.25, thickness - 0.05) , new Point2D(startPointsTop[i + 1].X + Math.Max(0.33 * Ln[i], 0.33 * Ln[i + 1]) + 0.25, thickness - 0.05)); model.Entities.Add(TopSupport[i]); } return(TopSupport); }
public static XElement ToXElement(this DxfLine line) { return(new XElement(DxfToSvgConverter.Xmlns + "line", new XAttribute("x1", line.P1.X.ToDisplayString()), new XAttribute("y1", line.P1.Y.ToDisplayString()), new XAttribute("x2", line.P2.X.ToDisplayString()), new XAttribute("y2", line.P2.Y.ToDisplayString())) .AddStroke(line.Color) .AddStrokeWidth(line.Thickness) .AddVectorEffect()); }
public static void Draw(DxfModel dxf, DLocation DLocation) { Point3D v1 = new Point3D(DLocation.X - 2.0d, DLocation.Y + 4.0d, DLocation.Z); Point3D v2 = new Point3D(DLocation.X + 2.0d, DLocation.Y + 4.0d, DLocation.Z); Point3D v0=new Point3D(DLocation.X,DLocation.Y,DLocation.Z); DxfLine DxfLine10 = new DxfLine(v0, v1); dxf.Entities.Add(DxfLine10); DxfLine DxfLine20 = new DxfLine(v0, v2); dxf.Entities.Add(DxfLine20); }
private IEnumerable <DxfLine> TraceDxf(DxfFile dxf, Settings settings, double unitsConversion) { var lines = GetLines(dxf, settings) .Select(l => Move.Scale(l, unitsConversion)) .ToArray(); if (!lines.Any()) { yield break; } var points = lines.SelectMany(l => new[] { l.P1, l.P2 }).Distinct().ToArray(); var minX = points.Min(p => p.X); var minY = points.Min(p => p.Y); var maxX = points.Max(p => p.X); var maxY = points.Max(p => p.Y); var totalX = maxX - minX; var totalY = maxY - minY; Console.WriteLine($"{totalX:F4}w x {totalY:F4}y"); var offsetAndTransformOriginX = -settings.OffsetX - minX; var offsetAndTransformOriginY = -settings.OffsetY - minY; var moveHeight = 0; var aboveOrigin = new DxfPoint(0, 0, moveHeight); yield return(Move.CreateMove(aboveOrigin, aboveOrigin, moveHeight)); yield return(Move.Transform( Move.CreateMove( new DxfPoint(minX, minY, moveHeight), lines[0].P1, moveHeight), offsetAndTransformOriginX, offsetAndTransformOriginY, moveHeight )); DxfLine lastLine = null; foreach (var line in lines) { lastLine = Move.Transform(line, offsetAndTransformOriginX, offsetAndTransformOriginY, line.P1.Z); yield return(lastLine); } yield return(Move.CreateMove(lastLine.P2, lastLine.P2, moveHeight)); yield return(Move.CreateMove(lastLine.P2, new DxfPoint(settings.OffsetX, settings.OffsetY, moveHeight), moveHeight)); }
/// <summary> /// 风向绘制 /// </summary> /// <param name="dxf"></param> /// <param name="DLocation"></param> /// <param name="isRight"></param> public static void Draw(DxfModel dxf, DLocation DLocation, bool isRight) { double factor = 0.5f; Point3D v1 = new Point3D(); Point3D v2 = new Point3D(); Point3D v3 = new Point3D(); Point3D v4 = new Point3D(); Point3D v5 = new Point3D(); Point3D v6 = new Point3D(); Point3D v7 = new Point3D(); if (isRight) { v1 = new Point3D(10*factor + DLocation.X, DLocation.Y, DLocation.Z); v2 = new Point3D(DLocation.X, DLocation.Y + 10 * factor, DLocation.Z); v3 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 10 * factor, DLocation.Z); v4 = new Point3D(DLocation.X + 20 * factor, DLocation.Y + 15 * factor, DLocation.Z); v5 = new Point3D(DLocation.X, DLocation.Y + 20 * factor, DLocation.Z); v6 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 20 * factor, DLocation.Z); v7 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 30 * factor, DLocation.Z); } else { v1 = new Point3D(10 * factor + DLocation.X, DLocation.Y, DLocation.Z); v2 = new Point3D(DLocation.X + 20 * factor, DLocation.Y + 10 * factor, DLocation.Z); v3 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 10 * factor, DLocation.Z); v4 = new Point3D(DLocation.X, DLocation.Y + 15 * factor, DLocation.Z); v5 = new Point3D(DLocation.X + 20 * factor, DLocation.Y + 20 * factor, DLocation.Z); v6 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 20 * factor, DLocation.Z); v7 = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 30 * factor, DLocation.Z); } DxfLine DxfLine23 = new DxfLine(v2, v3); dxf.Entities.Add(DxfLine23); DxfLine DxfLine56 = new DxfLine(v5, v6); dxf.Entities.Add(DxfLine56); DxfLine DxfLine14 = new DxfLine(v1, v4); dxf.Entities.Add(DxfLine14); DxfLine DxfLine74 = new DxfLine(v7, v4); dxf.Entities.Add(DxfLine74); DxfLine DxfLine25 = new DxfLine(v2, v5); dxf.Entities.Add(DxfLine25); DxfLine DxfLine71 = new DxfLine(v7, v1); dxf.Entities.Add(DxfLine71); }
public static DxfLine Scale(DxfLine line, double ratio) { var p1 = new DxfPoint( line.P1.X * ratio, line.P1.Y * ratio, line.P1.Z ); var p2 = new DxfPoint( line.P2.X * ratio, line.P2.Y * ratio, line.P2.Z ); var result = IsMove(line) ? CreateMove(p1, p2, p2.Z) : CreateLine(p1, p2, p2.Z); return(result); }
public static DxfLine Transform(DxfLine line, double negativeOffsetX, double negativeOffsetY, double z) { var p1 = new DxfPoint( line.P1.X + negativeOffsetX, line.P1.Y + negativeOffsetY, 0 ); var p2 = new DxfPoint( line.P2.X + negativeOffsetX, line.P2.Y + negativeOffsetY, 0 ); var result = IsMove(line) ? CreateMove(p1, p2, z) : CreateLine(p1, p2, z); return(result); }
/*-------------Stirrups-------------*/ public static void StirrupsLeftSec(DxfModel model, int nSpans) { double spacingLeft = 0; double sec1Spacing = 150; stirrupsLeft = new DxfLine[nSpans, 3]; for (int i = 0; i < stirrupsLeft.GetLength(0); i++) { spacingLeft = 0; for (int j = 0; j < stirrupsLeft.GetLength(1); j++) { stirrupsLeft[i, j] = new DxfLine(new Point2D(DXFPoints.startPointsBot[i].X + 0.05 + (spacingLeft / 1000), 0.05) , new Point2D(DXFPoints.startPointsBot[i].X + 0.05 + (spacingLeft / 1000), DXFPoints.startPointsBot[i].Y /*--*/ - 0.07)); model.Entities.Add(stirrupsLeft[i, j]); spacingLeft += sec1Spacing; } } }
public void WriteEntityWithNullLayerTest() { var line = new DxfLine() { Layer = "" }; EnsureFileContainsEntity(line, @" 0 LINE 5 # 100 AcDbEntity 8 0 "); }
public static List<DxfEntity> Create(int xNum, int yNum, double xLen, double yLen, double thickness) { List<DxfEntity> entities = new List<DxfEntity>(); List<List<Point2D>> ptsVector = new List<List<Point2D>>(); for (int row = 0; row < yNum; row++) { List<Point2D> ptsSameRow = new List<Point2D>(); bool isEvenLine = row % 2 == 0; double xOffset = isEvenLine ? xLen / 2.0 : 0; for (int col = 0; col < xNum; col++) { double xPos = xOffset + col * xLen; double yPos = row * yLen; ptsSameRow.Add(new Point2D(xPos, yPos)); } ptsVector.Add(ptsSameRow); } for (int r = 0; r < yNum - 1; r++) { List<Point2D> bottomRow = ptsVector[r]; List<Point2D> upperRow = ptsVector[r+1]; for (int c = 0; c < xNum; c++) { bool isEvenLine = r % 2 == 0; Point2D ptStart = bottomRow[c]; Point2D ptEnd1 = upperRow[c]; var line = new DxfLine(ptStart, ptEnd1); line.Thickness = thickness; line.Color = EntityColors.White; entities.Add(line); int ptEnd2Col = isEvenLine ? c + 1 : c - 1; if (ptEnd2Col < 0 || ptEnd2Col >= xNum) continue; Point2D ptEnd2 = upperRow[ptEnd2Col]; line = new DxfLine(ptStart, ptEnd2); line.Color = EntityColors.White; line.Thickness = thickness; entities.Add(line); } } return entities; }
public static DxfLine[,] StirrupsRightSec(DxfModel model, int nSpans, double thickness, Point2D[] endPointsBot) { double spacingRight = 0; double sec3Spacing = 150; DxfLine[,] stirrupsRight = new DxfLine[nSpans, 3]; for (int i = 0; i < stirrupsRight.GetLength(0); i++) { spacingRight = 0; for (int j = 0; j < stirrupsRight.GetLength(1); j++) { stirrupsRight[i, j] = new DxfLine(new Point2D(endPointsBot[i].X - 0.05 - (spacingRight / 1000), 0.05) , new Point2D(endPointsBot[i].X - 0.05 - (spacingRight / 1000), thickness - 0.07)); model.Entities.Add(stirrupsRight[i, j]); spacingRight += sec3Spacing; } } return(stirrupsRight); }
public static DxfLine[,] StirrupsMidSpanSec(DxfModel model, int nSpans, double thickness, Point2D[] startPointsBot, Point2D[] endPointsBot) { double spacingMidSpan = 0; double sec2Spacing = 150; DxfLine[,] stirrupsMidspan = new DxfLine[nSpans, 3]; for (int i = 0; i < stirrupsMidspan.GetLength(0); i++) { spacingMidSpan = 0; for (int j = 0; j < stirrupsMidspan.GetLength(1); j++) { stirrupsMidspan[i, j] = new DxfLine(new Point2D(startPointsBot[i].X + 0.50 * (endPointsBot[i].X - startPointsBot[i].X) - 0.15 + (spacingMidSpan / 1000), 0.07) , new Point2D(startPointsBot[i].X + 0.50 * (endPointsBot[i].X - startPointsBot[i].X) - 0.15 + (spacingMidSpan / 1000), thickness - 0.07)); model.Entities.Add(stirrupsMidspan[i, j]); spacingMidSpan += sec2Spacing; } } return(stirrupsMidspan); }
/// <summary> /// 绘制左下角区域的Section块 /// </summary> /// <param name="dxf"></param> /// <param name="DLocation"></param> /// <param name="configurations"></param> public static void Draw(DxfModel dxf, DLocation DLocation,SectionEntity sectionEntity) { double factor=0.6f; Point3D v1 = new Point3D(DLocation.X, DLocation.Y + 40.0d*factor, DLocation.Z); Point3D v2 = new Point3D(DLocation.X + 50.0d * factor, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v3 = new Point3D(DLocation.X + 90.0d * factor, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v4 = new Point3D(DLocation.X + 140.0d * factor, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v5 = new Point3D(DLocation.X, DLocation.Y + 50.0d * factor, DLocation.Z); Point3D v6 = new Point3D(DLocation.X + 140.0d * factor, DLocation.Y + 50.0d * factor, DLocation.Z); Point3D v7 = new Point3D(DLocation.X, DLocation.Y + 60.0d * factor, DLocation.Z); Point3D v8 = new Point3D(DLocation.X + 140.0d * factor, DLocation.Y + 60.0d * factor, DLocation.Z); Point3D v9 = new Point3D(DLocation.X, DLocation.Y + 70.0d * factor, DLocation.Z); Point3D v10 = new Point3D(DLocation.X + 50.0d * factor, DLocation.Y + 70.0d * factor, DLocation.Z); Point3D v11 = new Point3D(DLocation.X + 90.0d * factor, DLocation.Y + 70.0d * factor, DLocation.Z); Point3D v12 = new Point3D(DLocation.X + 140.0d * factor, DLocation.Y + 70.0d * factor, DLocation.Z); //横向四道 DxfLine DxfLine14 = new DxfLine(v1, v4); dxf.Entities.Add(DxfLine14); DxfLine DxfLine56 = new DxfLine(v5, v6); dxf.Entities.Add(DxfLine56); DxfLine DxfLine78 = new DxfLine(v7, v8); dxf.Entities.Add(DxfLine78); DxfLine DxfLine912 = new DxfLine(v9, v12); dxf.Entities.Add(DxfLine912); //纵向四道 DxfLine DxfLine91 = new DxfLine(v9, v1); dxf.Entities.Add(DxfLine91); DxfLine DxfLine210 = new DxfLine(v2, v10); dxf.Entities.Add(DxfLine210); DxfLine DxfLine311 = new DxfLine(v3, v11); dxf.Entities.Add(DxfLine311); DxfLine DxfLine412 = new DxfLine(v4, v12); dxf.Entities.Add(DxfLine412); //new DxfDxfText("Line, DxfCircle, DxfArc, dimension, DxfText (R12)", new Point3D(0, 18d, 0d), 1.5d,) //DxfTextStyle style = new DxfTextStyle("True type font", "Arial.ttf"); Point3D vt1 = new Point3D(v1.X+1.0d, v1.Y+2.5f, v1.Z); DxfText t1 = new DxfText("COIL", vt1, 2.0d); dxf.Entities.Add(t1); Point3D vt2 = new Point3D(v2.X + 1.0d, v2.Y + 2.5f, v2.Z); DxfText t2 = new DxfText("CLF", vt2, 2.0d); dxf.Entities.Add(t2); Point3D vt3 = new Point3D(v3.X + 1.0d, v3.Y + 2.5f, v3.Z); DxfText t3 = new DxfText(sectionEntity.CoolValue, vt3, 2.0d); dxf.Entities.Add(t3); Point3D vt4 = new Point3D(v5.X + 1.0d, v5.Y + 2.5f, v5.Z); DxfText t4 = new DxfText("FILTER", vt4, 2.0d); dxf.Entities.Add(t4); Point3D vt5 = new Point3D(v2.X + 1.0d, v5.Y + 2.5f, v5.Z); DxfText t5 = new DxfText("FTA", vt5, 2.0d); dxf.Entities.Add(t5); Point3D vt6 = new Point3D(v3.X + 1.0d, v5.Y + 2.5f, v5.Z); DxfText t6 = new DxfText(sectionEntity.FilterValue, vt6, 2.0d); dxf.Entities.Add(t6); Point3D vt7 = new Point3D(v7.X + 1.0d, v7.Y + 2.5f, v7.Z); DxfText t7 = new DxfText("SECTION", vt7, 2.0d); dxf.Entities.Add(t7); Point3D vt8 = new Point3D(v2.X + 1.0d, v7.Y + 2.5f, v7.Z); DxfText t8 = new DxfText("MODULE", vt8, 2.0d); dxf.Entities.Add(t8); Point3D vt9 = new Point3D(v3.X + 1.0d, v7.Y + 2.5f, v7.Z); DxfText t9 = new DxfText("CLEARANCE", vt9, 2.0d); dxf.Entities.Add(t9); }
//画两个门无门闩的设备 public static void writeDoubleDoorRectangle(DxfModel doc,DLocation DLocation,string [] DxfText,double height,double width,double outer_mid_space,double outer_in_space) { DxfLine outerLeftDxfLine=new DxfLine(new Point3D(DLocation.X+width/2-width/14,DLocation.Y+outer_mid_space,DLocation.Z),new Point3D(DLocation.X+width/2-width/14,DLocation.Y+height-outer_mid_space,DLocation.Z)); DxfLine inLeftDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine outerRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height - outer_mid_space, DLocation.Z)); doc.Entities.Add(outerLeftDxfLine); doc.Entities.Add(inLeftDxfLine); doc.Entities.Add(inRightDxfLine); doc.Entities.Add(outerRightDxfLine); writeDoorRectangle(doc, DLocation,DxfText, height, width, outer_mid_space, outer_in_space); }
//最外围矩形 public static void writeOuterDoorRectangle(DxfModel doc, DLocation DLocation,double height, double width) { //最外围矩形 DxfLine outerBottomDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y, DLocation.Z)); DxfLine outerLeftDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X, DLocation.Y + height, DLocation.Z)); DxfLine outerTopDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y + height, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y + height, DLocation.Z)); DxfLine outerRightDxfLine = new DxfLine(new Point3D(DLocation.X + width, DLocation.Y + height, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y, DLocation.Z)); doc.Entities.Add(outerBottomDxfLine); doc.Entities.Add(outerLeftDxfLine); doc.Entities.Add(outerTopDxfLine); doc.Entities.Add(outerRightDxfLine); }
//上下层组装和单层组装函数 public static void assembleDetailMechine(List<PictureBoxInfo> imageNameList, DxfModel dxf, DLocation DLocation, DetailMechineConfigure dmc,int coolingType) { int firstLayerWidth = 0; bool existTwoLayerElement = false; int upFirstElement=isTwoLayers(imageNameList); if (upFirstElement!=-1) { if (isExistTwoLayerElement(imageNameList)) { existTwoLayerElement = true; for (int i = 0; i < imageNameList.Count; i++) { if(i>=upFirstElement) { if (imageNameList.ElementAt(i).name.Equals("HRA")) { PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); //消除间隙,此时不存在双层元素 pictureBoxInfo.DLocation.Y += (pictureBoxInfo.height-2)/2+ 2; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation,pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); } else { PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); //消除间隙,此时不存在双层元素 pictureBoxInfo.DLocation.Y += pictureBoxInfo.height * 2 + 4; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation, pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); //top层dimensiong PictureBoxInfo topPictureBoxInfo = imageNameList.ElementAt(i); writeTopOrBottomDimension(topPictureBoxInfo, dxf, "top", 16, 3, 8); } } else { PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); //下层的总宽度 firstLayerWidth += pictureBoxInfo.width; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation, pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); //bottom writeTopOrBottomDimension(pictureBoxInfo, dxf, "bottom"); DLocation standDLocation = imageNameList.ElementAt(i).DLocation; if (i == 0) { writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); } else { writeBottomStand(dxf, new DLocation(standDLocation.X - 2, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "right"); } } } //后一个小支架 DLocation lastDLocation = new DLocation(imageNameList.ElementAt(upFirstElement - 1).DLocation.X + imageNameList.ElementAt(upFirstElement - 1).width, imageNameList.ElementAt(upFirstElement - 1).DLocation.Y, imageNameList.ElementAt(upFirstElement - 1).DLocation.Z); writeBottomStand(dxf, new DLocation(lastDLocation.X - 2, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); //支架dimension writeBottomStandDimension(new DLocation(lastDLocation.X, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), lastDLocation, dxf, "right", 16, 3, 15); //画左边的dimension if (imageNameList.ElementAt(upFirstElement).name.Equals("HRA")) { if (imageNameList.ElementAt(0).name.Equals("virtualHRA")) { //一层和二层左边第-层(主要是用来描绘HRA的) PictureBoxInfo oneFirstleftPictureBoxInfo = imageNameList.ElementAt(upFirstElement); DLocation one_startDLocation = new DLocation(oneFirstleftPictureBoxInfo.DLocation.X , oneFirstleftPictureBoxInfo.DLocation.Y, oneFirstleftPictureBoxInfo.DLocation.Z); DLocation one_secondDLocation = new DLocation(oneFirstleftPictureBoxInfo.DLocation.X, oneFirstleftPictureBoxInfo.DLocation.Y + oneFirstleftPictureBoxInfo.firstDistance, oneFirstleftPictureBoxInfo.DLocation.Z); DLocation one_thirdDLocation = new DLocation(oneFirstleftPictureBoxInfo.DLocation.X , one_secondDLocation.Y + oneFirstleftPictureBoxInfo.secondDistance, oneFirstleftPictureBoxInfo.DLocation.Z); DLocation one_fourthDLocation = new DLocation(oneFirstleftPictureBoxInfo.DLocation.X , one_startDLocation.Y + oneFirstleftPictureBoxInfo.thirdDistance, oneFirstleftPictureBoxInfo.DLocation.Z); DLocation one_fifthDLocation = new DLocation(oneFirstleftPictureBoxInfo.DLocation.X , one_fourthDLocation.Y + oneFirstleftPictureBoxInfo.secondDistance, oneFirstleftPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_secondDLocation, dxf, "left", 5, 3, 15); writeRightSecondDimension(one_secondDLocation, one_thirdDLocation, dxf, "left", 5, 3, 15); writeRightSecondDimension(one_startDLocation, one_fourthDLocation, dxf, "left", 5, 3, 15); writeRightSecondDimension(one_fourthDLocation, one_fifthDLocation, dxf, "left", 5, 3, 15); } else { //主要处理最后是个是HRA,下层第一个不是virtualHRA情况 PictureBoxInfo oneFirstLeftPictureBoxInfo = imageNameList.ElementAt(upFirstElement); DLocation one_startDLocation = new DLocation(oneFirstLeftPictureBoxInfo.DLocation.X , oneFirstLeftPictureBoxInfo.DLocation.Y, oneFirstLeftPictureBoxInfo.DLocation.Z); DLocation one_fourthDLocation = new DLocation(oneFirstLeftPictureBoxInfo.DLocation.X , one_startDLocation.Y + oneFirstLeftPictureBoxInfo.thirdDistance, oneFirstLeftPictureBoxInfo.DLocation.Z); DLocation one_fifthDLocation = new DLocation(oneFirstLeftPictureBoxInfo.DLocation.X , one_fourthDLocation.Y + oneFirstLeftPictureBoxInfo.secondDistance, oneFirstLeftPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_fourthDLocation, dxf, "left", 5, 3, 8); writeRightSecondDimension(one_fourthDLocation, one_fifthDLocation, dxf, "left", 5, 3, 8); //一层左边deminsion PictureBoxInfo firstPictureBoxInfo = imageNameList.ElementAt(0); writeLeftOrRightDimension(firstPictureBoxInfo, firstPictureBoxInfo.DLocation, dxf, "left"); //PictureBoxInfo upFirstPictureBoxInfo = imageNameList.ElementAt(upFirstElement); //writeLeftOrRightDimension(upFirstPictureBoxInfo, upFirstPictureBoxInfo.DLocation, dxf, "left"); } } else { //一层左边deminsion PictureBoxInfo firstPictureBoxInfo = imageNameList.ElementAt(0); writeLeftOrRightDimension(firstPictureBoxInfo, firstPictureBoxInfo.DLocation, dxf, "left"); PictureBoxInfo upFirstPictureBoxInfo = imageNameList.ElementAt(upFirstElement); writeLeftOrRightDimension(upFirstPictureBoxInfo, upFirstPictureBoxInfo.DLocation, dxf, "left"); } //画右边的dimension if (imageNameList.ElementAt(imageNameList.Count - 1).name.Equals("HRA")) { //这里没有数据还没画 if (imageNameList.ElementAt(upFirstElement - 1).name.Equals("virtualHRA")) { //一层和二层右边第-层(主要是用来描绘HRA的) PictureBoxInfo oneFirstRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation one_startDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, oneFirstRightPictureBoxInfo.DLocation.Y, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_secondDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, oneFirstRightPictureBoxInfo.DLocation.Y + oneFirstRightPictureBoxInfo.firstDistance, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_thirdDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, one_secondDLocation.Y + oneFirstRightPictureBoxInfo.secondDistance, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_fourthDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, one_startDLocation.Y + oneFirstRightPictureBoxInfo.thirdDistance, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_fifthDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, one_fourthDLocation.Y + oneFirstRightPictureBoxInfo.secondDistance, oneFirstRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_secondDLocation, dxf, "right", 16, 3, 8); writeRightSecondDimension(one_secondDLocation, one_thirdDLocation, dxf, "right", 16, 3, 8); writeRightSecondDimension(one_startDLocation, one_fourthDLocation, dxf, "right", 16, 3, 8); writeRightSecondDimension(one_fourthDLocation, one_fifthDLocation, dxf, "right", 16, 3, 8); //一层和二层右边第二层 PictureBoxInfo oneSecondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation one_TwostartDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_TwosecondDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + (oneSecondRightPictureBoxInfo.height - 2) / 2, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_TwothirdDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + (oneSecondRightPictureBoxInfo.height - 2) / 2 + 2, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_TwoFourthDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + oneSecondRightPictureBoxInfo.height, oneSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_TwostartDLocation, one_TwosecondDLocation, dxf, "right", 16, 3, 15); writeRightSecondDimension(one_TwothirdDLocation, one_TwoFourthDLocation, dxf, "right", 16, 3, 15); } else { //主要处理最后是个是HRA,下层最后一个不是virtualHRA情况(主要处理HRA) PictureBoxInfo oneFirstRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation one_TwostartDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, oneFirstRightPictureBoxInfo.DLocation.Y, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_TwofourthDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, one_TwostartDLocation.Y + oneFirstRightPictureBoxInfo.thirdDistance, oneFirstRightPictureBoxInfo.DLocation.Z); DLocation one_TwofifthDLocation = new DLocation(oneFirstRightPictureBoxInfo.DLocation.X + oneFirstRightPictureBoxInfo.width, one_TwofourthDLocation.Y + oneFirstRightPictureBoxInfo.secondDistance, oneFirstRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_TwostartDLocation, one_TwofourthDLocation, dxf, "right", 16, 3, 8); writeRightSecondDimension(one_TwofourthDLocation, one_TwofifthDLocation, dxf, "right", 16, 3, 8); //二层右边第二层dimesion PictureBoxInfo twoSecondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation two_startDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y + (twoSecondRightPictureBoxInfo.height-2)/2+2, twoSecondRightPictureBoxInfo.DLocation.Z); DLocation two_secondDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y + twoSecondRightPictureBoxInfo.height, twoSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(two_startDLocation, two_secondDLocation, dxf, "right", 16, 3, 15); //一层右边第一层dimensiong PictureBoxInfo firstRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement - 1); writeLeftOrRightDimension(firstRightPictureBoxInfo, firstRightPictureBoxInfo.DLocation, dxf, "right"); //一层右边第二层 PictureBoxInfo oneSecondRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement - 1); DLocation one_startDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_secondDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + oneSecondRightPictureBoxInfo.height, oneSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_secondDLocation, dxf, "right", 16, 3, 15); } } else { //一层右边第一层dimensiong PictureBoxInfo firstRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement - 1); writeLeftOrRightDimension(firstRightPictureBoxInfo, firstRightPictureBoxInfo.DLocation, dxf, "right"); //一层右边第二层 PictureBoxInfo oneSecondRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement - 1); DLocation one_startDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_secondDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + oneSecondRightPictureBoxInfo.height, oneSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_secondDLocation, dxf, "right", 16, 3, 15); //二层右边第一层 PictureBoxInfo upLastPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); writeLeftOrRightDimension(upLastPictureBoxInfo, upLastPictureBoxInfo.DLocation, dxf, "right", 16, 3, 8); //二层右边第二层dimesion PictureBoxInfo twoSecondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation two_startDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y, twoSecondRightPictureBoxInfo.DLocation.Z); DLocation two_secondDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y + twoSecondRightPictureBoxInfo.height, twoSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(two_startDLocation, two_secondDLocation, dxf, "right", 16, 3, 15); } //bottom最外层 PictureBoxInfo startRightPictureBoxInfo = imageNameList.ElementAt(0); writeTotalBottomDimension(startRightPictureBoxInfo, firstLayerWidth, dxf, "bottom", 16, 3, 15); //绘制底部一条直线 DxfLine bottomLine = new DxfLine(); bottomLine.Start = new WW.Math.Point3D(startRightPictureBoxInfo.DLocation.X, startRightPictureBoxInfo.DLocation.Y - BaseRail.baseRail, startRightPictureBoxInfo.DLocation.Z); bottomLine.End = new WW.Math.Point3D(startRightPictureBoxInfo.DLocation.X + firstLayerWidth, startRightPictureBoxInfo.DLocation.Y - BaseRail.baseRail, startRightPictureBoxInfo.DLocation.Z); dxf.Entities.Add(bottomLine); //画垫层的dimension,他和别的标注函数雷同,就不重写了,直接调用 if (imageNameList.ElementAt(upFirstElement).name.Equals("HRA")) { //画在最后 if (upFirstElement != imageNameList.Count - 1) { PictureBoxInfo lastPictureInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation cushionDLocation = new DLocation(lastPictureInfo.DLocation.X + lastPictureInfo.width, lastPictureInfo.DLocation.Y, lastPictureInfo.DLocation.Z); writeRightSecondDimension(new DLocation(cushionDLocation.X, cushionDLocation.Y - 2, cushionDLocation.Z), cushionDLocation, dxf, "right", 16, 1, 5); } else { PictureBoxInfo lastPictureInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation cushionDLocation = new DLocation(lastPictureInfo.DLocation.X + lastPictureInfo.width, lastPictureInfo.DLocation.Y+(lastPictureInfo.height-2)/2+2, lastPictureInfo.DLocation.Z); writeRightSecondDimension(new DLocation(cushionDLocation.X, cushionDLocation.Y - 2, cushionDLocation.Z), cushionDLocation, dxf, "right", 16, 1, 5); } } else if (imageNameList.ElementAt(imageNameList.Count - 1).name.Equals("HRA")) { //画在开始 PictureBoxInfo upFirstPictureInfo = imageNameList.ElementAt(upFirstElement); DLocation cushionDLocation = new DLocation(upFirstPictureInfo.DLocation.X, upFirstPictureInfo.DLocation.Y, upFirstPictureInfo.DLocation.Z); writeRightSecondDimension(new DLocation(cushionDLocation.X, cushionDLocation.Y - 2, cushionDLocation.Z), cushionDLocation, dxf, "left", 16, 1, 5); } else { //画在最后 PictureBoxInfo lastPictureInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation cushionDLocation = new DLocation(lastPictureInfo.DLocation.X + lastPictureInfo.width, lastPictureInfo.DLocation.Y, lastPictureInfo.DLocation.Z); writeRightSecondDimension(new DLocation(cushionDLocation.X, cushionDLocation.Y - 2, cushionDLocation.Z), cushionDLocation, dxf, "right", 16, 1, 5); } } else { for (int i = 0; i < imageNameList.Count; i++) { if (i >= upFirstElement) { PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); //消除间隙,此时不存在双层元素 pictureBoxInfo.DLocation.Y += pictureBoxInfo.height * 2 + 2; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation, pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); //top层dimensiong PictureBoxInfo topPictureBoxInfo = imageNameList.ElementAt(i); writeTopOrBottomDimension(topPictureBoxInfo, dxf, "top", 16, 3, 8); } else { //第一层Y位置保持不变 PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); firstLayerWidth += pictureBoxInfo.width; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation, pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); //bottom writeTopOrBottomDimension(pictureBoxInfo, dxf, "bottom"); DLocation standDLocation = imageNameList.ElementAt(i).DLocation; if (i == 0) { writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); } else { writeBottomStand(dxf, new DLocation(standDLocation.X - 2, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "right"); } } } //后一个小支架 DLocation lastDLocation = new DLocation(imageNameList.ElementAt(upFirstElement - 1).DLocation.X + imageNameList.ElementAt(upFirstElement - 1).width, imageNameList.ElementAt(upFirstElement - 1).DLocation.Y, imageNameList.ElementAt(upFirstElement - 1).DLocation.Z); writeBottomStand(dxf, new DLocation(lastDLocation.X - 2, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); //支架dimension writeBottomStandDimension(new DLocation(lastDLocation.X, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), lastDLocation, dxf, "right", 16, 3, 15); //左边deminsion PictureBoxInfo firstPictureBoxInfo = imageNameList.ElementAt(0); writeLeftOrRightDimension(firstPictureBoxInfo, firstPictureBoxInfo.DLocation, dxf, "left"); PictureBoxInfo upFirstPictureBoxInfo = imageNameList.ElementAt(upFirstElement); writeLeftOrRightDimension(upFirstPictureBoxInfo, upFirstPictureBoxInfo.DLocation, dxf, "left"); //一层右边第一层dimensiong PictureBoxInfo firstRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement-1); writeLeftOrRightDimension(firstRightPictureBoxInfo, firstRightPictureBoxInfo.DLocation, dxf, "right"); //一层右边第二层 PictureBoxInfo oneSecondRightPictureBoxInfo = imageNameList.ElementAt(upFirstElement- 1); DLocation one_startDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y, oneSecondRightPictureBoxInfo.DLocation.Z); DLocation one_secondDLocation = new DLocation(oneSecondRightPictureBoxInfo.DLocation.X + oneSecondRightPictureBoxInfo.width, oneSecondRightPictureBoxInfo.DLocation.Y + oneSecondRightPictureBoxInfo.height, oneSecondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(one_startDLocation, one_secondDLocation, dxf, "right", 16, 3, 15); //二层右边第一层 PictureBoxInfo upLastPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count-1); writeLeftOrRightDimension(upLastPictureBoxInfo, upLastPictureBoxInfo.DLocation, dxf, "right",16,3,8); //二层右边第二层dimesion PictureBoxInfo twoSecondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation two_startDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y, twoSecondRightPictureBoxInfo.DLocation.Z); DLocation two_secondDLocation = new DLocation(twoSecondRightPictureBoxInfo.DLocation.X + twoSecondRightPictureBoxInfo.width, twoSecondRightPictureBoxInfo.DLocation.Y + twoSecondRightPictureBoxInfo.height, twoSecondRightPictureBoxInfo.DLocation.Z); //计算dimension高度用 // double secondDimensionHeiht = imageNameList.ElementAt(upFirstElement - 1).DLocation.X - imageNameList.ElementAt(imageNameList.Count - 1).DLocation.X + imageNameList.ElementAt(upFirstElement - 1).width; // if (imageNameList.ElementAt(upFirstElement - 1).DLocation.X - imageNameList.ElementAt(imageNameList.Count - 1).DLocation.X > 0) // { // writeRightSecondDimension(two_startDLocation, two_secondDLocation, dxf, "right", 16, 3, 15 + secondDimensionHeiht); // } // else //{ writeRightSecondDimension(two_startDLocation, two_secondDLocation, dxf, "right", 16, 3, 15); // } //一、二层右边第三层dimension //PictureBoxInfo twoThirdSecondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); //PictureBoxInfo twoThirdStartRightPicureBoxInfo = imageNameList.ElementAt(upFirstElement - 1); //DLocation two_startThirdDLocation = new DLocation(twoThirdStartRightPicureBoxInfo.DLocation.X + twoThirdStartRightPicureBoxInfo.width, twoThirdStartRightPicureBoxInfo.DLocation.Y, twoThirdStartRightPicureBoxInfo.DLocation.Z); //DLocation two_secondThirdDLocation = new DLocation(twoThirdSecondRightPictureBoxInfo.DLocation.X + twoThirdSecondRightPictureBoxInfo.width, twoThirdSecondRightPictureBoxInfo.DLocation.Y + twoThirdSecondRightPictureBoxInfo.height, twoThirdSecondRightPictureBoxInfo.DLocation.Z); //writeRightSecondDimension(two_startThirdDLocation, two_secondThirdDLocation, dxf, "right", 16, 3, 15); //bottom最外层 PictureBoxInfo startRightPictureBoxInfo = imageNameList.ElementAt(0); writeTotalBottomDimension(startRightPictureBoxInfo, firstLayerWidth, dxf, "bottom", 16, 3, 15); } //绘制右边整体的两层 int wholeHeight = 0; PictureBoxInfo oneLastPictrueInfo=imageNameList.ElementAt(upFirstElement-1); PictureBoxInfo twoFirstPictureInfo=imageNameList.ElementAt(upFirstElement); if (existTwoLayerElement) { wholeHeight = 2 * oneLastPictrueInfo.height + 2; } else { wholeHeight = 2 * oneLastPictrueInfo.height; } int rightWholeDimensionLength =Convert.ToInt32(oneLastPictrueInfo.DLocation.X + oneLastPictrueInfo.width - twoFirstPictureInfo.DLocation.X - twoFirstPictureInfo.width); DLocation right_wholeStartDLocation = new DLocation(twoFirstPictureInfo.DLocation.X + twoFirstPictureInfo.width, oneLastPictrueInfo.DLocation.Y, oneLastPictrueInfo.DLocation.Z); DLocation right_wholeSecondDLocation = new DLocation(twoFirstPictureInfo.DLocation.X + twoFirstPictureInfo.width, oneLastPictrueInfo.DLocation.Y + wholeHeight, oneLastPictrueInfo.DLocation.Z); writeRightSecondDimension(right_wholeStartDLocation, right_wholeSecondDLocation, dxf, "right", 16, 3, rightWholeDimensionLength+20); writeRightSecondDimension(new DLocation(oneLastPictrueInfo.DLocation.X + oneLastPictrueInfo.width, oneLastPictrueInfo.DLocation.Y - 6, oneLastPictrueInfo.DLocation.Z), new DLocation(oneLastPictrueInfo.DLocation.X + oneLastPictrueInfo.width, right_wholeSecondDLocation.Y, oneLastPictrueInfo.DLocation.Z), dxf, "right", 16, 3, 25); } else { for (int i = 0; i < imageNameList.Count; i++) { PictureBoxInfo pictureBoxInfo = imageNameList.ElementAt(i); firstLayerWidth += pictureBoxInfo.width; assembleDetailMechine(pictureBoxInfo, dxf, pictureBoxInfo.DLocation, pictureBoxInfo.text, Convert.ToDouble(pictureBoxInfo.height), Convert.ToDouble(pictureBoxInfo.width), dmc.outer_mid_space, dmc.outer_in_space, dmc.barHeight, dmc.barWidth); //每个图框底部的dimension writeTopOrBottomDimension(pictureBoxInfo, dxf, "bottom", 16, 3, 10); DLocation standDLocation = imageNameList.ElementAt(i).DLocation; if (i == 0) { writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); } else { writeBottomStand(dxf, new DLocation(standDLocation.X - 2, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); writeBottomStand(dxf, new DLocation(standDLocation.X, standDLocation.Y - BaseRail.baseRail, standDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "right"); } } //后一个小支架 DLocation lastDLocation = new DLocation(imageNameList.ElementAt(imageNameList.Count - 1).DLocation.X + imageNameList.ElementAt(imageNameList.Count - 1).width, imageNameList.ElementAt(imageNameList.Count - 1).DLocation.Y, imageNameList.ElementAt(imageNameList.Count - 1).DLocation.Z); writeBottomStand(dxf, new DLocation(lastDLocation.X - 2, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), BaseRail.baseRail, 2, dmc.outer_in_space / 26, "left"); //支架dimension writeBottomStandDimension(new DLocation(lastDLocation.X, lastDLocation.Y - BaseRail.baseRail, lastDLocation.Z), lastDLocation, dxf,"right", 16, 3, 15); //注意这里还要封装冷量类型,没有做 PictureBoxInfo firstLeftPictureBoxInfo = imageNameList.ElementAt(0); writeLeftOrRightDimension(firstLeftPictureBoxInfo, firstLeftPictureBoxInfo.DLocation, dxf, "left"); //右边第一层dimension PictureBoxInfo firstRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); writeLeftOrRightDimension(firstRightPictureBoxInfo, firstRightPictureBoxInfo.DLocation, dxf, "right"); //右边第二层dimesion PictureBoxInfo secondRightPictureBoxInfo = imageNameList.ElementAt(imageNameList.Count - 1); DLocation startDLocation = new DLocation(secondRightPictureBoxInfo.DLocation.X + secondRightPictureBoxInfo.width, secondRightPictureBoxInfo.DLocation.Y, secondRightPictureBoxInfo.DLocation.Z); DLocation secondDLocation = new DLocation(secondRightPictureBoxInfo.DLocation.X + secondRightPictureBoxInfo.width, secondRightPictureBoxInfo.DLocation.Y + secondRightPictureBoxInfo.height, secondRightPictureBoxInfo.DLocation.Z); writeRightSecondDimension(startDLocation, secondDLocation, dxf, "right", 16, 3, 15); //右边第三层dimension //还没做 //bottom最外层 PictureBoxInfo startRightPictureBoxInfo = imageNameList.ElementAt(0); writeTotalBottomDimension(startRightPictureBoxInfo, firstLayerWidth, dxf, "bottom", 16, 3, 15); //绘制底部一条直线 DxfLine bottomLine = new DxfLine(); bottomLine.Start = new WW.Math.Point3D(startRightPictureBoxInfo.DLocation.X, startRightPictureBoxInfo.DLocation.Y - BaseRail.baseRail, startRightPictureBoxInfo.DLocation.Z); bottomLine.End = new WW.Math.Point3D(startRightPictureBoxInfo.DLocation.X + firstLayerWidth, startRightPictureBoxInfo.DLocation.Y - BaseRail.baseRail, startRightPictureBoxInfo.DLocation.Z); dxf.Entities.Add(bottomLine); } }
/// <summary> /// 绘制订单信息块 /// </summary> /// <param name="dxf"></param> /// <param name="DLocation"></param> /// <param name="boxWidth"></param> /// <param name="configurations"></param> public static void Draw(DxfModel dxf, DLocation DLocation,double boxWidth, OrderEntity orderEntity) { double factor = 0.6f; Point3D v1 = new Point3D(DLocation.X,DLocation.Y,DLocation.Z); Point3D v2 = new Point3D(DLocation.X + boxWidth, DLocation.Y, DLocation.Z); Point3D v3 = new Point3D(DLocation.X + boxWidth, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v4 = new Point3D(DLocation.X, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v5 = new Point3D(DLocation.X, DLocation.Y + 10.0d * factor, DLocation.Z); Point3D v6 = new Point3D(DLocation.X + boxWidth / 4, DLocation.Y + 10.0d * factor, DLocation.Z); Point3D v7 = new Point3D(DLocation.X + boxWidth / 2, DLocation.Y + 10.0d * factor, DLocation.Z); Point3D v8 = new Point3D(DLocation.X + boxWidth * 3 / 4, DLocation.Y + 10.0d * factor, DLocation.Z); Point3D v9 = new Point3D(DLocation.X + boxWidth * 7 / 8, DLocation.Y + 10.0d * factor, DLocation.Z); Point3D v10 = new Point3D(DLocation.X + boxWidth / 4, DLocation.Y + 20.0d * factor, DLocation.Z); Point3D v11 = new Point3D(DLocation.X + boxWidth / 2, DLocation.Y + 20.0d * factor, DLocation.Z); Point3D v12 = new Point3D(DLocation.X + boxWidth * 3 / 4, DLocation.Y + 20.0d * factor, DLocation.Z); Point3D v13 = new Point3D(DLocation.X + boxWidth * 7 / 8, DLocation.Y + 20.0d * factor, DLocation.Z); Point3D v14 = new Point3D(DLocation.X + boxWidth, DLocation.Y + 20.0d * factor, DLocation.Z); Point3D v15 = new Point3D(DLocation.X + boxWidth / 4, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v16 = new Point3D(DLocation.X + boxWidth * 3 / 4, DLocation.Y + 40.0d * factor, DLocation.Z); Point3D v17 = new Point3D(DLocation.X + boxWidth / 4, DLocation.Y, DLocation.Z); Point3D v18 = new Point3D(DLocation.X + boxWidth / 2, DLocation.Y, DLocation.Z); Point3D v19 = new Point3D(DLocation.X + boxWidth * 3 / 4, DLocation.Y, DLocation.Z); Point3D v20 = new Point3D(DLocation.X + boxWidth, DLocation.Y + 10.0d * factor, DLocation.Z); //横向四道 DxfLine DxfLine12 = new DxfLine(v1, v2); dxf.Entities.Add(DxfLine12); DxfLine DxfLine520 = new DxfLine(v5, v20); dxf.Entities.Add(DxfLine520); DxfLine DxfLine1014 = new DxfLine(v10, v14); dxf.Entities.Add(DxfLine1014); DxfLine DxfLine43 = new DxfLine(v4, v3); dxf.Entities.Add(DxfLine43); //纵向6道 DxfLine DxfLine41 = new DxfLine(v4, v1); dxf.Entities.Add(DxfLine41); DxfLine DxfLine1517 = new DxfLine(v15, v17); dxf.Entities.Add(DxfLine1517); DxfLine DxfLine1118 = new DxfLine(v11, v18); dxf.Entities.Add(DxfLine1118); DxfLine DxfLine1619 = new DxfLine(v16, v19); dxf.Entities.Add(DxfLine1619); DxfLine DxfLine139 = new DxfLine(v13, v9); dxf.Entities.Add(DxfLine139); DxfLine DxfLine32= new DxfLine(v3, v2); dxf.Entities.Add(DxfLine32); //文字 Point3D vt1 = new Point3D(v1.X + 1.0d, v1.Y + 2.5f, v1.Z); DxfText t1 = new DxfText("Celebrity 1.0.0", vt1, 2.0d); dxf.Entities.Add(t1); Point3D vt2 = new Point3D(v17.X + 1.0d, v17.Y + 2.5f, v1.Z); DxfText t2 = new DxfText("PREPARER: "+orderEntity.Preparer, vt2, 2.0d); dxf.Entities.Add(t2); Point3D vt3 = new Point3D(v18.X + 1.0d, v18.Y + 2.5f, v1.Z); DxfText t3 = new DxfText("ENGINEER: "+orderEntity.Engineer, vt3, 2.0d); dxf.Entities.Add(t3); Point3D vt4 = new Point3D(v19.X + 1.0d, v19.Y + 2.5f, v1.Z); DxfText t4 = new DxfText("SHIP ORDER NO: "+orderEntity.ShipOrderNo, vt4, 2.0d); dxf.Entities.Add(t4); Point3D vt5 = new Point3D(v4.X + 1.0d, v10.Y + 2.5f, v1.Z); DxfText t5= new DxfText(" AAON COIL PRODUCTS inc.", vt5, 3.0d); dxf.Entities.Add(t5); Point3D vt6 = new Point3D(v5.X + 1.0d, v5.Y + 2.5f, v1.Z); DxfText t6 = new DxfText("LONGVIEW TEXAS", vt6, 2.0d); dxf.Entities.Add(t6); Point3D vt7 = new Point3D(v6.X + 1.0d, v6.Y + 2.5f, v1.Z); DxfText t7 = new DxfText("PURCHASER: " + orderEntity.Purchaser, vt7, 2.0d); dxf.Entities.Add(t7); Point3D vt8 = new Point3D(v7.X + 1.0d, v7.Y + 2.5f, v1.Z); DxfText t8 = new DxfText("PURCHASE ORDER: " + orderEntity.PurchaseOrder, vt8, 2.0d); dxf.Entities.Add(t8); Point3D vt9 = new Point3D(v8.X + 1.0d, v8.Y + 2.5f, v1.Z); DxfText t9 = new DxfText("SERIAL NO: " + orderEntity.SeriaNo, vt9, 2.0d); dxf.Entities.Add(t9); Point3D vt10 = new Point3D(v9.X + 1.0d, v9.Y + 2.5f, v1.Z); DxfText t10 = new DxfText("DATE: "+DateTime.Now.ToShortDateString(), vt10, 2.0d); dxf.Entities.Add(t10); Point3D vt11 = new Point3D(v15.X + 1.0d, v15.Y - 7.5f, v1.Z); DxfText t11 = new DxfText("JOB NAME:", vt11, 2.0d); dxf.Entities.Add(t11); Point3D vt12 = new Point3D(v10.X + 10.0d, v10.Y + 2.5f, v1.Z); DxfText t12 = new DxfText(orderEntity.JobName, vt12, 2.0d); dxf.Entities.Add(t12); Point3D vt13 = new Point3D(v16.X + 1.0d, v16.Y - 7.5f, v1.Z); DxfText t13 = new DxfText("UNIT TAG:", vt13, 2.0d); dxf.Entities.Add(t13); Point3D vt14 = new Point3D(v12.X + 20.0d, v12.Y + 2.5f, v1.Z); DxfText t14 = new DxfText(orderEntity.UnitTag, vt14, 2.0d); dxf.Entities.Add(t14); }
//画右支架 public static void writeRighStand(DxfModel dxf, DLocation DLocation, double height, double width, double outer_in_space) { DxfLine outLeft = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y, DLocation.Z)); DxfLine outRight = new DxfLine(new Point3D(DLocation.X + width, DLocation.Y, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y + height, DLocation.Z)); DxfLine outBottom = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X, DLocation.Y + height, DLocation.Z)); DxfLine outTop = new DxfLine(new Point3D(DLocation.X, DLocation.Y + height, DLocation.Z), new Point3D(DLocation.X + width, DLocation.Y + height, DLocation.Z)); dxf.Entities.Add(outLeft); dxf.Entities.Add(outRight); dxf.Entities.Add(outBottom); dxf.Entities.Add(outTop); DxfLine inRight = new DxfLine(new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inTop = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inBottom = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + outer_in_space, DLocation.Z)); DxfLine inLeftTop = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + height - 7 * outer_in_space, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inLeftBottom = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + 7 * outer_in_space, DLocation.Z)); DxfLine inLeftTopLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y + height - 7 * outer_in_space, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + height - 7 * outer_in_space, DLocation.Z)); DxfLine inLeftBettomLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y + 7 * outer_in_space, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + 7 * outer_in_space, DLocation.Z)); dxf.Entities.Add(inTop); dxf.Entities.Add(inRight); dxf.Entities.Add(inBottom); dxf.Entities.Add(inLeftTop); dxf.Entities.Add(inLeftBottom); dxf.Entities.Add(inLeftTopLine); dxf.Entities.Add(inLeftBettomLine); }
/// <summary> /// 单门有两门闩,和俩个把手的 /// </summary> /// <param name="doc"></param> /// <param name="DLocation"></param> /// <param name="DxfText"></param> /// <param name="height"></param> /// <param name="width"></param> /// <param name="outer_mid_space"></param> /// <param name="outer_in_space"></param> /// <param name="barHeight"></param> /// <param name="barWidth"></param> public static void writeWholeSingleTwoBarAndTwoCirle(DxfModel doc, DLocation DLocation, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space,double barHeight,double barWidth) { DxfLine outerLeftDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 - width / 14, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width / 2 - width / 14, DLocation.Y + height - outer_mid_space, DLocation.Z)); DxfLine inLeftDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inDownRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height / 4, DLocation.Z)); DxfLine inMidRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height / 4 + barHeight, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); DxfLine inUpRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + 3 * height / 4, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine outerDownRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height / 4, DLocation.Z)); DxfLine outerMidRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height / 4 + barHeight, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); DxfLine outerUpRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + 3 * height / 4, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height - outer_in_space, DLocation.Z)); doc.Entities.Add(outerLeftDxfLine); doc.Entities.Add(inLeftDxfLine); //左边的门闩小矩形 double downLeftX = DLocation.X + outer_mid_space - barWidth / 2 + (outer_in_space - outer_mid_space) / 2; double downLeftY = DLocation.Y + height / 4; writeRepresentDoorBarRectangle(doc, new DLocation(downLeftX, downLeftY, DLocation.Z), DxfText, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); double upLeftX = downLeftX; double upLeftY = DLocation.Y + 3 * height / 4 - barHeight; writeRepresentDoorBarRectangle(doc, new DLocation(upLeftX, upLeftY, DLocation.Z), DxfText, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); //两个个小圈 //底部 writeCirle(doc, new DLocation(DLocation.X + width-2*outer_in_space, DLocation.Y + 2 * outer_in_space, DLocation.Z), (outer_in_space - outer_mid_space) / 2); //顶部 writeCirle(doc, new DLocation(DLocation.X + width-2*outer_in_space, DLocation.Y + height - 2 * outer_in_space, DLocation.Z), (outer_in_space - outer_mid_space) / 2); //画门把手 Handle.Draw(doc, new DLocation(DLocation.X + width / 4+outer_mid_space/2, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); Handle.Draw(doc, new DLocation(DLocation.X + width / 4 + outer_mid_space/2, DLocation.Y + height / 4, DLocation.Z)); writeDoorBarRectangle(doc, DLocation, DxfText, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); }
//画单门有门闩的矩形框 public static void writeDoorBarRectangle(DxfModel doc, DLocation DLocation, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space,double barHeight,double barWidth) { //最外围矩形 writeOuterDoorRectangle(doc, DLocation, height, width); //中间矩形 DxfLine midBottomDxfLine = new DxfLine(new Point3D(DLocation.X + outer_mid_space, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width - outer_mid_space, DLocation.Y + outer_mid_space, DLocation.Z)); DxfLine midDownLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_mid_space, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + outer_mid_space, DLocation.Y + height / 4, DLocation.Z)); DxfLine midMidLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_mid_space, DLocation.Y + height / 4 + barHeight, DLocation.Z), new Point3D(DLocation.X + outer_mid_space, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); DxfLine midUpLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_mid_space, DLocation.Y + 3*height / 4, DLocation.Z), new Point3D(DLocation.X + outer_mid_space, DLocation.Y +height-outer_mid_space, DLocation.Z)); DxfLine midTopDxfLine = new DxfLine(new Point3D(DLocation.X + outer_mid_space, DLocation.Y + height - outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width - outer_mid_space, DLocation.Y + height - outer_mid_space, DLocation.Z)); DxfLine midRightDxfLine = new DxfLine(new Point3D(DLocation.X + width - outer_mid_space, DLocation.Y + height - outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width - outer_mid_space, DLocation.Y + outer_mid_space, DLocation.Z)); doc.Entities.Add(midBottomDxfLine); doc.Entities.Add(midDownLeftDxfLine); doc.Entities.Add(midMidLeftDxfLine); doc.Entities.Add(midUpLeftDxfLine); doc.Entities.Add(midTopDxfLine); doc.Entities.Add(midRightDxfLine); //内部矩形 DxfLine inBottomDxfLine = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + outer_in_space, DLocation.Z)); DxfLine inDownLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + height/4, DLocation.Z)); DxfLine inmidLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + height / 4 + barHeight, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + 3*height/4 - barHeight, DLocation.Z)); DxfLine inUpLeftDxfLine = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + 3*height / 4, DLocation.Z), new Point3D(DLocation.X + outer_in_space, DLocation.Y + height-outer_in_space, DLocation.Z)); DxfLine inTopDxfLine = new DxfLine(new Point3D(DLocation.X + outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inRightDxfLine = new DxfLine(new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + height - outer_in_space, DLocation.Z), new Point3D(DLocation.X + width - outer_in_space, DLocation.Y + outer_in_space, DLocation.Z)); doc.Entities.Add(inBottomDxfLine); doc.Entities.Add(inDownLeftDxfLine); doc.Entities.Add(inmidLeftDxfLine); doc.Entities.Add(inUpLeftDxfLine); doc.Entities.Add(inTopDxfLine); doc.Entities.Add(inRightDxfLine); //门中文字 double DxfTextHeight = DoorInitHeightAndWidth.DxfTextHeight; for (int i = 0; i < DxfText.Length; i++) { DxfText doorRectangleDxfText = new DxfText(DxfText[i], new Point3D(DLocation.X + width / 3, DLocation.Y + 3 * height / 4 - i * DxfTextHeight, DLocation.Z), DxfTextHeight); doc.Entities.Add(doorRectangleDxfText); } }
/// <summary> /// 门把手绘制 /// </summary> /// <param name="dxf"></param> /// <param name="DLocation"></param> public static void Draw(DxfModel dxf, DLocation DLocation) { double factor = 0.05f; double distance = 30; //底部小圆的圆心 Point3D sDxfCircle = new Point3D(DLocation.X + 10 * factor, DLocation.Y, DLocation.Z); //上部同心圆圆心 Point3D bDxfCircle = new Point3D(DLocation.X + 10 * factor, DLocation.Y + 5 * factor + distance*factor, DLocation.Z); double alpha = Math.Asin(3 / distance); double beta = Math.Acos(0.8); Point3D v1 = new Point3D( DLocation.X + 10 * factor - double.Parse((5 * factor * Math.Cos(alpha)).ToString()), DLocation.Y + 5 * factor - double.Parse((5 * factor * Math.Sin(alpha)).ToString()), DLocation.Z); Point3D v2 = new Point3D( DLocation.X + 10 * factor + double.Parse((5 * factor * Math.Cos(alpha)).ToString()), DLocation.Y + 5 * factor - double.Parse((5 * factor * Math.Sin(alpha)).ToString()), DLocation.Z); Point3D v4 = new Point3D( DLocation.X + 10 * factor -double.Parse((8*factor* Math.Cos(alpha)).ToString()), DLocation.Y + 5 * factor + distance * factor - double.Parse((8 * factor * Math.Sin(alpha)).ToString()), DLocation.Z ); Point3D v5 = new Point3D( DLocation.X + 10 * factor + double.Parse((8*factor*Math.Cos(alpha)).ToString()), DLocation.Y + 5 * factor + distance * factor - double.Parse((8 * factor * Math.Sin(alpha)).ToString()), DLocation.Z ); DxfLine DxfLine14 = new DxfLine(v1, v4); dxf.Entities.Add(DxfLine14); DxfLine DxfLine25 = new DxfLine(v2, v5); dxf.Entities.Add(DxfLine25); //DxfArc DxfArc DxfArc = new DxfArc( new Point3D(DLocation.X + 10 * factor, DLocation.Y + 5 * factor, DLocation.Z), 5 * factor, Convert.ToInt32(180 + alpha * 180 / Math.PI), Convert.ToInt32(360 - alpha * 180 / Math.PI)); dxf.Entities.Add(DxfArc); //DxfArcup DxfArc DxfArcup = new DxfArc( new Point3D(DLocation.X + 10 * factor, DLocation.Y + 5 * factor + distance * factor, DLocation.Z), 8 * factor, Convert.ToInt32(-alpha * 180 / Math.PI), Convert.ToInt32(180 + alpha * 180 / Math.PI)); dxf.Entities.Add(DxfArcup); //DxfArcround DxfArc DxfArcround = new DxfArc( new Point3D(DLocation.X + 10 * factor, DLocation.Y + 5 * factor + distance * factor, DLocation.Z), 10 * factor, Convert.ToInt32(-(alpha +beta) * 180 / Math.PI), Convert.ToInt32(180 + (alpha +beta) * 180 / Math.PI)); dxf.Entities.Add(DxfArcround); //DxfCircle Point3D centerWCS = new Point3D(DLocation.X+10*factor, DLocation.Y+5*factor+distance*factor, DLocation.Z); DxfCircle DxfCircle = new DxfCircle((Point3D)centerWCS, 7 * factor); dxf.Entities.Add(DxfCircle); //上部同心圆圆心 Point3D t1 = new Point3D( DLocation.X + 8 * factor, DLocation.Y + 5 * factor + (distance - 7) * factor * 0.7f, DLocation.Z); Point3D t2 = new Point3D( DLocation.X + 8 * factor, DLocation.Y + 5 * factor + (distance - 7) * factor * 0.5f, DLocation.Z); Point3D t3 = new Point3D( DLocation.X + 8 * factor, DLocation.Y + 5 * factor + (distance - 7) * factor * 0.3f, DLocation.Z); Point3D t4 = new Point3D( DLocation.X + 8 * factor, DLocation.Y + 5 * factor + (distance - 7) * factor * 0.1f, DLocation.Z); //DxfText DxfText DxfText1 = new DxfText("A", t1, 0.2f); dxf.Entities.Add(DxfText1); //DxfText DxfText DxfText2 = new DxfText("A", t2, 0.2f); dxf.Entities.Add(DxfText2); //DxfText DxfText DxfText3 = new DxfText("O", t3, 0.2f); dxf.Entities.Add(DxfText3); //DxfText DxfText DxfText4 = new DxfText("N", t4, 0.2f); dxf.Entities.Add(DxfText4); }
//画两个门有门闩的设备 public static void writeDoubleDoorBarRectangle(DxfModel doc, DLocation DLocation, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space,double barHeight,double barWidth) { DxfLine outerLeftDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 - width / 14, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width / 2 - width / 14, DLocation.Y + height - outer_mid_space, DLocation.Z)); DxfLine inLeftDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 - width / 14 + 0.5f, DLocation.Y + height - outer_in_space, DLocation.Z)); DxfLine inDownRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + outer_in_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height/4, DLocation.Z)); DxfLine inMidRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height / 4 + barHeight, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); DxfLine inUpRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + 3*height / 4, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14, DLocation.Y + height-outer_in_space, DLocation.Z)); DxfLine outerDownRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + outer_mid_space, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height/4, DLocation.Z)); DxfLine outerMidRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height/4+barHeight, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + 3*height / 4-barHeight, DLocation.Z)); DxfLine outerUpRightDxfLine = new DxfLine(new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + 3*height / 4, DLocation.Z), new Point3D(DLocation.X + width / 2 + width / 14 + 0.5f, DLocation.Y + height-outer_in_space, DLocation.Z)); doc.Entities.Add(outerLeftDxfLine); doc.Entities.Add(inLeftDxfLine); doc.Entities.Add(inDownRightDxfLine); doc.Entities.Add(inMidRightDxfLine); doc.Entities.Add(inUpRightDxfLine); doc.Entities.Add(outerDownRightDxfLine); doc.Entities.Add(outerMidRightDxfLine); doc.Entities.Add(outerUpRightDxfLine); writeDoorBarRectangle(doc, DLocation, DxfText, height, width, outer_mid_space, outer_in_space,barHeight,barWidth); }
//画表示门闩的小矩形 public static void writeRepresentDoorBarRectangle(DxfModel doc, DLocation DLocation, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space, double barHeight, double barWidth) { DxfLine bottomDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X + barWidth, DLocation.Y, DLocation.Z)); DxfLine leftDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y, DLocation.Z), new Point3D(DLocation.X, DLocation.Y + barHeight, DLocation.Z)); DxfLine topDxfLine = new DxfLine(new Point3D(DLocation.X, DLocation.Y + barHeight, DLocation.Z), new Point3D(DLocation.X + barWidth, DLocation.Y + barHeight, DLocation.Z)); DxfLine rightDxfLine = new DxfLine(new Point3D(DLocation.X + barWidth, DLocation.Y + barHeight, DLocation.Z), new Point3D(DLocation.X + barWidth, DLocation.Y, DLocation.Z)); //内部折线 DxfLine upDxfLine = new DxfLine(new Point3D(DLocation.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, DLocation.Y + barHeight, DLocation.Z), new Point3D(DLocation.X + barWidth / 2-(outer_in_space-outer_mid_space)/2, DLocation.Y + barHeight / 2, DLocation.Z)); DxfLine midDxfLine = new DxfLine(new Point3D(DLocation.X + barWidth / 2 - (outer_in_space - outer_mid_space) / 2, DLocation.Y + barHeight / 2, DLocation.Z), new Point3D(DLocation.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2,DLocation.Y+barHeight/2,DLocation.Z)); DxfLine downDxfLine = new DxfLine(new Point3D(DLocation.X + barWidth / 2 + (outer_in_space - outer_mid_space) / 2, DLocation.Y + barHeight / 2, DLocation.Z), new Point3D(DLocation.X+barWidth/2+(outer_in_space-outer_mid_space)/2, DLocation.Y, DLocation.Z)); doc.Entities.Add(bottomDxfLine); doc.Entities.Add(leftDxfLine); doc.Entities.Add(topDxfLine); doc.Entities.Add(rightDxfLine); doc.Entities.Add(upDxfLine); doc.Entities.Add(midDxfLine); doc.Entities.Add(downDxfLine); }
/// <summary> /// 绘制垂直风向箭头 /// </summary> /// <param name="dxf"></param> /// <param name="DLocation"></param> public static void DrawVerticalWind(DxfModel dxf,DLocation DLocation) { double factor = 0.5f; Point3D v1 = new Point3D(); Point3D v2 = new Point3D(); Point3D v3 = new Point3D(); Point3D v4 = new Point3D(); Point3D v5 = new Point3D(); Point3D v6 = new Point3D(); Point3D v7 = new Point3D(); v1 = new Point3D(DLocation.X, DLocation.Y, DLocation.Z); v2 = new Point3D(DLocation.X+10*factor, DLocation.Y, DLocation.Z); v3 = new Point3D(DLocation.X - 10 * factor, DLocation.Y + 10 * factor, DLocation.Z); v4 = new Point3D(DLocation.X, DLocation.Y + 10 * factor, DLocation.Z); v5 = new Point3D(DLocation.X+10*factor, DLocation.Y + 10* factor, DLocation.Z); v6 = new Point3D(DLocation.X + 20 * factor, DLocation.Y + 10 * factor, DLocation.Z); v7 = new Point3D(DLocation.X +5 * factor, DLocation.Y + 20 * factor, DLocation.Z); DxfLine DxfLine23 = new DxfLine(v1, v2); dxf.Entities.Add(DxfLine23); DxfLine DxfLine56 = new DxfLine(v3, v6); dxf.Entities.Add(DxfLine56); DxfLine DxfLine14 = new DxfLine(v1, v4); dxf.Entities.Add(DxfLine14); DxfLine DxfLine74 = new DxfLine(v2, v5); dxf.Entities.Add(DxfLine74); DxfLine DxfLine25 = new DxfLine(v3, v7); dxf.Entities.Add(DxfLine25); DxfLine DxfLine71 = new DxfLine(v6, v7); dxf.Entities.Add(DxfLine71); }
public void Draw(DxfModel dxf, DLocation DLocation, double boxWidth, double boxHeight, List<PictureBoxInfo> pictureBoxInfoList,int coolingType) { DataManager dataManager=new DataManager(); //boxWidth = dataManager.getTotalWidth(pictureBoxInfoList); //得到框架信息 var boxEntity = dataCenter.BoxEntity; DLocation = new DLocation(DLocation.X - 120d, DLocation.Y + boxEntity.TopViewHeight + 80.0d + boxEntity.UpHeight + boxEntity.DownHeight, 0); boxWidth = boxEntity.Width + 240.0d; boxHeight = boxEntity.TopViewHeight + boxEntity.UpHeight + boxEntity.DownHeight + 160.0d; /****************************************************************************/ //绘制最外框 /****************************************************************************/ Point3D v1 = new Point3D(DLocation.X, DLocation.Y, DLocation.Z); Point3D v2 = new Point3D(DLocation.X, DLocation.Y - boxHeight, DLocation.Z); Point3D v3 = new Point3D(DLocation.X + boxWidth, DLocation.Y - boxHeight, DLocation.Z); Point3D v4 = new Point3D(DLocation.X + boxWidth, DLocation.Y, DLocation.Z); //DxfLinePointer.Draw(dxf, DLocation); //Slash.Draw(dxf,new DLocation(v2.X,v2.Y,v2.Z)); //Fan.Draw(dxf, v2,v1,2); DxfLine DxfLine12 = new DxfLine(v1, v2); dxf.Entities.Add(DxfLine12); DxfLine DxfLine23 = new DxfLine(v2, v3); dxf.Entities.Add(DxfLine23); DxfLine DxfLine34 = new DxfLine(v3, v4); dxf.Entities.Add(DxfLine34); DxfLine DxfLine14 = new DxfLine(v1, v4); dxf.Entities.Add(DxfLine14); /****************************************************************************/ //绘制左上角的配置信息 /****************************************************************************/ Configuration.Draw(dxf, new DLocation(v1.X, v1.Y), dataCenter.Configurations); /****************************************************************************/ //绘制左下角的节信息 /****************************************************************************/ Section.Draw(dxf, new DLocation(v2.X, v2.Y), dataCenter.SectionEntity); /****************************************************************************/ //绘制底部的订单信息 /****************************************************************************/ Order.Draw(dxf, new DLocation(v2.X, v2.Y), boxWidth, dataCenter.OrderEntity); //俯视图左下角的坐标点 DLocation v5 = new DLocation(DLocation.X + 120.0d, DLocation.Y - boxEntity.TopViewHeight - 50.0d, DLocation.Z); /****************************************************************************/ //绘制俯视图 /****************************************************************************/ //AssembleTopView.assembleTopView(pictureBoxInfoList, dxf, // v5, null, 50.0d, 18.0d, 2.0d, 2.86f, 2.0d, 2.0d); AssembleTopView.assembleTopView(pictureBoxInfoList, dxf, v5, dataCenter.topViewConfigure); //正视图左下角的坐标点 DLocation v6 = new DLocation(DLocation.X + 120.0d, DLocation.Y - boxEntity.TopViewHeight - 80.0d - boxEntity.UpHeight - boxEntity.DownHeight, DLocation.Z); /****************************************************************************/ //绘制正视图 /****************************************************************************/ AssembleDetailMechine.assembleDetailMechine(pictureBoxInfoList, dxf,v6, dataCenter.detailMechineConfigure, coolingType); //正视图两边的风向箭头位置 //存在第一层 DLocation v7 = new DLocation(DLocation.X + 70.0d, DLocation.Y - 90.0d-boxEntity.TopViewHeight-boxEntity.UpHeight-boxEntity.DownHeight/2, DLocation.Z); DLocation v8 = new DLocation(DLocation.X + boxWidth - 50.0d, DLocation.Y - 90.0d - boxEntity.TopViewHeight - boxEntity.UpHeight - boxEntity.DownHeight / 2, DLocation.Z); /****************************************************************************/ //绘制正视图两边的风向箭头 /****************************************************************************/ //判断是否存在两层,记录两层第一个元素的位置 int upFirstElemnet = AssembleDetailMechine.isTwoLayers(pictureBoxInfoList); Wind.Draw(dxf, v7, boxEntity.IsLeft); if (upFirstElemnet == -1) { if (pictureBoxInfoList.ElementAt(pictureBoxInfoList.Count - 1).name.Equals("SFC") || pictureBoxInfoList.ElementAt(pictureBoxInfoList.Count - 1).name.Equals("SDD")) { PictureBoxInfo tempPictureBoxInfo = pictureBoxInfoList.ElementAt(pictureBoxInfoList.Count - 1); List<AirFlowUpDimension> airFlowList = AirFlowUpDimensionConfigure.getAirFlowList(); foreach (var airFlowDimension in airFlowList) { if (tempPictureBoxInfo.coolingType.Equals(airFlowDimension.coolingType) && tempPictureBoxInfo.name.Equals(airFlowDimension.imageName)) { Wind.DrawVerticalWind(dxf, new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension*1.3, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height * 1.3, tempPictureBoxInfo.DLocation.Z)); //这里多写了一个标注,其实不应该写在这里应该写在AssembleDetailMechine中,只是这里写方便,但不符原则 DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension + airFlowDimension.topRightDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); } } } else { Wind.Draw(dxf, v8, boxEntity.IsLeft); } } else { if (pictureBoxInfoList.ElementAt(upFirstElemnet-1).name.Equals("SFC") || pictureBoxInfoList.ElementAt(upFirstElemnet-1).name.Equals("SDD")) { PictureBoxInfo tempPictureBoxInfo = pictureBoxInfoList.ElementAt(upFirstElemnet - 1); List<AirFlowUpDimension> airFlowList = AirFlowUpDimensionConfigure.getAirFlowList(); foreach (var airFlowDimension in airFlowList) { if (tempPictureBoxInfo.coolingType.Equals(airFlowDimension.coolingType) && tempPictureBoxInfo.name.Equals(airFlowDimension.imageName)) { Wind.DrawVerticalWind(dxf, new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension*1.3, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height * 1.3, tempPictureBoxInfo.DLocation.Z)); //这里多写了一个标注,其实不应该写在这里应该写在AssembleDetailMechine中,只是这里写方便,但不符原则 DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension + airFlowDimension.topRightDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); } } } else { Wind.Draw(dxf, v8, boxEntity.IsLeft); } } //如果存在第二层 if (boxEntity.UpHeight != 0) { DLocation v9 = new DLocation(DLocation.X + 70.0d, DLocation.Y - 90.0d - boxEntity.TopViewHeight - boxEntity.UpHeight / 2, DLocation.Z); DLocation v10 = new DLocation(DLocation.X + boxWidth - 50.0d, DLocation.Y - 90.0d - boxEntity.TopViewHeight - boxEntity.UpHeight / 2, DLocation.Z); if (pictureBoxInfoList.ElementAt(upFirstElemnet).name.Equals("PEC") || pictureBoxInfoList.ElementAt(upFirstElemnet).name.Equals("EDD")) { PictureBoxInfo tempPictureBoxInfo = pictureBoxInfoList.ElementAt(upFirstElemnet); List<AirFlowUpDimension> airFlowList = AirFlowUpDimensionConfigure.getAirFlowList(); foreach (var airFlowDimension in airFlowList) { if (tempPictureBoxInfo.coolingType.Equals(airFlowDimension.coolingType) && tempPictureBoxInfo.name.Equals(airFlowDimension.imageName)) { Wind.DrawVerticalWind(dxf, new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension*1.3, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height * 1.3, tempPictureBoxInfo.DLocation.Z)); //这里多写了一个标注,其实不应该写在这里应该写在AssembleDetailMechine中,只是这里写方便,但不符原则 DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); DoorRectangle.writeDimension(dxf, new DLocation(tempPictureBoxInfo.DLocation.X+airFlowDimension.topLeftDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), new DLocation(tempPictureBoxInfo.DLocation.X + airFlowDimension.topLeftDimension+airFlowDimension.topRightDimension, tempPictureBoxInfo.DLocation.Y + tempPictureBoxInfo.height, tempPictureBoxInfo.DLocation.Z), 16, 1, 3, "top"); } } } else { Wind.Draw(dxf, v9, !boxEntity.IsLeft); } Wind.Draw(dxf, v10, !boxEntity.IsLeft); } }
private static void AddEntity(DxfModel dxfModel,Line l) { DxfLine line = new DxfLine(l.ptStart,l.ptEnd); line.Thickness = l.thickness; dxfModel.Entities.Add(line); }