double dashes[2] = { 2.5, -0.5 };
double dashdot[2] = { 5.0, -0.5 };
dw->tableLinetypes(5);
dxf.writeLinetype(*dw, DL_LinetypeData("BYBLOCK", "BYBLOCK", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYLAYER", "BYLAYER", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("CONTINUOUS", "Filled", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("DASHED", "Dashed", 0, 10, 5, dashes));
dxf.writeLinetype(*dw, DL_LinetypeData("DASHDOT", "Dashdot", 0, 10, 5, dashdot));
dw->tableEnd();
int numberOfLayers = 3;
dw->tableLayers(numberOfLayers);
dxf.writeLayer(*dw,
DL_LayerData("0", 0),
DL_Attributes(
std::string(""), // leave empty
DL_Codes::black, // default color
100, // default width
"CONTINUOUS", 1.0)); // default line style
dxf.writeLayer(*dw,
DL_LayerData("d", 0),
DL_Attributes(
std::string(""), // leave empty
DL_Codes::red, // default color
100, // default width
"DASHED", 1.0)); // default line style
dxf.writeLayer(*dw,
DL_LayerData("dd", 0),
DL_Attributes(
std::string(""), // leave empty
DL_Codes::blue, // default color
100, // default width
"DASHDOT", 1.0)); // default line style
dw->tableEnd();
dw->tableStyle(1);
dxf.writeStyle(*dw, DL_StyleData("standard", 0, 2.5, 1.0, 0.0, 0, 2.5, "txt", ""));
dw->tableEnd();
dxf.writeView(*dw);
dxf.writeUcs(*dw);
dw->tableAppid(1);
dxf.writeAppid(*dw, "ACAD");
dw->tableEnd();
dxf.writeDimStyle(*dw, 1, 1, 1, 1, 1);
//FOR
//minden egyenesre egy blokk
dxf.writeBlockRecord(*dw);
dxf.writeBlockRecord(*dw, "myblock1");
dw->tableEnd();
dw->sectionEnd();
dw->sectionBlocks();
dxf.writeBlock(*dw, DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Model_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space0");
dxf.writeBlock(*dw, DL_BlockData("myblock1", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "myblock1");
dw->sectionEnd();
dw->sectionEntities();
// write all entities in model space:
for (int i = 0; i < line_endpoints.size(); i++) {
if (lineT[i] == 111) {
dxf.writeLine(
*dw,
DL_LineData(line_endpoints[i][0], // start point
line_endpoints[i][1],
0.0,
line_endpoints[i][2], // end point
line_endpoints[i][3],
0.0),
DL_Attributes("0", 256, -1, "BYLAYER", 1.0));
}
else if (lineT[i] == 222) {
dxf.writeLine(
*dw,
DL_LineData(line_endpoints[i][0], // start point
line_endpoints[i][1],
0.0,
line_endpoints[i][2], // end point
line_endpoints[i][3],
0.0),
DL_Attributes("d", 256, -1, "BYLAYER", 1.0));
}
else {
dxf.writeLine(
*dw,
DL_LineData(line_endpoints[i][0], // start point
line_endpoints[i][1],
0.0,
line_endpoints[i][2], // end point
line_endpoints[i][3],
0.0),
DL_Attributes("dd", 256, -1, "BYLAYER", 1.0));
}
}
dw->sectionEnd();
So I would like to have 3 layers here, ‘0’, ‘d’ and ‘dd’. 0 layer contains continuous lines, d layer contains dashed lines and dd layer the dashdot lines.
But for some reason this prints out all the lines in continuous.