Exemplo n.º 1
0
 /// <summary>
 /// Attributes of an entity
 /// </summary>
 /// <param name="attrib"></param>
 public void EntityAttributes(DL_Attributes attrib)
 {
     // layer name
     DxfString(8, attrib.Layer);
     DxfString(6, attrib.LineType);
     DxfInt(62, attrib.Color);
     DxfReal(370, attrib.Width != -1.0 ? attrib.Width : 0.0);
 }
Exemplo n.º 2
0
 public void WritePoint(DL_Writer dw, DL_PointData data, DL_Attributes attrib)
 {
     dw.Entity("POINT");
     dw.DxfString(100, "AcDbEntity");
     dw.EntityAttributes(attrib);
     dw.DxfString(100, "AcDbPoint");
     dw.Coord(DL_Codes.POINT_COORD_CODE, data.x, data.y, data.z);
 }
Exemplo n.º 3
0
 public void WriteLine(DL_Writer dw, DL_LineData data, DL_Attributes attrib)
 {
     dw.Entity("LINE");
     dw.DxfString(100, "AcDbEntity");
     dw.EntityAttributes(attrib);
     dw.DxfString(100, "AcDbLine");
     dw.Coord(DL_Codes.LINE_START_CODE, data.x1, data.y1, data.z1);
     dw.Coord(DL_Codes.LINE_END_CODE, data.x2, data.y2, data.z2);
 }
Exemplo n.º 4
0
 public void writePoint(DL_Writer dw, DL_PointData data, DL_Attributes attrib)
 {
     dw.entity("POINT");
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbEntity");
         dw.dxfString(100, "AcDbPoint");
     }
     dw.entityAttributes(attrib);
     dw.coord(DL_Codes.POINT_COORD_CODE, data.x, data.y, data.z);
 }
Exemplo n.º 5
0
 public void WriteArc(DL_Writer dw, DL_ArcData data, DL_Attributes attrib)
 {
     dw.Entity("ARC");
     dw.DxfString(100, "AcDbEntity");
     dw.EntityAttributes(attrib);
     dw.DxfString(100, "AcDbCircle");
     dw.Coord(10, data.cx, data.cy, data.cz);
     dw.DxfReal(40, data.radius);
     dw.DxfString(100, "AcDbArc");
     dw.DxfReal(50, data.angle1);
     dw.DxfReal(51, data.angle2);
 }
Exemplo n.º 6
0
 public void writeLine(DL_Writer dw, DL_LineData data, DL_Attributes attrib)
 {
     dw.entity("LINE");
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbEntity");
         dw.dxfString(100, "AcDbLine");
     }
     dw.entityAttributes(attrib);
     dw.coord(DL_Codes.LINE_START_CODE, data.x1, data.y1, data.z1);
     dw.coord(DL_Codes.LINE_END_CODE, data.x2, data.y2, data.z2);
     dw.dxfInt(DL_Codes.COLOUR_CODE, data.color);
 }
Exemplo n.º 7
0
        public void writeLayer(DL_Writer dw, DL_LayerData data, DL_Attributes attrib)
        {
            if (data.lName.Length == 0)
            {
                throw new DL_Exception("DL_Dxf::writeLayer: Layer name must not be empty\n");
            }

            int color = attrib.Color;

            if (color == 0)
            {
                color = 7;
                throw new DL_Exception("Layer color cannot be 0. Corrected to 7.\n");
            }

            if (data.lName == "0")
            {
                dw.tableLayerEntry(0x10);
            }
            else
            {
                dw.tableLayerEntry();
            }

            dw.dxfString(2, data.lName);
            dw.dxfInt(70, data.lFlag);
            dw.dxfInt(62, color);

            dw.dxfString(6, (attrib.LineType.Length == 0 ?
                             "CONTINUOUS" : attrib.LineType));

            if (_version >= DL_Codes.VER_2000)
            {
                // layer defpoints cannot be plotted
                if (data.lName.ToLower().CompareTo("defpoints") == 0)
                {
                    dw.dxfInt(290, 0);
                }
            }
            if (_version >= DL_Codes.VER_2000 && attrib.Width != -1)
            {
                dw.dxfInt(370, attrib.Width);
            }
            if (_version >= DL_Codes.VER_2000)
            {
                dw.dxfHex(390, 0xF);
            }
        }
Exemplo n.º 8
0
 public void WriteText(DL_Writer dw, DL_TextData data, DL_Attributes attrib)
 {
     dw.Entity("TEXT");
     dw.DxfString(100, "AcDbEntity");
     dw.DxfString(100, "AcDbText");
     dw.EntityAttributes(attrib);
     dw.Coord(10, data.ipx, data.ipy, data.ipz);
     dw.DxfReal(40, data.height);
     dw.DxfString(1, data.text);
     dw.DxfInt(50, 0);
     dw.DxfReal(41, data.xScaleFactor);
     dw.DxfReal(51, data.angle);
     dw.DxfString(7, data.style);
     dw.DxfInt(71, data.textGenerationFlags);
     dw.DxfInt(72, data.hJustification);
     dw.Coord(11, data.apx, data.apy, data.apz);
     dw.DxfInt(73, data.vJustification);
 }
Exemplo n.º 9
0
 public void writeArc(DL_Writer dw, DL_ArcData data, DL_Attributes attrib)
 {
     dw.entity("ARC");
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbEntity");
     }
     dw.entityAttributes(attrib);
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbCircle");
     }
     dw.coord(10, data.cx, data.cy, data.cz);
     dw.dxfReal(40, data.radius);
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbArc");
     }
     dw.dxfReal(50, data.angle1);
     dw.dxfReal(51, data.angle2);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Attributes of an entity
        /// </summary>
        /// <param name="attrib"></param>
        public void entityAttributes(DL_Attributes attrib)
        {
            // layer name
            dxfString(8, attrib.Layer);
            // R12 does not accept BYLAYER values.
            // The value has to be missing in that case.
            if (_version >= DL_Codes.VER_2000 || 256 != attrib.Color)
            {
                dxfInt(62, attrib.Color);
            }

            if (_version >= DL_Codes.VER_2000)
            {
                dxfInt(370, attrib.Width);
            }

            if (_version >= DL_Codes.VER_2000 || attrib.LineType.CompareTo("BYLAYER") == 0)
            {
                dxfString(6, attrib.LineType);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Attributes of an entity
        /// </summary>
        /// <param name="attrib"></param>
        public void entityAttributes(DL_Attributes attrib)
        { 
            // layer name
            dxfString(8, attrib.Layer);
            // R12 does not accept BYLAYER values.
            // The value has to be missing in that case.
            if (_version >= DL_Codes.VER_2000 || 256 != attrib.Color)
                dxfInt(62, attrib.Color);

            if (_version >= DL_Codes.VER_2000)
                dxfInt(370, attrib.Width);

            if (_version >= DL_Codes.VER_2000 || attrib.LineType.CompareTo("BYLAYER") == 0)
                dxfString(6, attrib.LineType);
        }
Exemplo n.º 12
0
        public void writeLayer(DL_Writer dw, DL_LayerData data, DL_Attributes attrib)
        {
            if (data.lName.Length == 0)
                throw new DL_Exception("DL_Dxf::writeLayer: Layer name must not be empty\n");

            int color = attrib.Color;
            if (color==0) {
                color = 7;
                throw new DL_Exception("Layer color cannot be 0. Corrected to 7.\n");
            }

            if (data.lName == "0") {
                dw.tableLayerEntry(0x10);
            } else {
                dw.tableLayerEntry();
            }

            dw.dxfString(2, data.lName);
            dw.dxfInt(70, data.lFlag);
            dw.dxfInt(62, color);

            dw.dxfString(6, (attrib.LineType.Length==0 ?
                             "CONTINUOUS" : attrib.LineType));

            if (_version>=DL_Codes.VER_2000) {
                // layer defpoints cannot be plotted
                if (data.lName.ToLower().CompareTo("defpoints") == 0) {
                    dw.dxfInt(290, 0);
                }
            }
            if (_version>=DL_Codes.VER_2000 && attrib.Width!=-1) {
                dw.dxfInt(370, attrib.Width);
            }
            if (_version>=DL_Codes.VER_2000) {
                dw.dxfHex(390, 0xF);
            }
        }
Exemplo n.º 13
0
 public void writeArc(DL_Writer dw, DL_ArcData data, DL_Attributes attrib)
 {
     dw.entity("ARC");
     if (_version == DL_Codes.VER_2000)
         dw.dxfString(100, "AcDbEntity");
     dw.entityAttributes(attrib);
     if (_version == DL_Codes.VER_2000)
         dw.dxfString(100, "AcDbCircle");
     dw.coord(10, data.cx, data.cy, data.cz);
     dw.dxfReal(40, data.radius);
     if (_version == DL_Codes.VER_2000)
         dw.dxfString(100, "AcDbArc");
     dw.dxfReal(50, data.angle1);
     dw.dxfReal(51, data.angle2);
 }
Exemplo n.º 14
0
 public void writeLine(DL_Writer dw, DL_LineData data, DL_Attributes attrib)
 {
     dw.entity("LINE");
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbEntity");
         dw.dxfString(100, "AcDbLine");
     }
     dw.entityAttributes(attrib);
     dw.coord(DL_Codes.LINE_START_CODE, data.x1, data.y1, data.z1);
     dw.coord(DL_Codes.LINE_END_CODE, data.x2, data.y2, data.z2);
     dw.dxfInt(DL_Codes.COLOUR_CODE, data.color);
 }
Exemplo n.º 15
0
 public void writePoint(DL_Writer dw, DL_PointData data, DL_Attributes attrib)
 {
     dw.entity("POINT");
     if (_version == DL_Codes.VER_2000)
     {
         dw.dxfString(100, "AcDbEntity");
         dw.dxfString(100, "AcDbPoint");
     }
     dw.entityAttributes(attrib);
     dw.coord(DL_Codes.POINT_COORD_CODE, data.x, data.y, data.z);
 }