Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
c7e7014b
Commit
c7e7014b
authored
Feb 14, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module flip reverting on exception
parent
cb138403
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
12 deletions
+48
-12
specctra.h
pcbnew/specctra.h
+14
-2
specctra_export.cpp
pcbnew/specctra_export.cpp
+34
-10
No files found.
pcbnew/specctra.h
View file @
c7e7014b
...
...
@@ -3578,6 +3578,8 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
std
::
string
quote_char
;
bool
modulesAreFlipped
;
STRINGFORMATTER
sf
;
STRINGS
layerIds
;
///< indexed by PCB layer number
...
...
@@ -3822,6 +3824,11 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
nets
.
clear
();
}
/**
* Function flipMODULEs
* flips the modules which are on the back side of the board to the front.
*/
void
flipMODULEs
(
BOARD
*
aBoard
);
//-----<FromSESSION>-----------------------------------------------------
...
...
@@ -3850,6 +3857,7 @@ public:
session
=
0
;
fp
=
0
;
quote_char
+=
'"'
;
modulesAreFlipped
=
false
;
}
virtual
~
SPECCTRA_DB
()
...
...
@@ -3957,7 +3965,6 @@ public:
*/
void
FromBOARD
(
BOARD
*
aBoard
)
throw
(
IOError
);
/**
* Function FromSESSION
* adds the entire SESSION info to a BOARD but does not write it out. The
...
...
@@ -3968,7 +3975,6 @@ public:
*/
void
FromSESSION
(
BOARD
*
aBoard
)
throw
(
IOError
);
/**
* Function ExportSESSION
* writes the internal SESSION instance out as a SPECTRA DSN format file.
...
...
@@ -3976,6 +3982,12 @@ public:
* @param aFilename The file to save to.
*/
void
ExportSESSION
(
wxString
aFilename
);
/**
* Function RevertMODULEs
* flips the modules which were on the back side of the board back to the back.
*/
void
RevertMODULEs
(
BOARD
*
aBoard
);
};
...
...
pcbnew/specctra_export.cpp
View file @
c7e7014b
...
...
@@ -97,6 +97,11 @@ void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event )
setlocale
(
LC_NUMERIC
,
""
);
// revert to the current locale
// this is called in FromBOARD() too, but if it throws an exception, that call
// does not happen, so call it again just in case here.
db
.
RevertMODULEs
(
m_Pcb
);
// The two calls below to BOARD::Change_Side_Module(), both set the
// modified flag, yet their actions cancel each other out, so it should
// be ok to clear the modify flag.
...
...
@@ -727,15 +732,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
// DSN Images (=Kicad MODULES and pads) must be presented from the
// top view. So we temporarily flip any modules which are on the back
// side of the board to the front, and record this in the MODULE's flag field.
for
(
MODULE
*
module
=
aBoard
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
module
->
flag
=
0
;
if
(
module
->
GetLayer
()
==
COPPER_LAYER_N
)
{
aBoard
->
Change_Side_Module
(
module
,
NULL
);
module
->
flag
=
1
;
}
}
flipMODULEs
(
aBoard
);
//-----<layer_descriptor>-----------------------------------------------
{
...
...
@@ -1220,7 +1217,32 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
}
//-----<restore MODULEs>------------------------------------------------
//-----<flip modules back>----------------------------------------------
RevertMODULEs
(
aBoard
);
}
void
SPECCTRA_DB
::
flipMODULEs
(
BOARD
*
aBoard
)
{
for
(
MODULE
*
module
=
aBoard
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
module
->
flag
=
0
;
if
(
module
->
GetLayer
()
==
COPPER_LAYER_N
)
{
aBoard
->
Change_Side_Module
(
module
,
NULL
);
module
->
flag
=
1
;
}
}
modulesAreFlipped
=
true
;
}
void
SPECCTRA_DB
::
RevertMODULEs
(
BOARD
*
aBoard
)
{
if
(
!
modulesAreFlipped
)
return
;
// DSN Images (=Kicad MODULES and pads) must be presented from the
// top view. Restore those that were flipped.
...
...
@@ -1232,6 +1254,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
module
->
flag
=
0
;
}
}
modulesAreFlipped
=
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment