//public static void AnnotationStirMidSpan(DxfModel model, int nSpans, double thickness, DxfLine[,] stirrupsMidspan) //{ // DxfLeader[] LeaderMidSpan = new DxfLeader[nSpans]; // for (int i = 0; i < LeaderMidSpan.Length; i++) // { // LeaderMidSpan[i] = new DxfLeader(model); // LeaderMidSpan[i].ArrowHeadEnabled = true; // LeaderMidSpan[i].Vertices.AddRange( // new Point3D[] { // new Point3D(stirrupsMidspan[i, 2].Start.X, thickness/2, 0), // new Point3D(stirrupsMidspan[i, 2].Start.X + 0.25, thickness/2, 0), // new Point3D(stirrupsMidspan[i, 2].Start.X + 0.25, -1.50, 0), // new Point3D(stirrupsMidspan[i, 2].Start.X - 1, -1.50, 0) // } // ); // model.Entities.AddRange(LeaderMidSpan[i]); // } //} public static void AnnotationStirRight(DxfModel model, int nSpans) { DxfLeader[] LeaderRt = new DxfLeader[nSpans]; for (int i = 0; i < LeaderRt.Length - 1; i++) { LeaderRt[i] = new DxfLeader(model); LeaderRt[i].ArrowHeadEnabled = true; LeaderRt[i].Vertices.AddRange( new Point3D[] { new Point3D(DXFRebar.stirrupsRight[i, 2].Start.X, (DXFPoints.startPointsTop[i].Y + DXFPoints.startPointsBot[i].Y) / 2, 0), new Point3D(DXFRebar.stirrupsRight[i, 2].Start.X - 0.50, (DXFPoints.startPointsTop[i].Y + DXFPoints.startPointsBot[i].Y) / 2, 0), new Point3D(DXFRebar.stirrupsRight[i, 2].Start.X - 0.50, DXFPoints.startPointsBot[i].Y - 1.50, 0), new Point3D(DXFRebar.stirrupsRight[i, 2].Start.X - 1.50, DXFPoints.startPointsBot[i].Y - 1.50, 0) } ); model.Entities.AddRange(LeaderRt[i]); } //case of cantilever at end if (GeometryEditorVM.GeometryEditor.RestraintsCollection[RFTCanvas.SpanVals.Length].SelectedRestraint != Restraints.NoRestraints) { LeaderRt[LeaderRt.Length - 1] = new DxfLeader(model); LeaderRt[LeaderRt.Length - 1].ArrowHeadEnabled = true; LeaderRt[LeaderRt.Length - 1].Vertices.AddRange( new Point3D[] { new Point3D(DXFRebar.stirrupsRight[LeaderRt.Length - 1, 2].Start.X, (DXFPoints.startPointsTop[LeaderRt.Length - 1].Y + DXFPoints.startPointsBot[LeaderRt.Length - 1].Y) / 2, 0), new Point3D(DXFRebar.stirrupsRight[LeaderRt.Length - 1, 2].Start.X - 0.50, (DXFPoints.startPointsTop[LeaderRt.Length - 1].Y + DXFPoints.startPointsBot[LeaderRt.Length - 1].Y) / 2, 0), new Point3D(DXFRebar.stirrupsRight[LeaderRt.Length - 1, 2].Start.X - 0.50, DXFPoints.startPointsBot[LeaderRt.Length - 1].Y - 1.50, 0), new Point3D(DXFRebar.stirrupsRight[LeaderRt.Length - 1, 2].Start.X - 1.50, DXFPoints.startPointsBot[LeaderRt.Length - 1].Y - 1.50, 0) } ); model.Entities.AddRange(LeaderRt[LeaderRt.Length - 1]); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string filename = null; if (args.Length > 0) { filename = args[0]; } else { // Uncomment to open an existing file. // filename = OpenFile(); } DxfModel model; if (!string.IsNullOrEmpty(filename)) { string extension = Path.GetExtension(filename); if (string.Compare(extension, ".dwg", true) == 0) { model = DwgReader.Read(filename); } else { model = DxfReader.Read(filename); } } else { model = new DxfModel(); } Application.Run(new MainForm(model)); }
public ViewControl() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); fishNetGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); graphicsConfig.FixedForegroundColor = System.Drawing.Color.Red; dynamicGdiGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); axisGraphics3D = new GDIGraphics3D(graphicsConfig); } { GraphicsConfig graphicsConfig = new GraphicsConfig(BackColor); polyGdiGraphics3D = new GDIGraphics3D(graphicsConfig); } this.KeyUp += new KeyEventHandler(ViewControl_KeyUp); modelPoly = new DxfModel(); bounds = new Bounds3D(); }
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 void CreateDrawables(DxfModel model, Matrix4D modelTransform) { this.ClearDrawables(); SurfaceGraphicsCache.Class507 class507 = new SurfaceGraphicsCache.Class507(this); DrawContext.Surface context = (DrawContext.Surface) new DrawContext.Surface.ModelSpace(model, this.graphicsConfig_0, modelTransform, this.charTriangulationCache_0); model.Draw(context, (ISurfaceGraphicsFactory)class507); }
private async void openAutoCadFileMenuItem_Click(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.List; openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder; openPicker.FileTypeFilter.Add(".dwg"); openPicker.FileTypeFilter.Add(".dxf"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { Stream inStream = await file.OpenStreamForReadAsync(); model = DwgReader.Read(inStream); var graphicsConfig = GraphicsConfig.AcadLikeWithBlackBackground; cadGraphics = new NetCoreGraphics3D(graphicsConfig, ImageRenderOptions.Default.GraphicsOptions); cadGraphics.CreateDrawables(model); bounds = new Bounds3D(); cadGraphics.BoundingBox(bounds); resizeEventDelayer.StopStart(); } }
//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; } } }
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 Test() { DxfModel model = new DxfModel(DxfVersion.Dxf14); DxfHatch hatch = new DxfHatch(); hatch.Color = EntityColors.Green; hatch.ElevationPoint = new Point3D(10,10, 0); hatch.ZAxis = new Vector3D(0, 0, 0); // A boundary path bounded by lines. DxfHatch.BoundaryPath boundaryPath1 = new DxfHatch.BoundaryPath(); boundaryPath1.Type = BoundaryPathType.None; hatch.BoundaryPaths.Add(boundaryPath1); boundaryPath1.Edges.Add(new DxfHatch.BoundaryPath.LineEdge(new Point2D(0, 0), new Point2D(1, 0))); boundaryPath1.Edges.Add(new DxfHatch.BoundaryPath.LineEdge(new Point2D(1, 0), new Point2D(1, 1))); boundaryPath1.Edges.Add(new DxfHatch.BoundaryPath.LineEdge(new Point2D(1, 1), new Point2D(0, 1))); boundaryPath1.Edges.Add(new DxfHatch.BoundaryPath.LineEdge(new Point2D(0, 1), new Point2D(0, 0))); // Define the hatch fill pattern. // Don't set a pattern for solid fill. hatch.Pattern = new DxfPattern(); DxfPattern.Line patternLine = new DxfPattern.Line(); hatch.Pattern.Lines.Add(patternLine); patternLine.Angle = System.Math.PI / 4d; patternLine.Offset = new Vector2D(0.02, -0.01d); patternLine.DashLengths.Add(0.02d); patternLine.DashLengths.Add(-0.01d); patternLine.DashLengths.Add(0d); patternLine.DashLengths.Add(-0.01d); model.Entities.Add(hatch); DxfWriter.Write("DxfWriteHatchTest.dxf", model, false); }
public static void CreateDrawables( IWireframeGraphicsFactory2 graphicsFactory, GraphicsConfig graphicsConfig, DxfModel model, IList <DxfEntity> modelSpaceEntities, IList <DxfEntity> paperSpaceEntities, DxfLayout layout, ICollection <DxfViewport> viewports) { if (viewports == null) { viewports = (ICollection <DxfViewport>)layout.Viewports; } bool flag; if (flag = (layout.PlotLayoutFlags & PlotLayoutFlags.DrawViewportsFirst) != PlotLayoutFlags.None) { WireframeGraphicsFactory2Util.smethod_1(graphicsFactory, graphicsConfig, model, modelSpaceEntities, layout, viewports); } using (DrawContext.Wireframe.PaperToPaperSpace paperToPaperSpace = new DrawContext.Wireframe.PaperToPaperSpace(model, layout, graphicsConfig, Matrix4D.Identity)) { foreach (DxfEntity paperSpaceEntity in (IEnumerable <DxfEntity>)paperSpaceEntities) { paperSpaceEntity.Draw((DrawContext.Wireframe)paperToPaperSpace, graphicsFactory); } } if (flag) { return; } WireframeGraphicsFactory2Util.smethod_1(graphicsFactory, graphicsConfig, model, modelSpaceEntities, layout, viewports); }
public static void CreateDrawables( IWireframeGraphicsFactory2 graphicsFactory, GraphicsConfig graphicsConfig, DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports) { if (layout.PaperSpace) { if (viewports == null) { viewports = (ICollection <DxfViewport>)layout.Viewports; } bool flag; if (flag = (layout.PlotLayoutFlags & PlotLayoutFlags.DrawViewportsFirst) != PlotLayoutFlags.None) { WireframeGraphicsFactory2Util.smethod_0(graphicsFactory, graphicsConfig, model, layout, (IEnumerable <DxfViewport>)viewports); } using (DrawContext.Wireframe.PaperToPaperSpace paperToPaperSpace = new DrawContext.Wireframe.PaperToPaperSpace(model, layout, graphicsConfig, Matrix4D.Identity)) layout.Draw((DrawContext.Wireframe)paperToPaperSpace, graphicsFactory); if (flag) { return; } WireframeGraphicsFactory2Util.smethod_0(graphicsFactory, graphicsConfig, model, layout, (IEnumerable <DxfViewport>)viewports); } else { WireframeGraphicsFactory2Util.CreateDrawables(graphicsFactory, graphicsConfig, model, Matrix4D.Identity); } }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, Matrix4D transform, GraphicsConfig graphicsConfig) { return(ImageExporter.CreateAutoSizedBitmap(model, transform, graphicsConfig, SmoothingMode.AntiAlias)); }
internal static DxfLayout smethod_5( DxfModel model, DxfBlock modelSpaceBlockRecord, bool useFixedHandles) { DxfLayout layout; if (modelSpaceBlockRecord.Layout == null) { layout = new DxfLayout(modelSpaceBlockRecord); if (useFixedHandles) { layout.SetHandle(34UL); } layout.Name = "Model"; layout.PlotLayoutFlags = PlotLayoutFlags.UseStandardScale | PlotLayoutFlags.PlotPlotStyles | PlotLayoutFlags.PrintLineweights | PlotLayoutFlags.DrawViewportsFirst | PlotLayoutFlags.ModelType; layout.PlotArea = PlotArea.LastScreenDisplay; layout.StandardScaleType = (short)0; layout.Options = LayoutOptions.PaperSpaceLinetypeScaling; layout.TabOrder = 0; layout.Limits = new Rectangle2D(0.0, 0.0, 12.0, 9.0); layout.LastActiveViewport = (DxfHandledObject)model.VPorts.GetActiveVPort(); modelSpaceBlockRecord.Layout = layout; model.Layouts.Add(layout); } else { layout = modelSpaceBlockRecord.Layout; } DxfLayout.smethod_6(model, layout); return(layout); }
internal override void vmethod_3(DxfModel modelContext) { base.vmethod_3(modelContext); if (this.OwnerBlock == null) { this.OwnerBlock = DxfBlock.smethod_3(modelContext); } DxfDictionary dictionaryAcadLayout = modelContext.DictionaryAcadLayout; if (dictionaryAcadLayout == null) { return; } bool flag = false; foreach (IDictionaryEntry entry in (ActiveList <IDictionaryEntry>)dictionaryAcadLayout.Entries) { if (object.ReferenceEquals((object)this, (object)entry.Value)) { flag = true; break; } } if (!flag) { dictionaryAcadLayout.Entries.Add((IDictionaryEntry) new DxfDictionaryEntry((DxfObject)this)); } if (this.OwnerObjectSoftReference == dictionaryAcadLayout) { return; } this.vmethod_2((IDxfHandledObject)dictionaryAcadLayout); }
private static Image <Bgra32> RenderToBitmap(DxfModel model) { var graphicsConfig = (GraphicsConfig)GraphicsConfig.AcadLikeWithWhiteBackground.Clone(); BoundsCalculator boundsCalculator = new BoundsCalculator(); boundsCalculator.GetBounds(model); Bounds3D bounds = boundsCalculator.Bounds; int size = 2000; Matrix4D transform = DxfUtil.GetScaleTransform( bounds.Min, bounds.Max, bounds.Center, new Point3D(0, size, 0), new Point3D(size, 0, 0), new Point3D(0.5d * size, 0.5d * size, 0) ); Memory <Bgra32> memory = new Memory <Bgra32>(); Image.WrapMemory <Bgra32>(memory, 10, 10); Image <Bgra32> bitmap = ImageExporter.CreateBitmap <Bgra32>( model, transform, graphicsConfig, //new GraphicsOptions(false), new Size(size, size)); return(bitmap); }
private static DxfModel CreateAutoCadDrawing() { DxfModel model = new DxfModel(); DxfText text = new DxfText("Welcome to WW.Cad", Point3D.Zero, 1) { Color = EntityColors.Blue }; model.Entities.Add(text); model.Entities.Add(new DxfText("the trial version only supports the orange color", new Point3D(0.2, -0.5, 0), 0.3) { Color = EntityColors.Gray }); // Make a fancy rectangle with rounded corner around the text. var textBounds = text.TextBounds; double margin = 1; double roundedCornerBulge = 0.5; model.Entities.Add( new DxfLwPolyline( new DxfLwPolyline.Vertex(textBounds.Min - margin * Vector2D.XAxis, roundedCornerBulge), new DxfLwPolyline.Vertex(textBounds.Min - margin * Vector2D.YAxis), new DxfLwPolyline.Vertex(textBounds.Min + textBounds.Delta.X * Vector2D.XAxis - margin * Vector2D.YAxis, roundedCornerBulge), new DxfLwPolyline.Vertex(textBounds.Min + textBounds.Delta.X * Vector2D.XAxis + margin * Vector2D.XAxis), new DxfLwPolyline.Vertex(textBounds.Max + margin * Vector2D.XAxis, roundedCornerBulge), new DxfLwPolyline.Vertex(textBounds.Max + margin * Vector2D.YAxis), new DxfLwPolyline.Vertex(textBounds.Min + textBounds.Delta.Y * Vector2D.YAxis + margin * Vector2D.YAxis, roundedCornerBulge), new DxfLwPolyline.Vertex(textBounds.Min + textBounds.Delta.Y * Vector2D.YAxis - margin * Vector2D.XAxis) ) { Closed = true, Color = EntityColors.Green }); return(model); }
public static void Write( Class889 stream, DxfModel model, uint estimatedObjectCount, uint objectsSectionStreamOffset) { stream.vmethod_9(0); stream.vmethod_11(estimatedObjectCount); if (model.Header.AcadVersion >= DxfVersion.Dxf15) { stream.vmethod_27(model.Header.UpdateUtcDateTime); } else { stream.vmethod_27(model.Header.UpdateDateTime); } stream.vmethod_11(objectsSectionStreamOffset); stream.vmethod_1((byte)4); stream.vmethod_11(50U); stream.vmethod_11(0U); stream.vmethod_11(100U); stream.vmethod_11(0U); stream.vmethod_11(512U); stream.vmethod_11(0U); stream.vmethod_11(uint.MaxValue); stream.vmethod_11(0U); }
/// <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)); } } }
protected DrawContext(DrawContext from) { this.image_0 = from.image_0; this.graphics_0 = from.graphics_0; this.dxfModel_0 = from.dxfModel_0; this.dxfLayout_0 = from.dxfLayout_0; this.graphicsConfig_0 = from.graphicsConfig_0; this.dxfLayer_0 = from.dxfLayer_0; this.dxfLayer_1 = from.dxfLayer_1; this.dxfEntity_0 = from.dxfEntity_0; this.dxfBlock_0 = from.dxfBlock_0; this.drawContext_0 = from.drawContext_0; this.dxfEntity_1 = from.dxfEntity_1; this.entityColor_0 = from.entityColor_0; this.transparency_0 = from.transparency_0; this.dxfColor_0 = from.dxfColor_0; this.dxfLineType_0 = from.dxfLineType_0; this.short_0 = from.short_0; this.int_0 = from.int_0; this.int_1 = from.int_1; this.dxfWipeoutVariables_0 = from.dxfWipeoutVariables_0; this.dictionary_0 = from.dictionary_0; this.double_0 = from.double_0; this.double_1 = from.double_1; }
public static Bitmap CreateBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, System.Drawing.Color backColor, Matrix4D to2DTransform, int width, int height) { Bitmap bitmap = new Bitmap(width, height); using (Graphics graphics = Graphics.FromImage((Image)bitmap)) { graphics.SmoothingMode = smoothingMode; graphics.Clear(backColor); if (layout.PaperSpace) { GraphicsConfig config = (GraphicsConfig)graphicsConfig.Clone(); double length = to2DTransform.Transform(WW.Math.Vector3D.XAxis).GetLength(); config.DotsPerInch = length * layout.GetLineWeightUnitsToPaperUnits() * 2540.0; GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(config); gdiGraphics3D.CreateDrawables(model, layout, viewports); gdiGraphics3D.Draw(graphics, new Rectangle(0, 0, width, height), to2DTransform); } else { GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.CreateDrawables(model); gdiGraphics3D.Draw(graphics, new Rectangle(0, 0, width, height), to2DTransform); } } return(bitmap); }
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 static void Save(string filePath, List<Line> lines) { DxfModel dxfModel = new DxfModel(DxfVersion.Dxf13); lines.ForEach(l=> AddEntity(dxfModel,l)); DwgWriter.Write(filePath, dxfModel); }
public static Bitmap CreateViewportConfigurationBitmap( DxfModel model, string vportName, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, int width, int height) { Bitmap bitmap = new Bitmap(width, height); Rectangle2D targetRectangle = new Rectangle2D(0.0, 0.0, (double)width, (double)height); Rectangle drawingBounds = new Rectangle(0, 0, width, height); using (Graphics graphics = Graphics.FromImage((Image)bitmap)) { graphics.SmoothingMode = smoothingMode; graphics.Clear((System.Drawing.Color)graphicsConfig.BackColor); GDIGraphics3D gdiGraphics3D = new GDIGraphics3D(graphicsConfig); gdiGraphics3D.CreateDrawables(model); foreach (DxfVPort vport in (DxfHandledObjectCollection <DxfVPort>)model.VPorts) { if (vportName.Equals(vport.Name, StringComparison.InvariantCultureIgnoreCase)) { IViewDescription viewDescription = vport.ViewDescription; Matrix4D transform = ViewUtil.GetTransform(viewDescription, targetRectangle, true); float num = 1f - (float)(viewDescription.ViewportCenter.Y + viewDescription.ViewportHeight / 2.0); RectangleF rect = new RectangleF((float)width * (float)(viewDescription.ViewportCenter.X - viewDescription.ViewportWidth / 2.0), (float)height * num, (float)width * (float)viewDescription.ViewportWidth, (float)height * (float)viewDescription.ViewportHeight); graphics.Clip = new System.Drawing.Region(rect); gdiGraphics3D.Draw(graphics, drawingBounds, transform); } } } return(bitmap); }
public static bool ValidateName( object obj, string name, DxfModel model, IList <DxfMessage> messages) { bool flag = true; if (name == null) { messages.Add(new DxfMessage(DxfStatus.EmptyName, Severity.Error, "target", obj)); flag = false; } else if (!model.Header.Dxf15OrHigher) { foreach (char c in name) { if (!ValidateUtil.smethod_0(c)) { messages.Add(new DxfMessage(DxfStatus.InvalidName, Severity.Error, "target", obj)); flag = false; break; } } if (name.Length > 31) { messages.Add(new DxfMessage(DxfStatus.InvalidNameLength, Severity.Error, "target", obj)); flag = false; } } return(flag); }
//Returns All layers public Stream GetLayers(Stream input) { string body = new StreamReader(input).ReadToEnd(); NameValueCollection _nvc = HttpUtility.ParseQueryString(body); string _fileName = _nvc["FileName"]; string _client_id = _nvc["ClientId"]; string _show_id = _nvc["ShowId"]; DxfModel _model = ReadDxf("h://dxf_uploads//" + _client_id + " // " + _show_id + "//" + _fileName); Dictionary <string, string> layers = new Dictionary <string, string>(); List <string> variableNames = new List <string>(); for (int i = 0; i < _model.Layers.Count; i++) { variableNames.Add(String.Format("layer{0}", i.ToString())); } int j = 0; foreach (var layerName in _model.Layers) { layers[variableNames[j]] = layerName.ToString(); j++; } string layerInfo = JsonConvert.SerializeObject(layers); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(Encoding.UTF8.GetBytes(layerInfo))); //return Json of all layers //return JsonConvert.SerializeObject(layers); }
public DxfExtendedData Get(DxfModel model, string appIdName) { DxfExtendedData extendedData; this.TryGetValue(model, appIdName, out extendedData); return(extendedData); }
public static DxfExtendedData.ValueCollection smethod_4( DxfHandledObject o, DxfModel model) { if (!o.HasExtendedData) { return((DxfExtendedData.ValueCollection)null); } DxfAppId appId; if (model == null || !model.AppIds.TryGetValue("AcadAnnotative", out appId)) { return((DxfExtendedData.ValueCollection)null); } DxfExtendedData extendedData; if (!o.ExtendedDataCollection.TryGetValue(appId, out extendedData)) { return((DxfExtendedData.ValueCollection)null); } DxfExtendedData.ValueCollection valueCollection = (DxfExtendedData.ValueCollection)null; if (extendedData.Values.Count > 1) { valueCollection = extendedData.Values[1] as DxfExtendedData.ValueCollection; } return(valueCollection); }
public Class993(MemoryStream stream, DxfModel model, Encoding encoding) { this.memoryStream_0 = stream; this.dxfModel_0 = model; this.encoding_0 = encoding; this.dxfVersion_0 = model.Header.AcadVersion; }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, GDIGraphics3D cadGraphics, SmoothingMode smoothingMode, Matrix4D transform, System.Drawing.Color backColor, Size maxSize) { cadGraphics.CreateDrawables(model); Bounds3D bounds = new Bounds3D(); cadGraphics.BoundingBox(bounds, transform); int num1 = maxSize.Width - 4; int num2 = maxSize.Height - 4; Matrix4D transform1 = DxfUtil.GetScaleTransform(bounds.Corner1, bounds.Corner2, new WW.Math.Point3D(bounds.Corner1.X, bounds.Corner2.Y, 0.0), new WW.Math.Point3D(0.0, (double)num2, 0.0), new WW.Math.Point3D((double)num1, 0.0, 0.0), new WW.Math.Point3D(2.0, 2.0, 0.0)) * transform; bounds.Reset(); cadGraphics.BoundingBox(bounds, transform1); if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, maxSize.Width, maxSize.Height)); } WW.Math.Vector3D delta = bounds.Delta; int width = System.Math.Min(maxSize.Width, (int)System.Math.Ceiling(delta.X) + 4); int height = System.Math.Min(maxSize.Height, (int)System.Math.Ceiling(delta.Y) + 4); return(ImageExporter.CreateBitmap(cadGraphics, smoothingMode, transform1, backColor, width, height)); }
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; }
internal static DxfBlock smethod_4( DxfModel model, bool useFixedHandles, string blockName, ulong blockRecordHandle, ulong blockBeginHandle, ulong endBlockHandle, bool paperSpace, bool createIfNotPresent) { DxfBlock dxfBlock; if (!model.AnonymousBlocks.TryGetValue(blockName, out dxfBlock) && createIfNotPresent) { dxfBlock = new DxfBlock(blockName); if (useFixedHandles) { dxfBlock.BlockBegin.SetHandle(blockBeginHandle); dxfBlock.BlockEnd.SetHandle(endBlockHandle); dxfBlock.SetHandle(blockRecordHandle); } model.AnonymousBlocks.Add(dxfBlock); } if (dxfBlock != null && dxfBlock.BlockBegin != null) { dxfBlock.BlockBegin.PaperSpace = paperSpace; } return(dxfBlock); }
internal static DxfBlock smethod_2( DxfModel model, bool useFixedHandles, bool createIfNotPresent) { return(DxfBlock.smethod_4(model, useFixedHandles, "*Model_Space", 31UL, 32UL, 33UL, false, createIfNotPresent)); }
internal DxfModel LoadExternalReference( Dictionary <string, DxfModel> loadedExternalReferences, DxfBlock.GetExternalReferenceDelegate resolveExternalReference, out bool wasAlreadyLoaded) { DxfModel dxfModel = (DxfModel)null; wasAlreadyLoaded = false; if (this.IsExternalReference && !string.IsNullOrEmpty(this.ExternalReference) && !this.IsExternalReferenceUnloaded) { wasAlreadyLoaded = loadedExternalReferences.TryGetValue(this.ExternalReference, out dxfModel); if (wasAlreadyLoaded) { if (!this.Model.ExternalReferences.ContainsKey(this.ExternalReference)) { this.Model.ExternalReferences.Add(this.ExternalReference, dxfModel); } } else { dxfModel = resolveExternalReference(this); if (dxfModel != null) { loadedExternalReferences.Add(this.ExternalReference, dxfModel); if (!this.Model.ExternalReferences.ContainsKey(this.ExternalReference)) { this.Model.ExternalReferences.Add(this.ExternalReference, dxfModel); } } } } return(dxfModel); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, System.Drawing.Color backColor, Size maxSize) { BoundsCalculator boundsCalculator = new BoundsCalculator(graphicsConfig); boundsCalculator.GetBounds(model, layout, viewports, transform); Bounds3D bounds = boundsCalculator.Bounds; if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, maxSize.Width, maxSize.Height)); } int num1 = maxSize.Width - 4; int num2 = maxSize.Height - 4; Matrix4D scaleTransform = DxfUtil.GetScaleTransform(bounds.Corner1, bounds.Corner2, new WW.Math.Point3D(bounds.Corner1.X, bounds.Corner2.Y, 0.0), new WW.Math.Point3D(0.0, (double)num2, 0.0), new WW.Math.Point3D((double)num1, 0.0, 0.0), new WW.Math.Point3D(2.0, 2.0, 0.0)); Matrix4D to2DTransform = scaleTransform * transform; WW.Math.Vector3D vector3D = scaleTransform.Transform(bounds.Corner2) - scaleTransform.Transform(bounds.Corner1); int width = System.Math.Min(maxSize.Width, (int)System.Math.Ceiling(System.Math.Abs(vector3D.X)) + 4); int height = System.Math.Min(maxSize.Height, (int)System.Math.Ceiling(System.Math.Abs(vector3D.Y)) + 4); return(ImageExporter.CreateBitmap(model, layout, viewports, graphicsConfig, smoothingMode, backColor, to2DTransform, width, height)); }
internal static DxfMLeaderStyle smethod_2(DxfModel model, bool useFixedHandles) { return(new DxfMLeaderStyle() { Name = "Standard" }); }
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 TopViewConfigure(List<PictureBoxInfo> imageNameList, DxfModel dxf, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space, double barHeight, double barWidth) { this.imageNameList = imageNameList; this.dxf = dxf; this.DxfText = DxfText; this.height = height; this.width = width; this.outer_mid_space = outer_mid_space; this.outer_in_space = outer_in_space; this.barHeight = barHeight; this.barWidth = barWidth; }
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); }
public static void ExportToJpg(DxfModel model, string fileName, Size maxSize) { GDIGraphics3D graphics = new GDIGraphics3D(GraphicsConfig.BlackBackgroundCorrectForBackColor); Bitmap bitmap = ImageExporter.CreateAutoSizedBitmap(model, graphics, Matrix4D.Identity, System.Drawing.Color.White, maxSize); using (Stream stream = File.Create(fileName)) { ImageExporter.EncodeImageToJpeg(bitmap, stream); } }
public static void Draw(DxfModel dxf, DLocation DLocation,List<string> configurations) { Point3D confStrPoint3D = new Point3D(DLocation.X + 5.0d, DLocation.Y - 5.0d, DLocation.Z); DxfText DxfText1 = new DxfText("CONFIGURATION: NOTE: Assembly drawing for overall dimesions, actual door size and handle position may vary", confStrPoint3D, 2.0d); //DxfText1.Layer.Color.Index = 8; dxf.Entities.Add(DxfText1); for (int i = 0; i < configurations.Count(); i++) { Point3D confPoint3D = new Point3D(DLocation.X+10.0d, DLocation.Y - 5.0d * (i + 2), DLocation.Z); DxfText DxfText = new DxfText(configurations[i], confPoint3D, 2.0d); dxf.Entities.Add(DxfText); } }
/// <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 void writeDimension(DxfModel doc,DLocation firstDLocation,DLocation secondDLocation,double DxfTextHeight,double DxfTextWidth,double dimensionHeight,string dimensionDirection) { DxfDimension.Aligned dimension = new DxfDimension.Aligned(doc.DefaultDimensionStyle); dimension.ExtensionLine1StartPoint = new Point3D(firstDLocation.X, firstDLocation.Y, firstDLocation.Z); dimension.ExtensionLine2StartPoint = new Point3D(secondDLocation.X, secondDLocation.Y, secondDLocation.Z); if (dimensionDirection.Equals("top")) dimension.DimensionLineLocation = new Point3D((firstDLocation.X + secondDLocation.X) / 2, firstDLocation.Y + dimensionHeight, firstDLocation.Z); else if (dimensionDirection.Equals("bottom")) dimension.DimensionLineLocation = new Point3D((firstDLocation.X + secondDLocation.X) / 2, firstDLocation.Y - dimensionHeight, firstDLocation.Z); else if (dimensionDirection.Equals("left")) dimension.DimensionLineLocation = new Point3D(firstDLocation.X - dimensionHeight, (firstDLocation.Y + secondDLocation.Y) / 2, firstDLocation.Z); else if (dimensionDirection.Equals("right")) dimension.DimensionLineLocation = new Point3D(firstDLocation.X + dimensionHeight, (firstDLocation.Y + secondDLocation.Y) / 2, firstDLocation.Z); dimension.DimensionStyleOverrides.TextHeight = 1d; dimension.DimensionStyleOverrides.ArrowSize = 1d; dimension.Text = getDimensionText(dimension); doc.Entities.Add(dimension); }
//画单门,包括下栅栏,包括2个左门闩,2个右把手 public static void writeBottoFanSingleDoor(DxfModel dxf, DLocation DLocation, string[] DxfText, double height, double width, double outer_mid_space, double outer_in_space, double barHeight, double barWidth, string upOrDownLayer) { //画两个门闩 writeDoorBarRectangle(dxf, DLocation, DxfText, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); double downLeftX=DLocation.X+outer_mid_space-barWidth/2+(outer_in_space-outer_mid_space)/2; double downLeftY=DLocation.Y + height / 4; writeRepresentDoorBarRectangle(dxf, 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(dxf, new DLocation(upLeftX,upLeftY , DLocation.Z), DxfText, height, width, outer_mid_space, outer_in_space, barHeight, barWidth); //画门把手 Handle.Draw(dxf, new DLocation(DLocation.X + 3 * width / 4, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); Handle.Draw(dxf, new DLocation(DLocation.X + 3 * width / 4, DLocation.Y + height / 4, DLocation.Z)); //画门把手 Handle.Draw(dxf, new DLocation(DLocation.X + 3 * width / 4, DLocation.Y + 3 * height / 4 - barHeight, DLocation.Z)); Handle.Draw(dxf, new DLocation(DLocation.X + 3 * width / 4, DLocation.Y + height / 4, DLocation.Z)); //下面位置栅栏 Fan.Draw(dxf, new Point3D(DLocation.X + width / 6, DLocation.Y + height / 7, DLocation.Z), new Point3D(DLocation.X + width * 4 / 5, DLocation.Y + height / 7, DLocation.Z), 0); }
public void Test1() { DxfModel model = new DxfModel(DxfVersion.Dxf14); // Create block. DxfBlock block = new DxfBlock("TEST_BLOCK"); model.Blocks.Add(block); block.Entities.Add(new DxfCircle(EntityColors.Blue, Point3D.Zero, 2d)); block.Entities.Add(new DxfLine(EntityColors.Red, Point3D.Zero, new Point3D(-1, 2, 1))); block.Entities.Add(new DxfLine(EntityColors.Green, Point3D.Zero, new Point3D(2, 0, 1))); // Insert block at 3 positions. model.Entities.Add(new DxfInsert(block, new Point3D(1, 0, 0))); model.Entities.Add(new DxfInsert(block, new Point3D(3, 1, 0))); model.Entities.Add(new DxfInsert(block, new Point3D(2, -3, 0))); DxfInsert dxfInsert = new DxfInsert(); dxfInsert.InsertionPoint = new Point3D(10,10,0); model.Entities.Add(dxfInsert); DxfWriter.Write("DxfWriteInsertTest.dxf", model, false); }
/// <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); }
/// <summary> /// 动态移动frame的最后一个vertical line的position /// </summary> /// <param name="frameModel"></param> /// <returns></returns> public static double getFrameLastVerticalLineX(DxfModel frameModel) { double tempX = Double.MinValue; foreach(DxfEntity entity in frameModel.Entities){ switch(entity.EntityType){ case "LINE": { DxfLine dxfLine=(DxfLine)entity; if (tempX <= dxfLine.Start.X) { tempX = dxfLine.Start.X; } }continue; } } return tempX; }
public static void assembleTopView(List<PictureBoxInfo> imageNameList, DxfModel dxf, DLocation DLocation, TopViewConfigure tvc) { int upFirstElement = AssembleDetailMechine.isTwoLayers(imageNameList); if (upFirstElement!= -1) { List<PictureBoxInfo> oneImageNameList = new List<PictureBoxInfo>(); List<PictureBoxInfo> twoImageNameList = new List<PictureBoxInfo>(); for (int i = 0, len = imageNameList.Count; i < len; i++) { if (i == 0) { //if (imageNameList.ElementAt(i).name.Equals("HRA")) //{ // //这里的virtralPictrueBox和realPictureBox中设置的Y坐标只是为后面onelist和twolist判断是其作用,其他没什么实质作用 // PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); // virtualPictureBox.name = "virtualHRA"; // //主要为了记录虚拟的框的坐标,为了画dxf是提供依据 // //virtualPictureBox.DLocation = new DLocation(imageNameList.ElementAt(i).DLocation.X, imageNameList.ElementAt(i).DLocation.Y + 113 + 4, imageNameList.ElementAt(i).DLocation.Z); // virtualPictureBox.DLocation = new DLocation(imageNameList.ElementAt(i).DLocation.X, imageNameList.ElementAt(i).DLocation.Y, imageNameList.ElementAt(i).DLocation.Z); // oneImageNameList.Add(virtualPictureBox); // PictureBoxInfo realPictureBox = new PictureBoxInfo(); // realPictureBox.name = imageNameList.ElementAt(i).name; // realPictureBox.DLocation = new DLocation(imageNameList.ElementAt(i).DLocation.X, imageNameList.ElementAt(i).DLocation.Y + 113 + 4, imageNameList.ElementAt(i).DLocation.Z); // twoImageNameList.Add(realPictureBox); //} //else //{ oneImageNameList.Add(imageNameList.ElementAt(i)); //} } else { if (oneImageNameList.ElementAt(0).DLocation.Y == imageNameList.ElementAt(i).DLocation.Y) { //if (imageNameList.ElementAt(i).name.Equals("HRA")) //{ // PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); // virtualPictureBox.name = "virtualHRA"; // virtualPictureBox.DLocation = new DLocation(imageNameList.ElementAt(i).DLocation.X, imageNameList.ElementAt(i).DLocation.Y + 113 + 4, imageNameList.ElementAt(i).DLocation.Z); // oneImageNameList.Add(virtualPictureBox); // twoImageNameList.Add(imageNameList.ElementAt(i)); //} //else //{ oneImageNameList.Add(imageNameList.ElementAt(i)); //} } else { //if (imageNameList.ElementAt(i).name.Equals("HRA")) //{ // PictureBoxInfo virtualPictureBox = new PictureBoxInfo(); // virtualPictureBox.name = "virtualHRA"; // virtualPictureBox.DLocation = new DLocation(imageNameList.ElementAt(i).DLocation.X, imageNameList.ElementAt(i).DLocation.Y + 113 + 4, imageNameList.ElementAt(i).DLocation.Z); // twoImageNameList.Add(virtualPictureBox); // oneImageNameList.Add(imageNameList.ElementAt(i)); //} //else //{ twoImageNameList.Add(imageNameList.ElementAt(i)); //} } } } if (oneImageNameList.ElementAt(0).DLocation.Y> twoImageNameList.ElementAt(0).DLocation.Y) { //第一层 assembleTopView(oneImageNameList, dxf, DLocation, tvc.DxfText, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth,-1); //DLocation为oneImageNamelist第一个元素的坐标 assembleTopView(twoImageNameList, dxf,new DLocation(twoImageNameList.ElementAt(0).DLocation.X,DLocation.Y,DLocation.Z), tvc.DxfText, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth,upFirstElement); } else { //第一层 assembleTopView(twoImageNameList, dxf, DLocation, tvc.DxfText, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth,-1); assembleTopView(oneImageNameList, dxf, DLocation, tvc.DxfText, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth, upFirstElement); } } else { assembleTopView(imageNameList, dxf, DLocation, tvc.DxfText, tvc.height, tvc.width, tvc.outer_mid_space, tvc.outer_in_space, tvc.barHeight, tvc.barWidth); } }
/// <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 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); } }
/// <summary> /// 过滤掉不符合条件的底部部分,是底部为平整的直线实体,方便计算最左边的顶点 /// </summary> /// <param name="sourceModel"></param> /// <returns></returns> public static DxfModel getFilterBottomNotLineDxfModel(DxfModel sourceModel) { DLocation relativeStartLocation = new DLocation(); double minX = Double.MaxValue; foreach (DxfEntity entity in sourceModel.Entities) { switch (entity.EntityType) { case "LINE": { DxfLine dxfLine = (DxfLine)entity; if (Math.Round(dxfLine.Start.Y * 10000) / 10000 == Math.Round(dxfLine.End.Y * 10000) / 10000) { if (Math.Round(minX * 10000) / 10000 >= Math.Round(dxfLine.Start.X * 10000) / 10000) { minX = dxfLine.Start.X; } } //消除画图人员错误绘制 if (Math.Round(dxfLine.Start.Y * 10000) / 10000 == Math.Round(dxfLine.End.Y * 10000) / 10000) { if (Math.Round(minX * 10000) / 10000 >= Math.Round(dxfLine.End.X * 10000) / 10000) { minX = dxfLine.End.X; } } }; continue; } } //将符合条件的entity加入到DxfModel中 DxfModel filterModel = new DxfModel(); foreach(DxfEntity entity in sourceModel.Entities) { switch(entity.EntityType) { case "LINE": { DxfLine dxfLine = (DxfLine)entity; //程序员绘画不规则造成 if (Math.Round(dxfLine.Start.X * 10000) / 10000 == Math.Round(minX*10000)/10000||Math.Round(dxfLine.End.X*10000)/10000==Math.Round(minX*10000)/10000) { filterModel.Entities.Add(dxfLine); } }continue; } } return filterModel; }
/// <summary> /// 获得Frame的左下角坐标 /// </summary> /// <param name="sourceModel"></param> /// <returns></returns> public static DLocation getFrameLeftDownLocation(DxfModel sourceModel) { DLocation dLocation = new DLocation(0, 0, 0); foreach(DxfEntity entity in sourceModel.Entities) { if (entity.EntityType.Equals("LWPOLYLINE")) { DxfLwPolyline dxfLwPolyline=(DxfLwPolyline)entity; DxfLwPolyline.VertexCollection vc = dxfLwPolyline.Vertices; for (int i = 0; i < vc.Count;i++ ) { if (i == 0) { dLocation.X = vc[i].Position.X; dLocation.Y = vc[i].Position.Y; } if(dLocation.X>=vc[i].Position.X&&dLocation.Y>=vc[i].Position.Y){ dLocation.X = vc[i].Position.X; dLocation.Y = vc[i].Position.Y; } } break; } } return dLocation; }
/// <summary> /// 获取Frame最右边的点坐标,用来动态增加框体的宽度 /// </summary> /// <param name="sourceFrameModel"></param> /// <returns></returns> public static Point2D getFrameRightPoint(DxfModel sourceFrameModel) { foreach(DxfEntity entity in sourceFrameModel.Entities) { switch (entity.EntityType) { case "LWPOLYLINE": { DxfLwPolyline dxfLwPolyLine = (DxfLwPolyline)entity; DxfLwPolyline.VertexCollection vertices = dxfLwPolyLine.Vertices; return getFrameRightX(vertices); } } } return new Point2D(0,0); }
/// <summary> /// 负责计算俯视图的函数 /// </summary> /// <param name="sourceModel"></param> /// <returns></returns> public static DLocation getTopViewRelativeStartLocation(DxfModel sourceModel) { DLocation relativeStartLocation = new DLocation(); double minX = Double.MaxValue; double minY = Double.MaxValue; foreach (DxfEntity entity in sourceModel.Entities) { switch (entity.EntityType) { case "LINE": { DxfLine dxfLine = (DxfLine)entity; if (Math.Round(dxfLine.Start.Y*10000)/10000 == Math.Round(dxfLine.End.Y*10000)/10000) { if (Math.Round(minX*10000)/10000 >= Math.Round(dxfLine.Start.X*10000)/10000) { if (Math.Round(minY*10000)/10000 >= Math.Round(dxfLine.Start.Y*10000)/10000) { minY = dxfLine.Start.Y; minX = dxfLine.Start.X; relativeStartLocation.X = dxfLine.Start.X; relativeStartLocation.Y = dxfLine.Start.Y; relativeStartLocation.Z = dxfLine.Start.Z; } } } //消除画图人员错误绘制 if (Math.Round(dxfLine.Start.Y * 10000) / 10000 == Math.Round(dxfLine.End.Y * 10000) / 10000) { if (Math.Round(minX * 10000) / 10000 >= Math.Round(dxfLine.End.X * 10000) / 10000) { if (Math.Round(minY * 10000) / 10000 >= Math.Round(dxfLine.End.Y * 10000) / 10000) { minX = dxfLine.End.X; minY = dxfLine.End.Y; relativeStartLocation.X = dxfLine.End.X; relativeStartLocation.Y = dxfLine.End.Y; relativeStartLocation.Z = dxfLine.End.Z; } } } }; continue; } } return relativeStartLocation; }
public static void puzzle(List<string> dxfFileNameList,List<string> dxfTopViewList,List<TextValue> valueList,string frameName) { DxfModel targetModel=new DxfModel(); testModel = targetModel; targetModel.TextStyles.Add(textStyle); CloneContext cloneContext = new CloneContext(targetModel, ReferenceResolutionType.CloneMissing); for (int i = 0; i < dxfFileNameList.Count;i++ ) { DxfModel sourceModel = DxfReader.Read(dxfFileNameList[i]); //第一个图形作为初始 if (i == 0) { //拼到一个图纸中后,Entity应该参照那个的左下角坐标 location = getRelativeStartLocation(sourceModel); //源图纸中Entity的左下角坐标 relativeStartLocation = getRelativeStartLocation(sourceModel); //保存第一个算好的左下角坐标 firstDimensionLocation = location; foreach (DxfEntity entity in sourceModel.Entities) { DxfEntity clonedEntity = (DxfEntity)entity.Clone(cloneContext); clonedEntity = getCaculateLocationEntity(clonedEntity, location, relativeStartLocation); targetModel.Entities.Add(clonedEntity); } rightLocation = getNextStartLocation(positionList); //记录最后一点坐标 lastDimensionLocation = rightLocation; //清空坐标位置链表 positionList.RemoveAll(name => { return true;}); //花标注 DxfDimension.Aligned dxfDimension = new DxfDimension.Aligned(targetModel.DefaultDimensionStyle); dxfDimension.ExtensionLine1StartPoint = new Point3D(location.X, location.Y, location.Z); dxfDimension.ExtensionLine2StartPoint = new Point3D(rightLocation.X, rightLocation.Y, rightLocation.Z); dxfDimension.DimensionStyleOverrides.TextHeight = 56d; dxfDimension.DimensionStyleOverrides.ArrowSize = 56d; dxfDimension.Text = getDimensionText(dxfDimension); // dxfDimension.DimensionLineLocation = new Point3D((location.X+rightLocation.X)/2,location.Y-8,location.Z); targetModel.Entities.Add(dxfDimension); } else { location = rightLocation; relativeStartLocation = getRelativeStartLocation(sourceModel); foreach (DxfEntity entity in sourceModel.Entities) { DxfEntity clonedEntity = (DxfEntity)entity.Clone(cloneContext); clonedEntity = getCaculateLocationEntity(clonedEntity, location, relativeStartLocation); targetModel.Entities.Add(clonedEntity); } rightLocation = getNextStartLocation(positionList); lastDimensionLocation = rightLocation; //计算最后一个元素右上角坐标 if (i == dxfFileNameList.Count - 1) { rightTopDimensionLocation = getRightTopLocation(positionList); largestLocation = getLargestXLocation(positionList); } positionList.RemoveAll(name => { return true; }); //花标注 DxfDimension.Aligned dxfDimension = new DxfDimension.Aligned(targetModel.DefaultDimensionStyle); dxfDimension.ExtensionLine1StartPoint = new Point3D(location.X, location.Y, location.Z); dxfDimension.ExtensionLine2StartPoint = new Point3D(rightLocation.X, rightLocation.Y, rightLocation.Z); dxfDimension.DimensionStyleOverrides.TextHeight = 56d; dxfDimension.DimensionStyleOverrides.ArrowSize = 56d; dxfDimension.Text = getDimensionText(dxfDimension); targetModel.Entities.Add(dxfDimension); } } DxfDimension.Aligned wholeDxfDimension = new DxfDimension.Aligned(targetModel.DefaultDimensionStyle); wholeDxfDimension.ExtensionLine1StartPoint = new Point3D(firstDimensionLocation.X, firstDimensionLocation.Y, firstDimensionLocation.Z); wholeDxfDimension.ExtensionLine2StartPoint = new Point3D(lastDimensionLocation.X, lastDimensionLocation.Y, lastDimensionLocation.Z); wholeDxfDimension.DimensionStyleOverrides.TextHeight = 56d; wholeDxfDimension.DimensionStyleOverrides.ArrowSize = 56d; wholeDxfDimension.Text = getDimensionText(wholeDxfDimension); wholeDxfDimension.DimensionLineLocation = new Point3D(firstDimensionLocation.X+lastDimensionLocation.X,firstDimensionLocation.Y-1000,firstDimensionLocation.Z); targetModel.Entities.Add(wholeDxfDimension); DxfDimension.Aligned rightDimension = new DxfDimension.Aligned(targetModel.DefaultDimensionStyle); rightDimension.ExtensionLine1StartPoint = new Point3D(lastDimensionLocation.X, lastDimensionLocation.Y, lastDimensionLocation.Z); rightDimension.ExtensionLine2StartPoint = new Point3D(rightTopDimensionLocation.X, rightTopDimensionLocation.Y, rightTopDimensionLocation.Z); rightDimension.DimensionStyleOverrides.TextHeight = 56d; rightDimension.DimensionStyleOverrides.ArrowSize = 56d; rightDimension.Text = getDimensionText(rightDimension); rightDimension.DimensionLineLocation = new Point3D(largestLocation.X + 200, firstDimensionLocation.Y, firstDimensionLocation.Z); targetModel.Entities.Add(rightDimension); //绘制俯视图 for (int i = 0; i < dxfTopViewList.Count;i++ ) { DxfModel topViewSourceModel = new DxfModel(); topViewSourceModel = DxfReader.Read(dxfTopViewList[i]); if (i == 0) { topViewLocation = new DLocation(firstDimensionLocation.X, rightTopDimensionLocation.Y + RelativeDistance.yTopViewDistance, firstDimensionLocation.Z); topViewRelativeLocation = getTopViewRelativeStartLocation(topViewSourceModel); } else { topViewLocation = topViewRightLocation; DxfModel filterModel = getFilterBottomNotLineDxfModel(topViewSourceModel); topViewRelativeLocation = getTopViewRelativeStartLocation(filterModel); } foreach(DxfEntity entity in topViewSourceModel.Entities) { DxfEntity clonedEntity = (DxfEntity)entity.Clone(cloneContext); clonedEntity = getCaculateLocationEntity(clonedEntity, topViewLocation, topViewRelativeLocation); targetModel.Entities.Add(clonedEntity); } topViewRightLocation = getTopViewNextStartLocation(positionList); positionList.RemoveAll(name=>{return true;}); } // 复制frame框体 DxfModel sourceFrameModel = new DxfModel(); sourceFrameModel = DxfReader.Read(frameName); DLocation frameLeftDownLocation = getFrameLeftDownLocation(sourceFrameModel); frameLastLineX = getFrameLastVerticalLineX(sourceFrameModel); Point2D frameRightPoint2D = getFrameRightPoint(sourceFrameModel); //这里求的是宽度比较,因为Frame的最后位置还没确定,不能单纯的考个别点进行位置大小比较 if ((largestLocation.X-firstDimensionLocation.X+RelativeDistance.xDistance)>= (frameRightPoint2D.X-frameLeftDownLocation.X)) { RelativeDistance.increaseWidth = (largestLocation.X - firstDimensionLocation.X + RelativeDistance.xDistance) - (frameRightPoint2D.X - frameLeftDownLocation.X) + RelativeDistance.xDistance; } else { RelativeDistance.increaseWidth = 0; } foreach (DxfEntity entity in sourceFrameModel.Entities) { DxfEntity clonedEntity = (DxfEntity)entity.Clone(cloneContext); clonedEntity = getFrameEntity(clonedEntity, firstDimensionLocation, frameLeftDownLocation, RelativeDistance.increaseWidth); targetModel.Entities.Add(clonedEntity); } //传递表单数据值 foreach(TextValue textValue in textValueList){ foreach(TextValue transFormValue in valueList){ if (textValue.text.Equals(transFormValue.text)) { DxfText dxfText = new DxfText(); dxfText.Text = transFormValue.value; dxfText.Height = textValue.height; dxfText.Thickness = 0.5d; dxfText.AlignmentPoint1 = new Point3D(textValue.valuePosition.X, textValue.valuePosition.Y, textValue.valuePosition.Z); dxfText.AlignmentPoint2 = dxfText.AlignmentPoint1; targetModel.Entities.Add(dxfText); } } } cloneContext.ResolveReferences(); DxfWriter.Write("cloneTest.dxf", targetModel); }
/// <summary> /// 生成浏览dxf代码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { //DxfDocument dxf = new DxfDocument(); DxfModel dxf = new DxfModel(DxfVersion.Dxf15); //获取dxf图纸左上角图纸说明信息 List<string> dxfImageInfoList = FrontPhotoService.translateImageInfo(FrontPhotoService.productionDescription, imageBoxList); //缩放到真实比例 List<ImageEntity> dxfPaintImageBoxList = new List<ImageEntity>(); for (int i = 0; i < imageBoxList.Count;i++ ) { ImageEntity dxfPaintEntity = new ImageEntity(); dxfPaintEntity.Name = imageBoxList.ElementAt(i).Name; dxfPaintEntity.Rect = imageBoxList.ElementAt(i).Rect; dxfPaintEntity.imageWidth = imageBoxList.ElementAt(i).imageWidth; dxfPaintEntity.Type = imageBoxList.ElementAt(i).Type; dxfPaintEntity.Url = imageBoxList.ElementAt(i).Url; dxfPaintEntity.Text = imageBoxList.ElementAt(i).Text; dxfPaintEntity.firstDistance = imageBoxList.ElementAt(i).firstDistance; dxfPaintEntity.secondDistance = imageBoxList.ElementAt(i).secondDistance; dxfPaintEntity.coolingType = imageBoxList.ElementAt(i).coolingType; dxfPaintEntity.thirdDistance = imageBoxList.ElementAt(i).thirdDistance; dxfPaintEntity.topViewFirstDistance = imageBoxList.ElementAt(i).topViewFirstDistance; dxfPaintEntity.topViewSecondDistance = imageBoxList.ElementAt(i).topViewSecondDistance; dxfPaintImageBoxList.Add(dxfPaintEntity); } dxfPaintImageBoxList = FrontPhotoService.zoomOutImageEntity(dxfPaintImageBoxList, 1 / FrontPhotoService.factor); List<PictureBoxInfo> dxfReflectPictureNameList = new List<PictureBoxInfo>(); for (int i = 0, len = dxfPaintImageBoxList.Count; i < len; i++) { ImageEntity imageEntity = dxfPaintImageBoxList.ElementAt(i); // if(imageEntity.Name!="virtualHRA"){ PictureBoxInfo pbi = new PictureBoxInfo(); //pbi.location = new Location(tempDxfRelectPictureBox.Location.X,tempDxfRelectPictureBox.Location.Y,0); pbi.DLocation = new DLocation(imageEntity.Rect.X, imageEntity.Rect.Y, 0); pbi.height = imageEntity.Rect.Height; //相当于设备的长度 pbi.width = imageEntity.Rect.Width; pbi.topViewHeight = imageEntity.imageWidth; pbi.name = imageEntity.Name; pbi.text = TextSplitService.textSplit(imageEntity.Text); pbi.firstDistance = imageEntity.firstDistance; pbi.secondDistance = imageEntity.secondDistance; pbi.coolingType = imageEntity.coolingType; pbi.thirdDistance = imageEntity.thirdDistance; pbi.topViewFirstDistance = imageEntity.topViewFirstDistance; pbi.topViewSecondDistance = imageEntity.topViewSecondDistance; dxfReflectPictureNameList.Add(pbi); // } } //dxfReflectPictureNameList = FrontPhotoService.getRanglePictureInfoList(dxfReflectPictureNameList); DataCenter dataCenter = new DataCenter(); dataCenter.SectionEntity = new SectionEntity("40", "60"); dataCenter.OrderEntity = new OrderEntity("jobname", "unittag"); //图纸左上角说明信息 dataCenter.Configurations = dxfImageInfoList; dataCenter.detailMechineConfigure=new DetailMechineConfigure(dxfReflectPictureNameList, new string[] { "hello", "world", "helloworld" }, 44.0f, 18, 1.0f, 1.56f, 2.0f, 2.0f); dataCenter.topViewConfigure = new TopViewConfigure(dxfReflectPictureNameList, dxf, null, 50.0f, 18.0f, 2.0f, 2.86f, 2.0f, 2.0f); //float totalWidth = TotalWidthAndHeight.getWidth(dxfReflectPictureNameList); //获得下层链表 List<ImageEntity> tempDownList = FrontPhotoService.getDownList(imageBoxList); double totalWidth = TotalWidthAndHeight.getWidth(tempDownList); //double totalWidth = TotalWidthAndHeight.getWidth(dxfReflectPictureNameList); if (AssembleDetailMechine.isTwoLayers(dxfReflectPictureNameList)!=-1) { //float[] upOrDownHeightOrViewHieght = new float[3]; double[] upOrDownHeightOrViewHieght = new double[3]; upOrDownHeightOrViewHieght = TotalWidthAndHeight.getEachLayerHight(dxfReflectPictureNameList); dataCenter.BoxEntity = new BoxEntity { DownHeight = upOrDownHeightOrViewHieght[0], UpHeight = upOrDownHeightOrViewHieght[1], Width = totalWidth, TopViewHeight = upOrDownHeightOrViewHieght[2], IsLeft =FrontPhotoService.mirrorDirection.Equals("mirrorRight")?true:false }; } else { //float[] upOrDownHeightOrViewHieght = new float[3]; double[] upOrDownHeightOrViewHieght = new double[3]; upOrDownHeightOrViewHieght = TotalWidthAndHeight.getEachLayerHight(dxfReflectPictureNameList); dataCenter.BoxEntity = new BoxEntity { DownHeight = upOrDownHeightOrViewHieght[0], UpHeight = 0, Width = totalWidth, TopViewHeight = upOrDownHeightOrViewHieght[2], IsLeft = FrontPhotoService.mirrorDirection.Equals("mirrorRight") ? true : false }; } OuterBox outerBox = new OuterBox(); outerBox.dataCenter = dataCenter; //outerBox.Draw(dxf, new Location(500, 500), 306, 188, dxfReflectPictureNameList,5); outerBox.Draw(dxf, new DLocation(FrontPhotoService.leftStartX, FrontPhotoService.leftStartY), 306, 188, dxfReflectPictureNameList, 5); //dxf.Save("AutoCad2007.dxf", DxfVersion.AutoCad2007); //dxf.Save("AutoCad2004.dxf", DxfVersion.AutoCad2004); //dxf.Save("AutoCad2000.dxf", DxfVersion.AutoCad2000); //dxf.Save("AutoCad12.dxf", DxfVersion.AutoCad12); DxfWriter.Write("DxfWriteExample-R15-ascii.dxf", dxf, false); DxfWriter.Write("DxfWriteExample-R15-bin.dxf", dxf, true); DxfViewer dv = new DxfViewer(); dv.setDxfFile("DxfWriteExample-R15-ascii.dxf"); dv.Show(); //MessageBox.Show("图纸生成成功!"); }
public MainForm(DxfModel model) { InitializeComponent(); viewControl.ModelFishNet = model; viewControl.ModelAxis = CreateModelWithAxes(); }
public void ExportDwgToJpg(string destPath) { string sourcePath = String.Format("{0}{1}.dwg", DefaultDwgFolder, Control.ControlNo); Dictionary<string, string> dictDim = new Dictionary<string, string>(); foreach (ControlDrawingDetail detail in ControlDrawingDetails) { if (dictDim.ContainsKey(detail.Dim.DimNo) == false) { dictDim.Add(detail.Dim.DimNo, detail.DimValue); } } try { DxfModel readModel = DwgReader.Read(sourcePath); DxfModel writeModel = new DxfModel(); CloneContext ct = new CloneContext(readModel, ReferenceResolutionType.CloneMissing); TransformConfig tc = new TransformConfig(); Matrix4D translation = Transformation4D.Translation(250, 0, 0); ct.RenameClashingBlocks = true; for (int i = 0; i < readModel.Entities.Count; i++) { DxfEntity block = readModel.Entities[i]; if (block.GetType() == typeof(DxfMText)) { DxfMText di = (DxfMText)block; if (dictDim.ContainsKey(di.SimplifiedText)) { di.Text = dictDim[di.SimplifiedText]; di.Width = di.BoxWidth * 2; } writeModel.Entities.Add(di); } else if (block.GetType() == typeof(DxfText)) { DxfText di = (DxfText)block; if (dictDim.ContainsKey(di.SimplifiedText)) { di.Text = dictDim[di.SimplifiedText]; } writeModel.Entities.Add(di); } else { writeModel.Entities.Add(block); } } ct.ResolveReferences(); CADHelper.ExportToJpg(writeModel, destPath); } catch (Exception exc) { Tracing.Tracer.LogError(exc.Message); Logger.For(this).Error(exc.Message); } }
public DetailMechineConfigure getDetailMechineCnfigure(List<PictureBoxInfo> pictureBoxNameList, DxfModel dxf, DLocation DLocation) { return new DetailMechineConfigure(pictureBoxNameList, new string[] { "hello", "world", "helloworld" }, 44.0d, 18, 2.0d, 2.86f, 2.0d, 2.0d); }
public TopViewConfigure getTopViewConfigure(List<PictureBoxInfo> pictureBoxNameList, DxfModel dxf, DLocation DLocation) { return new TopViewConfigure(pictureBoxNameList, dxf, null, 50.0d, 18.0d, 2.0d, 2.86f, 2.0d, 2.0d); }