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
f3fcfce6
Commit
f3fcfce6
authored
Jan 23, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specctra work
parent
74d373e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
81 deletions
+124
-81
change_log.txt
change_log.txt
+1
-0
specctra.h
pcbnew/specctra.h
+4
-0
specctra_export.cpp
pcbnew/specctra_export.cpp
+119
-81
No files found.
change_log.txt
View file @
f3fcfce6
...
...
@@ -14,6 +14,7 @@ email address.
* Changed specctra.h's POINT to use double for coordinates. Changed format
string for Format()ing a double.
* Changed specctra_export.cpp to actually output an incomplete file.
* Added BOARD::GetCopperLayerCount() and BOARD::GetLayerName().
2008-Jan-21 UPDATE Dick Hollenbeck <dick@softplc.com>
...
...
pcbnew/specctra.h
View file @
f3fcfce6
...
...
@@ -837,6 +837,10 @@ public:
};
/**
* Class VIA
* corresponds to the <via_descriptor> in the specctra dsn spec.
*/
class
VIA
:
public
ELEM
{
friend
class
SPECCTRA_DB
;
...
...
pcbnew/specctra_export.cpp
View file @
f3fcfce6
...
...
@@ -68,14 +68,17 @@ void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
{
db
.
FromBOARD
(
m_Pcb
);
db
.
ExportPCB
(
fullFileName
,
true
);
// if an exception is thrown by FromBOARD or Export(), then
// ~SPECCTRA_DB() will close the file.
}
catch
(
IOError
ioe
)
{
DisplayError
(
this
,
ioe
.
errorText
);
return
;
}
// if an exception is thrown by FromBOARD or Export(), then
// ~SPECCTRA_DB() will close the file.
// @todo display a message saying the export is complete.
}
...
...
@@ -100,11 +103,17 @@ static inline void swap( POINT_PAIR& pair )
}
/**
* Function mapPt
* converts a Kicad point into a DSN file point. Kicad's BOARD coordinates
* are in deci-mils (i.e. 1/10,000th of an inch) and we are exporting in units
* of mils, so we have to divide by 10.
*/
static
POINT
mapPt
(
const
wxPoint
&
pt
)
{
POINT
ret
;
ret
.
x
=
pt
.
x
;
ret
.
y
=
-
pt
.
y
;
// make y negative, since it is increasing going down.
ret
.
x
=
pt
.
x
/
10.0
;
ret
.
y
=
-
pt
.
y
/
10.0
;
// make y negative, since it is increasing going down.
return
ret
;
}
...
...
@@ -138,7 +147,7 @@ static void swapEnds( POINT_PAIRS& aList )
/**
* Function isRectangle
* tests to see if the POINT_PAIRS list make up a vertically/horizontally
* tests to see if the POINT_PAIRS list make
s
up a vertically/horizontally
* oriented rectangle.
* @return bool - true if there are 4 point pairs making a rectangle.
*/
...
...
@@ -177,103 +186,132 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
if
(
!
pcb
)
pcb
=
SPECCTRA_DB
::
MakePCB
();
//-----<header stuff>-------------------------------------------------
pcb
->
unit
->
units
=
T_mil
;
pcb
->
resolution
->
units
=
T_mil
;
pcb
->
resolution
->
value
=
10
;
//-----<unit_descriptor> & <resolution_descriptor>--------------------
{
pcb
->
unit
->
units
=
T_mil
;
pcb
->
resolution
->
units
=
T_mil
;
pcb
->
resolution
->
value
=
100
;
}
//-----<board edges>--------------------------------------------------
// get all the DRAWSEGMENTS into 'items', then look for layer == EDGE_N,
// and those segments comprize the board's perimeter.
const
KICAD_T
scanDRAWSEGMENTS
[]
=
{
TYPEDRAWSEGMENT
,
EOT
};
items
.
Collect
(
aBoard
,
scanDRAWSEGMENTS
);
bool
haveEdges
=
false
;
ppairs
.
clear
();
for
(
int
i
=
0
;
i
<
items
.
GetCount
();
++
i
)
//-----<boundary_descriptor>------------------------------------------
{
DRAWSEGMENT
*
item
=
(
DRAWSEGMENT
*
)
items
[
i
];
wxASSERT
(
item
->
Type
()
==
TYPEDRAWSEGMENT
);
if
(
item
->
GetLayer
()
==
EDGE_N
)
// get all the DRAWSEGMENTS into 'items', then look for layer == EDGE_N,
// and those segments comprize the board's perimeter.
const
KICAD_T
scanDRAWSEGMENTS
[]
=
{
TYPEDRAWSEGMENT
,
EOT
};
items
.
Collect
(
aBoard
,
scanDRAWSEGMENTS
);
bool
haveEdges
=
false
;
ppairs
.
clear
();
for
(
int
i
=
0
;
i
<
items
.
GetCount
();
++
i
)
{
pair
.
p1
=
mapPt
(
item
->
m_Start
);
pair
.
p2
=
mapPt
(
item
->
m_End
);
pair
.
item
=
item
;
ppairs
.
push_back
(
pair
);
haveEdges
=
true
;
DRAWSEGMENT
*
item
=
(
DRAWSEGMENT
*
)
items
[
i
];
wxASSERT
(
item
->
Type
()
==
TYPEDRAWSEGMENT
);
if
(
item
->
GetLayer
()
==
EDGE_N
)
{
pair
.
p1
=
mapPt
(
item
->
m_Start
);
pair
.
p2
=
mapPt
(
item
->
m_End
);
pair
.
item
=
item
;
ppairs
.
push_back
(
pair
);
haveEdges
=
true
;
}
}
}
if
(
haveEdges
)
{
swapEnds
(
ppairs
);
#if defined(DEBUG)
for
(
unsigned
i
=
0
;
i
<
ppairs
.
size
();
++
i
)
if
(
haveEdges
)
{
POINT_PAIR
*
p
=
&
ppairs
[
i
];
p
->
item
->
Show
(
0
,
std
::
cout
);
swapEnds
(
ppairs
);
#if defined(DEBUG)
for
(
unsigned
i
=
0
;
i
<
ppairs
.
size
();
++
i
)
{
POINT_PAIR
*
p
=
&
ppairs
[
i
];
p
->
item
->
Show
(
0
,
std
::
cout
);
}
#endif
BOUNDARY
*
boundary
=
new
BOUNDARY
(
0
);
if
(
isRectangle
(
ppairs
)
)
{
RECTANGLE
*
rect
=
new
RECTANGLE
(
boundary
);
rect
->
layer_id
=
"pcb"
;
// opposite corners
rect
->
point0
=
ppairs
[
0
].
p1
;
rect
->
point1
=
ppairs
[
2
].
p1
;
boundary
->
rectangle
=
rect
;
}
else
{
PATH
*
path
=
new
PATH
(
boundary
);
path
->
layer_id
=
"pcb"
;
for
(
unsigned
i
=
0
;
i
<
ppairs
.
size
();
++
i
)
{
// unless its a closed polygon, this probably won't work,
// otherwise it will.
path
->
points
.
push_back
(
ppairs
[
i
].
p1
);
}
boundary
->
paths
.
push_back
(
path
);
}
pcb
->
structure
->
SetBOUNDARY
(
boundary
);
}
#endif
BOUNDARY
*
boundary
=
new
BOUNDARY
(
0
);
if
(
isRectangle
(
ppairs
)
)
else
{
RECTANGLE
*
rect
=
new
RECTANGLE
(
boundary
);
aBoard
->
ComputeBoundaryBox
(
);
BOUNDARY
*
boundary
=
new
BOUNDARY
(
0
);
RECTANGLE
*
rect
=
new
RECTANGLE
(
boundary
);
rect
->
layer_id
=
"pcb"
;
// opposite corners
rect
->
point0
=
ppairs
[
0
].
p1
;
rect
->
point1
=
ppairs
[
2
].
p1
;
wxPoint
bottomRight
;
bottomRight
.
x
=
aBoard
->
m_BoundaryBox
.
GetRight
();
bottomRight
.
y
=
aBoard
->
m_BoundaryBox
.
GetBottom
();
boundary
->
rectangle
=
rect
;
}
else
{
PATH
*
path
=
new
PATH
(
boundary
);
rect
->
point0
=
mapPt
(
aBoard
->
m_BoundaryBox
.
GetOrigin
()
);
rect
->
point1
=
mapPt
(
bottomRight
);
path
->
layer_id
=
"pcb"
;
for
(
unsigned
i
=
0
;
i
<
ppairs
.
size
();
++
i
)
{
// unless its a closed polygon, this probably won't work,
// otherwise it will.
path
->
points
.
push_back
(
ppairs
[
i
].
p1
);
}
boundary
->
rectangle
=
rect
;
boundary
->
paths
.
push_back
(
path
);
pcb
->
structure
->
SetBOUNDARY
(
boundary
);
}
pcb
->
structure
->
SetBOUNDARY
(
boundary
);
}
else
{
aBoard
->
ComputeBoundaryBox
();
BOUNDARY
*
boundary
=
new
BOUNDARY
(
0
);
RECTANGLE
*
rect
=
new
RECTANGLE
(
boundary
);
rect
->
layer_id
=
"pcb"
;
// opposite corners
wxPoint
bottomRight
;
bottomRight
.
x
=
aBoard
->
m_BoundaryBox
.
GetRight
();
bottomRight
.
y
=
aBoard
->
m_BoundaryBox
.
GetBottom
();
rect
->
point0
=
mapPt
(
aBoard
->
m_BoundaryBox
.
GetOrigin
()
);
rect
->
point1
=
mapPt
(
bottomRight
);
boundary
->
rectangle
=
rect
;
//-----<layer_descriptor>-----------------------------------------------
{
// specctra wants top physical layer first, then going down to the
// bottom most physical layer in physical sequence.
// @question : why does Kicad not display layers in that order?
int
layerCount
=
aBoard
->
GetCopperLayerCount
();
pcb
->
structure
->
SetBOUNDARY
(
boundary
);
for
(
int
ndx
=
layerCount
-
1
;
ndx
>=
0
;
--
ndx
)
{
wxString
layerName
=
aBoard
->
GetLayerName
(
ndx
>
0
&&
ndx
==
layerCount
-
1
?
LAYER_CMP_N
:
ndx
);
LAYER
*
layer
=
new
LAYER
(
pcb
->
structure
);
layer
->
name
=
CONV_TO_UTF8
(
layerName
);
// layer->type =
pcb
->
structure
->
layers
.
push_back
(
layer
);
}
}
//-----<
layers>-------------------------------
------------------------
//-----<
build the padstack list here, no output>
------------------------
//-----<via_descriptor>-------------------------------------------------
{
// Output the vias in the padstack list here, by name
}
}
...
...
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