29 #include "dl_global.h" 37 #endif // _MSC_VER > 1000 42 #include "dl_attributes.h" 63 this->version = version;
66 paperSpace0Handle = 0;
82 dxfString(0,
"SECTION");
179 dxfString(0,
"ENDSEC");
194 void table(
const char* name,
int num,
int h=0)
const {
195 dxfString(0,
"TABLE");
197 if (
version>=DL_VERSION_2000) {
204 dxfString(100,
"AcDbSymbolTable");
223 table(
"LAYER", num, 2);
241 table(
"LTYPE", num, 5);
258 table(
"APPID", num, 9);
275 table(
"STYLE", num, 3);
287 dxfString(0,
"ENDTAB");
311 dxfString(999, text);
324 void entity(
const char* entTypeName)
const {
325 dxfString(0, entTypeName);
326 if (
version>=DL_VERSION_2000) {
358 if (
version>=DL_VERSION_2000) {
361 if (
version>=DL_VERSION_2000) {
362 dxfReal(48, attrib.getLinetypeScale());
365 std::transform(linetype.begin(), linetype.end(), linetype.begin(), ::toupper);
366 if (
version>=DL_VERSION_2000 || linetype==
"BYLAYER") {
387 dxfString(0,
"LAYER");
388 if (
version>=DL_VERSION_2000) {
394 dxfString(100,
"AcDbSymbolTableRecord");
395 dxfString(100,
"AcDbLayerTableRecord");
408 dxfString(0,
"LTYPE");
409 if (
version>=DL_VERSION_2000) {
416 dxfString(100,
"AcDbSymbolTableRecord");
417 dxfString(100,
"AcDbLinetypeTableRecord");
430 dxfString(0,
"APPID");
431 if (
version>=DL_VERSION_2000) {
438 dxfString(100,
"AcDbSymbolTableRecord");
439 dxfString(100,
"AcDbRegAppTableRecord");
452 dxfString(0,
"BLOCK");
453 if (
version>=DL_VERSION_2000) {
460 dxfString(100,
"AcDbEntity");
465 dxfString(100,
"AcDbBlockBegin");
478 dxfString(0,
"ENDBLK");
479 if (
version>=DL_VERSION_2000) {
486 dxfString(100,
"AcDbEntity");
491 dxfString(100,
"AcDbBlockEnd");
495 void color(
int col=256)
const {
498 void linetype(
const char *lt)
const {
501 void linetypeScale(
double scale)
const {
504 void lineWeight(
int lw)
const {
508 void coord(
int gc,
double x,
double y,
double z=0)
const {
514 void coordTriplet(
int gc,
const double* value)
const {
516 dxfReal(gc, *value++);
517 dxfReal(gc+10, *value++);
518 dxfReal(gc+20, *value++);
522 void resetHandle()
const {
531 dxfHex(gc, m_handle);
554 modelSpaceHandle = h;
557 unsigned long getModelSpaceHandle() {
558 return modelSpaceHandle;
566 paperSpaceHandle = h;
569 unsigned long getPaperSpaceHandle() {
570 return paperSpaceHandle;
578 paperSpace0Handle = h;
581 unsigned long getPaperSpace0Handle() {
582 return paperSpace0Handle;
592 virtual void dxfReal(
int gc,
double value)
const = 0;
601 virtual void dxfInt(
int gc,
int value)
const = 0;
610 virtual void dxfBool(
int gc,
bool value)
const {
611 dxfInt(gc, (
int)value);
621 virtual void dxfHex(
int gc,
int value)
const = 0;
630 virtual void dxfString(
int gc,
const char* value)
const = 0;
639 virtual void dxfString(
int gc,
const std::string& value)
const = 0;
642 mutable unsigned long m_handle;
643 mutable unsigned long modelSpaceHandle;
644 mutable unsigned long paperSpaceHandle;
645 mutable unsigned long paperSpace0Handle;
void sectionBlocks() const
Section BLOCKS.
Definition: dl_writer.h:124
void entity(const char *entTypeName) const
Entity.
Definition: dl_writer.h:324
void setPaperSpaceHandle(unsigned long h)
Sets the handle of the paper space.
Definition: dl_writer.h:565
void subClass(const char *sub) const
Subclass.
Definition: dl_writer.h:374
void table(const char *name, int num, int h=0) const
Generic table for table 'name' with 'num' entries:
Definition: dl_writer.h:194
Storing and passing around attributes.
Definition: dl_attributes.h:41
void section(const char *name) const
Generic section for section 'name'.
Definition: dl_writer.h:81
std::string getLinetype() const
Definition: dl_attributes.h:198
void tableAppidEntry(unsigned long int h=0) const
Appid (must be in the TABLES section APPID).
Definition: dl_writer.h:429
void setModelSpaceHandle(unsigned long h)
Sets the handle of the model space.
Definition: dl_writer.h:553
void tableLinetypes(int num) const
Table for line types.
Definition: dl_writer.h:239
unsigned long handle(int gc=5) const
Writes a unique handle and returns it.
Definition: dl_writer.h:529
int getColor() const
Definition: dl_attributes.h:149
void tableAppid(int num) const
Table for application id.
Definition: dl_writer.h:257
DL_Writer(DL_Codes::version version)
Definition: dl_writer.h:62
void entityAttributes(const DL_Attributes &attrib) const
Attributes of an entity.
Definition: dl_writer.h:345
unsigned long getNextHandle() const
Definition: dl_writer.h:538
void sectionBlockEntryEnd(unsigned long int h=0) const
End of Block (must be in the section BLOCKS).
Definition: dl_writer.h:477
version
Version numbers for the DXF Format.
Definition: dl_codes.h:96
void sectionObjects() const
Section OBJECTS.
Definition: dl_writer.h:166
void dxfEOF() const
End of the DXF file.
Definition: dl_writer.h:298
void sectionClasses() const
Section CLASSES.
Definition: dl_writer.h:152
void comment(const char *text) const
Comment.
Definition: dl_writer.h:310
void sectionEnd() const
End of a section.
Definition: dl_writer.h:178
unsigned long incHandle() const
Increases handle, so that the handle returned remains available.
Definition: dl_writer.h:545
virtual void dxfBool(int gc, bool value) const
Can be overwritten by the implementing class to write a bool value to the file.
Definition: dl_writer.h:610
void tableLayers(int num) const
Table for layers.
Definition: dl_writer.h:222
Defines interface for writing low level DXF constructs to a file.
Definition: dl_writer.h:57
void tableStyle(int num) const
Table for text style.
Definition: dl_writer.h:274
std::string getLayer() const
Definition: dl_attributes.h:122
void tableEnd() const
End of a table.
Definition: dl_writer.h:286
int getColor24() const
Definition: dl_attributes.h:158
void sectionEntities() const
Section ENTITIES.
Definition: dl_writer.h:138
DL_Codes::version version
DXF version to be created.
Definition: dl_writer.h:650
void sectionHeader() const
Section HEADER.
Definition: dl_writer.h:96
void sectionBlockEntry(unsigned long int h=0) const
Block (must be in the section BLOCKS).
Definition: dl_writer.h:451
void tableLinetypeEntry(unsigned long int h=0) const
Line type (must be in the TABLES section LTYPE).
Definition: dl_writer.h:407
int getWidth() const
Definition: dl_attributes.h:172
void sectionTables() const
Section TABLES.
Definition: dl_writer.h:110
void tableLayerEntry(unsigned long int h=0) const
Layer (must be in the TABLES section LAYER).
Definition: dl_writer.h:386
void setPaperSpace0Handle(unsigned long h)
Sets the handle of the paper space 0.
Definition: dl_writer.h:577