35#if __cplusplus >= 201103L
36#include <unordered_map>
48#define M_PI 3.14159265358979323846
49#pragma warning(disable : 4800)
53#define M_PI 3.1415926535897932384626433832795
57#define DL_NANDOUBLE std::numeric_limits<double>::quiet_NaN()
64#define DL_VERSION "3.26.4.0"
66#define DL_VERSION_MAJOR 3
67#define DL_VERSION_MINOR 26
68#define DL_VERSION_REV 4
69#define DL_VERSION_BUILD 0
78#define DL_ENTITY_POINT 100
79#define DL_ENTITY_LINE 101
80#define DL_ENTITY_POLYLINE 102
81#define DL_ENTITY_LWPOLYLINE 103
82#define DL_ENTITY_VERTEX 104
83#define DL_ENTITY_SPLINE 105
84#define DL_ENTITY_KNOT 106
85#define DL_ENTITY_CONTROLPOINT 107
86#define DL_ENTITY_ARC 108
87#define DL_ENTITY_CIRCLE 109
88#define DL_ENTITY_ELLIPSE 110
89#define DL_ENTITY_INSERT 111
90#define DL_ENTITY_TEXT 112
91#define DL_ENTITY_MTEXT 113
92#define DL_ENTITY_DIMENSION 114
93#define DL_ENTITY_LEADER 115
94#define DL_ENTITY_HATCH 116
95#define DL_ENTITY_ATTRIB 117
96#define DL_ENTITY_IMAGE 118
97#define DL_ENTITY_IMAGEDEF 119
98#define DL_ENTITY_TRACE 120
99#define DL_ENTITY_SOLID 121
100#define DL_ENTITY_3DFACE 122
101#define DL_ENTITY_XLINE 123
102#define DL_ENTITY_RAY 124
103#define DL_ENTITY_ARCALIGNEDTEXT 125
104#define DL_ENTITY_SEQEND 126
105#define DL_XRECORD 200
106#define DL_DICTIONARY 210
131 bool in(
const std::string& file,
133 bool readDxfGroups(FILE* fp,
135 static bool getStrippedLine(std::string&
s, FILE* stream,
136 bool stripSpace =
true);
138 bool readDxfGroups(std::istream& stream,
140 bool in(std::istream &stream,
142 static bool getStrippedLine(std::string&
s,
unsigned int size,
143 std::istream& stream,
bool stripSpace =
true);
145 static bool stripWhiteSpace(
char**
s,
bool stripSpaces =
true);
148 int groupCode,
const std::string& groupValue);
337 void writeImageDef(
DL_WriterA& dw,
int handle,
347 void writeAppid(
DL_WriterA& dw,
const std::string& name);
351 void writeEndBlock(
DL_WriterA& dw,
const std::string& name);
358 double dimasz,
double dimexe,
double dimexo,
359 double dimgap,
double dimtxt,
360 int dimtad = 1,
bool dimtih =
false);
362 void writeBlockRecord(
DL_WriterA& dw,
const std::string& name);
363 void writeObjects(
DL_WriterA& dw,
const std::string& appDictionaryName =
"");
365 unsigned long writeDictionaryEntry(
DL_WriterA& dw,
const std::string& name);
366 void writeXRecord(
DL_WriterA& dw,
int handle,
int value);
367 void writeXRecord(
DL_WriterA& dw,
int handle,
double value);
368 void writeXRecord(
DL_WriterA& dw,
int handle,
bool value);
369 void writeXRecord(
DL_WriterA& dw,
int handle,
const std::string& value);
372 void writeComment(
DL_WriterA& dw,
const std::string& comment);
410 int getLibVersion(
const std::string &str);
415 return values.count(
code)==1;
419 if (!hasValue(
code)) {
422 return toInt(values[
code]);
427 return strtol(str.c_str(), &p, 10);
431 if (!hasValue(
code)) {
434 return toInt16(values[
code]);
439 return strtol(str.c_str(), &p, 16);
444 return (
bool)strtol(str.c_str(), &p, 10);
448 if (!hasValue(
code)) {
455 if (!hasValue(
code)) {
458 return toReal(values[
code]);
464 std::string str2 = str;
465 std::replace(str2.begin(), str2.end(),
',',
'.');
466 return ::atof(str2.c_str());
518#if __cplusplus >= 201103L
519 std::unordered_map<int, std::string> values;
void version()
Prints version information.
Definition autostart.js:59
Storing and passing around attributes.
Definition dl_attributes.h:41
version
Version numbers for the DXF Format.
Definition dl_codes.h:96
Abstract class (interface) for the creation of new entities.
Definition dl_creationinterface.h:47
Reading and writing of DXF files.
Definition dl_dxf.h:126
double toReal(const std::string &str)
Definition dl_dxf.h:461
std::map< int, std::string > values
Definition dl_dxf.h:521
std::string xRecordHandle
Definition dl_dxf.h:500
int maxVertices
Definition dl_dxf.h:474
int controlPointIndex
Definition dl_dxf.h:486
int libVersion
Definition dl_dxf.h:529
double * fitPoints
Definition dl_dxf.h:488
int knotIndex
Definition dl_dxf.h:479
bool xRecordValues
Definition dl_dxf.h:501
std::string polylineLayer
Definition dl_dxf.h:472
double * leaderVertices
Definition dl_dxf.h:492
DL_Codes::version getVersion()
Definition dl_dxf.h:406
unsigned int groupCode
Definition dl_dxf.h:506
unsigned long styleHandleStd
Definition dl_dxf.h:533
unsigned long appDictionaryHandle
Definition dl_dxf.h:531
int toInt(const std::string &str)
Definition dl_dxf.h:425
int weightIndex
Definition dl_dxf.h:482
int getInt16Value(int code, int def)
Definition dl_dxf.h:430
int vertexIndex
Definition dl_dxf.h:475
int maxLeaderVertices
Definition dl_dxf.h:493
int currentObjectType
Definition dl_dxf.h:510
DL_Attributes attrib
Definition dl_dxf.h:527
int fitPointIndex
Definition dl_dxf.h:490
std::string groupCodeTmp
Definition dl_dxf.h:504
int maxFitPoints
Definition dl_dxf.h:489
double * weights
Definition dl_dxf.h:481
int leaderVertexIndex
Definition dl_dxf.h:494
int toInt16(const std::string &str)
Definition dl_dxf.h:437
bool hasValue(int code)
Definition dl_dxf.h:414
int getIntValue(int code, int def)
Definition dl_dxf.h:418
double getRealValue(int code, double def)
Definition dl_dxf.h:454
std::vector< std::vector< DL_HatchEdgeData > > hatchEdges
Definition dl_dxf.h:498
int maxControlPoints
Definition dl_dxf.h:485
std::string settingKey
Definition dl_dxf.h:514
DL_Codes::version version
Definition dl_dxf.h:470
double * knots
Definition dl_dxf.h:477
bool firstCall
Definition dl_dxf.h:525
double * controlPoints
Definition dl_dxf.h:484
bool toBool(const std::string &str)
Definition dl_dxf.h:442
DL_HatchEdgeData hatchEdge
Definition dl_dxf.h:497
bool firstHatchLoop
Definition dl_dxf.h:496
std::string groupValue
Definition dl_dxf.h:508
double * vertices
Definition dl_dxf.h:473
int maxKnots
Definition dl_dxf.h:478
std::string getStringValue(int code, const std::string &def)
Definition dl_dxf.h:447
Implements functions defined in DL_Writer for writing low level DXF constructs to an ASCII format DXF...
Definition dl_writer_ascii.h:49
#define DL_DXF_MAXLINE
Definition dl_codes.h:58
#define DL_VERSION_2000
Definition dl_codes.h:378
#define DXFLIB_EXPORT
Definition dl_global.h:12
void addSpline(void points, void closed)
Adds a spline to the drawing.
Definition simple_create.js:15
void addPolyline(void points, void closed, void relative)
Adds a polyline to the drawing.
Definition simple_create.js:79
void addArc(void center, void radius, void startAngle, void endAngle, void reversed)
Adds an arc to the drawing.
Definition simple_create.js:109
void addXLine(void startPoint, void directionVector)
Adds an infinite line to the drawing.
Definition simple_create.js:164
void addCircle(void center, void radius)
Adds a circle to the drawing.
Definition simple_create.js:150
void addPoint(void position)
Adds a point to the drawing.
Definition simple_create.js:210
void addLayer(void name, void colorName, void linetypeName, void lineWeight)
Adds a layer to the drawing.
Definition simple_create.js:138
void addLine(void startPoint, void endPoint)
Adds a line to the drawing.
Definition simple_create.js:198
char s
Definition opennurbs_string.cpp:32
Arc Data.
Definition dl_entities.h:315
Block attribute data.
Definition dl_entities.h:950
Block Data.
Definition dl_entities.h:59
Circle Data.
Definition dl_entities.h:352
Spline control point data.
Definition dl_entities.h:575
Aligned Dimension Data.
Definition dl_entities.h:1102
Angular Dimension Data.
Definition dl_entities.h:1243
Angular Dimension Data (3 points version).
Definition dl_entities.h:1303
Diametric Dimension Data.
Definition dl_entities.h:1214
Linear (rotated) Dimension Data.
Definition dl_entities.h:1139
Ordinate Dimension Data.
Definition dl_entities.h:1352
Radial Dimension Data.
Definition dl_entities.h:1185
Generic Dimension Data.
Definition dl_entities.h:990
Ellipse Data.
Definition dl_entities.h:622
Spline fit point data.
Definition dl_entities.h:602
Hatch data.
Definition dl_entities.h:1470
Hatch edge data.
Definition dl_entities.h:1539
Hatch boundary path (loop) data.
Definition dl_entities.h:1517
Image Data.
Definition dl_entities.h:1709
Insert Data.
Definition dl_entities.h:669
Spline knot data.
Definition dl_entities.h:556
Layer Data.
Definition dl_entities.h:36
Leader (arrow).
Definition dl_entities.h:1395
Leader Vertex Data.
Definition dl_entities.h:1446
Line Data.
Definition dl_entities.h:221
Line Type Data.
Definition dl_entities.h:90
MText Data.
Definition dl_entities.h:719
Point Data.
Definition dl_entities.h:197
Polyline Data.
Definition dl_entities.h:382
Ray Data.
Definition dl_entities.h:284
Spline Data.
Definition dl_entities.h:511
Text style data.
Definition dl_entities.h:130
Text Data.
Definition dl_entities.h:800
Trace Data / solid data / 3d face data.
Definition dl_entities.h:444
Vertex Data.
Definition dl_entities.h:416
XLine Data.
Definition dl_entities.h:255