28 #include "dl_global.h"
37 #include "dl_attributes.h"
39 #include "dl_entities.h"
40 #include "dl_writer_ascii.h"
44 #define M_PI 3.14159265358979323846
45 #pragma warning(disable : 4800)
49 #define M_PI 3.1415926535897932384626433832795
53 #define DL_NANDOUBLE std::numeric_limits<double>::quiet_NaN()
60 #define DL_VERSION "3.12.2.0"
62 #define DL_VERSION_MAJOR 3
63 #define DL_VERSION_MINOR 12
64 #define DL_VERSION_REV 2
65 #define DL_VERSION_BUILD 0
71 #define DL_LINETYPE 13
74 #define DL_ENTITY_POINT 100
75 #define DL_ENTITY_LINE 101
76 #define DL_ENTITY_POLYLINE 102
77 #define DL_ENTITY_LWPOLYLINE 103
78 #define DL_ENTITY_VERTEX 104
79 #define DL_ENTITY_SPLINE 105
80 #define DL_ENTITY_KNOT 106
81 #define DL_ENTITY_CONTROLPOINT 107
82 #define DL_ENTITY_ARC 108
83 #define DL_ENTITY_CIRCLE 109
84 #define DL_ENTITY_ELLIPSE 110
85 #define DL_ENTITY_INSERT 111
86 #define DL_ENTITY_TEXT 112
87 #define DL_ENTITY_MTEXT 113
88 #define DL_ENTITY_DIMENSION 114
89 #define DL_ENTITY_LEADER 115
90 #define DL_ENTITY_HATCH 116
91 #define DL_ENTITY_ATTRIB 117
92 #define DL_ENTITY_IMAGE 118
93 #define DL_ENTITY_IMAGEDEF 119
94 #define DL_ENTITY_TRACE 120
95 #define DL_ENTITY_SOLID 121
96 #define DL_ENTITY_3DFACE 122
97 #define DL_ENTITY_XLINE 123
98 #define DL_ENTITY_RAY 124
99 #define DL_ENTITY_SEQEND 125
100 #define DL_XRECORD 200
101 #define DL_DICTIONARY 210
126 bool in(
const std::string& file,
128 bool readDxfGroups(FILE* fp,
130 static bool getStrippedLine(std::string& s,
unsigned int size,
131 FILE* stream,
bool stripSpace =
true);
133 bool readDxfGroups(std::stringstream& stream,
135 bool in(std::stringstream &stream,
137 static bool getStrippedLine(std::string& s,
unsigned int size,
138 std::stringstream& stream,
bool stripSpace =
true);
140 static bool stripWhiteSpace(
char** s,
bool stripSpaces =
true);
143 int groupCode,
const std::string& groupValue);
329 void writeImageDef(
DL_WriterA& dw,
int handle,
339 void writeAppid(
DL_WriterA& dw,
const std::string& name);
343 void writeEndBlock(
DL_WriterA& dw,
const std::string& name);
350 double dimasz,
double dimexe,
double dimexo,
351 double dimgap,
double dimtxt);
353 void writeBlockRecord(
DL_WriterA& dw,
const std::string& name);
354 void writeObjects(
DL_WriterA& dw,
const std::string& appDictionaryName =
"");
356 int writeDictionaryEntry(
DL_WriterA& dw,
const std::string& name);
357 void writeXRecord(
DL_WriterA& dw,
int handle,
int value);
358 void writeXRecord(
DL_WriterA& dw,
int handle,
double value);
359 void writeXRecord(
DL_WriterA& dw,
int handle,
bool value);
360 void writeXRecord(
DL_WriterA& dw,
int handle,
const std::string& value);
363 void writeComment(
DL_WriterA& dw,
const std::string& comment);
401 int getLibVersion(
const std::string &str);
405 bool hasValue(
int code) {
406 return values.count(code)==1;
409 int getIntValue(
int code,
int def) {
410 if (!hasValue(code)) {
413 return toInt(values[code]);
416 int toInt(
const std::string& str) {
418 return strtol(str.c_str(), &p, 10);
421 bool toBool(
const std::string& str) {
423 return (
bool)strtol(str.c_str(), &p, 10);
426 std::string getStringValue(
int code,
const std::string& def) {
427 if (!hasValue(code)) {
433 double getRealValue(
int code,
double def) {
434 if (!hasValue(code)) {
437 return toReal(values[code]);
440 double toReal(
const std::string& str) {
443 std::string str2 = str;
444 std::replace(str2.begin(), str2.end(),
',',
'.');
446 std::istringstream istr(str2);
447 istr.imbue(std::locale(
"C"));
455 std::string polylineLayer;
467 double* controlPoints;
468 int maxControlPoints;
469 int controlPointIndex;
475 double* leaderVertices;
476 int maxLeaderVertices;
477 int leaderVertexIndex;
481 std::vector<std::vector<DL_HatchEdgeData> > hatchEdges;
483 std::string xRecordHandle;
487 std::string groupCodeTmp;
489 unsigned int groupCode;
491 std::string groupValue;
493 int currentObjectType;
495 char settingValue[DL_DXF_MAXLINE+1];
497 std::string settingKey;
499 std::map<int, std::string> values;
508 unsigned long appDictionaryHandle;
510 unsigned long styleHandleStd;
Implements functions defined in DL_Writer for writing low level DXF constructs to an ASCII format DXF...
Definition: dl_writer_ascii.h:49
Spline fit point data.
Definition: dl_entities.h:597
Line Data.
Definition: dl_entities.h:220
Hatch data.
Definition: dl_entities.h:1380
Vertex Data.
Definition: dl_entities.h:411
Polyline Data.
Definition: dl_entities.h:381
Radial Dimension Data.
Definition: dl_entities.h:1099
Circle Data.
Definition: dl_entities.h:351
Ellipse Data.
Definition: dl_entities.h:617
Leader (arrow).
Definition: dl_entities.h:1309
Text style data.
Definition: dl_entities.h:129
Reading and writing of DXF files.
Definition: dl_dxf.h:121
Hatch boundary path (loop) data.
Definition: dl_entities.h:1427
Leader Vertex Data.
Definition: dl_entities.h:1356
Spline Data.
Definition: dl_entities.h:506
Angular Dimension Data (3 points version).
Definition: dl_entities.h:1217
MText Data.
Definition: dl_entities.h:714
Line Type Data.
Definition: dl_entities.h:89
Arc Data.
Definition: dl_entities.h:314
Linear (rotated) Dimension Data.
Definition: dl_entities.h:1053
Text Data.
Definition: dl_entities.h:795
Image Data.
Definition: dl_entities.h:1619
Block Data.
Definition: dl_entities.h:58
Generic Dimension Data.
Definition: dl_entities.h:906
Storing and passing around attributes.
Definition: dl_attributes.h:41
Spline knot data.
Definition: dl_entities.h:551
Abstract class (interface) for the creation of new entities.
Definition: dl_creationinterface.h:47
Point Data.
Definition: dl_entities.h:196
Ordinate Dimension Data.
Definition: dl_entities.h:1266
Block attribute data.
Definition: dl_entities.h:866
Spline control point data.
Definition: dl_entities.h:570
Hatch edge data.
Definition: dl_entities.h:1449
Angular Dimension Data.
Definition: dl_entities.h:1157
Aligned Dimension Data.
Definition: dl_entities.h:1016
Layer Data.
Definition: dl_entities.h:36
Ray Data.
Definition: dl_entities.h:283
Insert Data.
Definition: dl_entities.h:664
version
Version numbers for the DXF Format.
Definition: dl_codes.h:96
XLine Data.
Definition: dl_entities.h:254
Trace Data / solid data / 3d face data.
Definition: dl_entities.h:439
Diametric Dimension Data.
Definition: dl_entities.h:1128