Skip to content

Commit

Permalink
[IMP]Fix Dxf handle conflict on export
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Oct 18, 2019
1 parent c4a2be3 commit 5512d54
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 43 deletions.
63 changes: 41 additions & 22 deletions src/Mod/Import/App/dxf.cpp
Expand Up @@ -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")
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Import/App/dxf.h
Expand Up @@ -145,13 +145,15 @@ class ImportExport CDxfWrite{
//! 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);
std::string getBlkRecordHandle(void);

std::string m_optionSource;
int m_version;
int m_handle;
int m_entityHandle;
int m_layerHandle;
int m_blockHandle;
Expand Down
18 changes: 17 additions & 1 deletion src/Mod/Import/DxfPlate/header14.rub
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/Mod/Import/DxfPlate/objects14.rub
Expand Up @@ -5,21 +5,21 @@ OBJECTS
0
DICTIONARY
5
500
F000
330
0
100
AcDbDictionary
3
ACAD_GROUP
350
501
F001
0
DICTIONARY
5
501
F001
330
500
F000
100
AcDbDictionary
0
Expand Down
32 changes: 16 additions & 16 deletions src/Mod/Import/DxfPlate/tables214.rub
Expand Up @@ -3,7 +3,7 @@ TABLE
2
STYLE
5
60
70
330
0
100
Expand All @@ -13,9 +13,9 @@ AcDbSymbolTable
0
STYLE
5
61
71
330
60
70
100
AcDbSymbolTableRecord
100
Expand All @@ -41,9 +41,9 @@ arial.ttf
0
STYLE
5
62
72
330
60
70
100
AcDbSymbolTableRecord
100
Expand Down Expand Up @@ -73,7 +73,7 @@ TABLE
2
VIEW
5
63
73
330
0
100
Expand All @@ -87,7 +87,7 @@ TABLE
2
UCS
5
64
74
330
0
100
Expand All @@ -101,7 +101,7 @@ TABLE
2
APPID
5
65
75
330
0
100
Expand All @@ -111,9 +111,9 @@ AcDbSymbolTable
0
APPID
5
66
76
330
65
75
100
AcDbSymbolTableRecord
100
Expand All @@ -125,9 +125,9 @@ ACAD
0
APPID
5
67
77
330
65
75
100
AcDbSymbolTableRecord
100
Expand All @@ -143,7 +143,7 @@ TABLE
2
DIMSTYLE
5
68
78
330
0
100
Expand All @@ -153,9 +153,9 @@ AcDbSymbolTable
0
DIMSTYLE
105
69
79
330
68
78
100
AcDbSymbolTableRecord
100
Expand Down Expand Up @@ -253,7 +253,7 @@ STANDARD
274
3
340
61
71
275
0
280
Expand Down

0 comments on commit 5512d54

Please sign in to comment.