1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
#include "dl_dxf.h"
int main() {
DL_Dxf dxf;
DL_WriterA* dw = dxf.out("dimension.dxf", DL_Codes::AC1015);
// section header:
dxf.writeHeader(*dw);
dw->sectionEnd();
// section tables:
dw->sectionTables();
// VPORT:
dxf.writeVPort(*dw);
// LTYPE:
dw->tableLinetypes(1);
dxf.writeLinetype(*dw, DL_LinetypeData("CONTINUOUS", "Continuous", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYLAYER", "", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYBLOCK", "", 0, 0, 0.0));
dw->tableEnd();
// LAYER:
dw->tableLayers(1);
dxf.writeLayer(
*dw,
DL_LayerData("0", 0),
DL_Attributes("", 1, 0x00ff0000, 15, "CONTINUOUS")
);
dw->tableEnd();
// STYLE:
dw->tableStyle(1);
DL_StyleData style("Standard", 0, 0.0, 1.0, 0.0, 0, 2.5, "txt", "");
style.bold = false;
style.italic = false;
dxf.writeStyle(*dw, style);
dw->tableEnd();
// VIEW:
dxf.writeView(*dw);
// UCS:
dxf.writeUcs(*dw);
// APPID:
dw->tableAppid(1);
dxf.writeAppid(*dw, "ACAD");
dw->tableEnd();
// DIMSTYLE:
dxf.writeDimStyle(*dw, 2.5, 0.625, 0.625, 0.625, 2.5);
// BLOCK_RECORD:
dxf.writeBlockRecord(*dw);
dw->tableEnd();
dw->sectionEnd();
// BLOCK:
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");
dw->sectionEnd();
// ENTITIES:
dw->sectionEntities();
DL_Attributes attributes("0", 256, -1, -1, "BYLAYER");
// LINE:
DL_LineData lineData(10, 5, 0, 30, 5, 0);
dxf.writeLine(*dw, lineData, attributes);
// DIMENSION:
DL_DimensionData dimData(10.0, // def point (dimension line pos)
50.0,
0.0,
0, // text pos (irrelevant if flag 0x80 (128) set for type
0,
0.0,
0x1, // type: aligned with auto text pos (0x80 NOT set)
8, // attachment point: bottom center
2, // line spacing: exact
1.0, // line spacing factor
"", // text
"Standard", // style
0.0, // text angle
1.0, // linear factor
1.0); // dim scale
DL_DimAlignedData dimAlignedData(10.0, // extension point 1
5.0,
0.0,
30.0, // extension point 2
5.0,
0.0);
dxf.writeDimAligned(*dw, dimData, dimAlignedData, attributes);
// end section ENTITIES:
dw->sectionEnd();
dxf.writeObjects(*dw, "MY_OBJECTS");
dxf.writeObjectsEnd(*dw);
dw->dxfEOF();
dw->close();
delete dw;
return 0;
}
|