From 218e11df7fdba328d8e147f7bec489c408ea9b8c Mon Sep 17 00:00:00 2001 From: wandererfan Date: Thu, 17 Oct 2019 11:35:14 -0400 Subject: [PATCH] [IMP]Fix Dxf handle conflict on export --- src/Mod/Import/App/dxf.cpp | 63 +++++++++++++++++---------- src/Mod/Import/App/dxf.h | 2 + src/Mod/Import/DxfPlate/header14.rub | 18 +++++++- src/Mod/Import/DxfPlate/objects14.rub | 8 ++-- src/Mod/Import/DxfPlate/tables214.rub | 32 +++++++------- 5 files changed, 80 insertions(+), 43 deletions(-) diff --git a/src/Mod/Import/App/dxf.cpp b/src/Mod/Import/App/dxf.cpp index c8ac9c12a3..abc8b09526 100644 --- a/src/Mod/Import/App/dxf.cpp +++ b/src/Mod/Import/App/dxf.cpp @@ -31,10 +31,16 @@ Base::Vector3d toVector3d(const double* a) CDxfWrite::CDxfWrite(const char* filepath) : //TODO: these should probably be parms in config file -m_entityHandle(0x300), -m_layerHandle(0x30), -m_blockHandle(0x210), -m_blkRecordHandle(0x110), +//handles: +//boilerplate 0 - A00 +//used by dxf.cpp A01 - FFFE +//ACAD HANDSEED FFFF + +m_handle(0xA00), //room for 2560 handles in boilerplate files +//m_entityHandle(0x300), //don't need special ranges for handles +//m_layerHandle(0x30), +//m_blockHandle(0x210), +//m_blkRecordHandle(0x110), m_polyOverride(false), m_layerName("none") { @@ -435,40 +441,53 @@ std::string CDxfWrite::getPlateFile(std::string fileSpec) return outString.str(); } -std::string CDxfWrite::getEntityHandle(void) +std::string CDxfWrite::getHandle(void) { - m_entityHandle++; + m_handle++; std::stringstream ss; ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); - ss << m_entityHandle; + ss << m_handle; return ss.str(); } +std::string CDxfWrite::getEntityHandle(void) +{ + return getHandle(); +// m_entityHandle++; +// std::stringstream ss; +// ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); +// ss << m_entityHandle; +// return ss.str(); +} + std::string CDxfWrite::getLayerHandle(void) { - m_layerHandle++; - std::stringstream ss; - ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); - ss << m_layerHandle; - return ss.str(); + return getHandle(); +// m_layerHandle++; +// std::stringstream ss; +// ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); +// ss << m_layerHandle; +// return ss.str(); } std::string CDxfWrite::getBlockHandle(void) { - m_blockHandle++; - std::stringstream ss; - ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); - ss << m_blockHandle; - return ss.str(); + return getHandle(); +// m_blockHandle++; +// std::stringstream ss; +// ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); +// ss << m_blockHandle; +// return ss.str(); } std::string CDxfWrite::getBlkRecordHandle(void) { - m_blkRecordHandle++; - std::stringstream ss; - ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); - ss << m_blkRecordHandle; - return ss.str(); + return getHandle(); +// m_blkRecordHandle++; +// std::stringstream ss; +// ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2); +// ss << m_blkRecordHandle; +// return ss.str(); } void CDxfWrite::addBlockName(std::string b, std::string h) diff --git a/src/Mod/Import/App/dxf.h b/src/Mod/Import/App/dxf.h index 505c99a7ab..5de6bb7700 100644 --- a/src/Mod/Import/App/dxf.h +++ b/src/Mod/Import/App/dxf.h @@ -145,6 +145,7 @@ protected: //! copy boiler plate file std::string getPlateFile(std::string fileSpec); void setDataDir(std::string s) { m_dataDir = s; } + std::string getHandle(void); std::string getEntityHandle(void); std::string getLayerHandle(void); std::string getBlockHandle(void); @@ -152,6 +153,7 @@ protected: std::string m_optionSource; int m_version; + int m_handle; int m_entityHandle; int m_layerHandle; int m_blockHandle; diff --git a/src/Mod/Import/DxfPlate/header14.rub b/src/Mod/Import/DxfPlate/header14.rub index 5253db1285..a6cf3fa447 100644 --- a/src/Mod/Import/DxfPlate/header14.rub +++ b/src/Mod/Import/DxfPlate/header14.rub @@ -31,8 +31,24 @@ $CMLSTYLE 2 STANDARD 9 +$PEXTMAX + 10 +50 + 20 +50 + 30 +50 + 9 +$PEXTMIN + 10 +0 + 20 +0 + 30 +0 + 9 $HANDSEED 5 -FFF +FFFF 0 ENDSEC diff --git a/src/Mod/Import/DxfPlate/objects14.rub b/src/Mod/Import/DxfPlate/objects14.rub index 8313b799b7..e8e2adb95b 100644 --- a/src/Mod/Import/DxfPlate/objects14.rub +++ b/src/Mod/Import/DxfPlate/objects14.rub @@ -5,7 +5,7 @@ OBJECTS 0 DICTIONARY 5 -500 +F000 330 0 100 @@ -13,13 +13,13 @@ AcDbDictionary 3 ACAD_GROUP 350 -501 +F001 0 DICTIONARY 5 -501 +F001 330 -500 +F000 100 AcDbDictionary 0 diff --git a/src/Mod/Import/DxfPlate/tables214.rub b/src/Mod/Import/DxfPlate/tables214.rub index a3b91cb934..040b26821e 100644 --- a/src/Mod/Import/DxfPlate/tables214.rub +++ b/src/Mod/Import/DxfPlate/tables214.rub @@ -3,7 +3,7 @@ TABLE 2 STYLE 5 -60 +70 330 0 100 @@ -13,9 +13,9 @@ AcDbSymbolTable 0 STYLE 5 -61 +71 330 -60 +70 100 AcDbSymbolTableRecord 100 @@ -41,9 +41,9 @@ arial.ttf 0 STYLE 5 -62 +72 330 -60 +70 100 AcDbSymbolTableRecord 100 @@ -73,7 +73,7 @@ TABLE 2 VIEW 5 -63 +73 330 0 100 @@ -87,7 +87,7 @@ TABLE 2 UCS 5 -64 +74 330 0 100 @@ -101,7 +101,7 @@ TABLE 2 APPID 5 -65 +75 330 0 100 @@ -111,9 +111,9 @@ AcDbSymbolTable 0 APPID 5 -66 +76 330 -65 +75 100 AcDbSymbolTableRecord 100 @@ -125,9 +125,9 @@ ACAD 0 APPID 5 -67 +77 330 -65 +75 100 AcDbSymbolTableRecord 100 @@ -143,7 +143,7 @@ TABLE 2 DIMSTYLE 5 -68 +78 330 0 100 @@ -153,9 +153,9 @@ AcDbSymbolTable 0 DIMSTYLE 105 -69 +79 330 -68 +78 100 AcDbSymbolTableRecord 100 @@ -253,7 +253,7 @@ STANDARD 274 3 340 -61 +71 275 0 280