/// <summary> /// Initalizes a new instance of the <c>DxfDocument</c> class. /// </summary> /// <param name="drawingVariables"><see cref="HeaderVariables">Drawing variables</see> of the document.</param> internal DxfDocument(HeaderVariables drawingVariables, bool createDefaultObjects) : base("DOCUMENT") { this.comments = new List <string> { "Dxf file generated by netDxf http://netdxf.codeplex.com, Copyright(C) 2014 Daniel Carvajal, Licensed under LGPL" }; this.drawingVariables = drawingVariables; this.NumHandles = base.AsignHandle(0); this.DimensionBlocksGenerated = 0; this.GroupNamesGenerated = 0; this.AddedObjects = new Dictionary <string, DxfObject> { { this.handle, this } }; // keeps track of the added objects this.activeLayout = "Model"; // entities lists this.arcs = new List <Arc>(); this.ellipses = new List <Ellipse>(); this.dimensions = new List <Dimension>(); this.faces3d = new List <Face3d>(); this.solids = new List <Solid>(); this.inserts = new List <Insert>(); this.lwPolylines = new List <LwPolyline>(); this.polylines = new List <Polyline>(); this.polyfaceMeshes = new List <PolyfaceMesh>(); this.lines = new List <Line>(); this.circles = new List <Circle>(); this.points = new List <Point>(); this.texts = new List <Text>(); this.mTexts = new List <MText>(); this.hatches = new List <Hatch>(); this.splines = new List <Spline>(); this.images = new List <Image>(); this.mLines = new List <MLine>(); this.rays = new List <Ray>(); this.xlines = new List <XLine>(); this.viewports = new List <Viewport>(); this.meshes = new List <Mesh>(); this.attributeDefinitions = new List <AttributeDefinition>(); if (createDefaultObjects) { this.AddDefaultObjects(); } }
/// <summary> /// Write the given geometry table to a DXF file. /// </summary> /// <param name="filePath"></param> /// <param name="geometry"></param> /// <returns></returns> public bool WriteDXF(FilePath filePath, GeometryLayerTable geometry, bool binary = false) { var header = new HeaderVariables(); header.InsUnits = netDxf.Units.DrawingUnits.Meters; DxfDocument doc = new DxfDocument(header); foreach (GeometryLayer layer in geometry) { Layer dxfLayer = ToDXF.Convert(layer); doc.Layers.Add(dxfLayer); foreach (VertexGeometry geo in layer) { foreach (EntityObject entity in ToDXF.Convert(geo)) { entity.Layer = dxfLayer; doc.AddEntity(entity); } } } return(doc.Save(filePath, binary)); }
protected EntitiyBase() { HeaderVariables = new HeaderVariables(); XData = new XDataList(); }
/// <summary> /// Initalizes a new instance of the <c>DxfDocument</c> class. /// </summary> /// <param name="drawingVariables"><see cref="HeaderVariables">Drawing variables</see> of the document.</param> public DxfDocument(HeaderVariables drawingVariables) : this(drawingVariables, true) { }