Exemple #1
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);
            }
        }
Exemple #2
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);
            }
        }