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
07ef1709
Commit
07ef1709
authored
Oct 01, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use board specific layer names in UI and reports
parent
39473ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
186 additions
and
158 deletions
+186
-158
gen_modules_placefile.cpp
pcbnew/gen_modules_placefile.cpp
+186
-158
No files found.
pcbnew/gen_modules_placefile.cpp
View file @
07ef1709
...
@@ -65,41 +65,47 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -65,41 +65,47 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
* utilis pour les machines de placement de composants
* utilis pour les machines de placement de composants
*/
*/
{
{
float
conv_unit
;
bool
doBoardBack
=
false
;
int
NbMod
,
ii
;
MODULE
*
module
;
bool
GenCu
=
FALSE
;
LIST_MOD
*
Liste
;
MODULE
*
Module
;
char
line
[
1024
];
LIST_MOD
*
Liste
;
char
Buff
[
80
];
char
Line
[
1024
],
Buff
[
80
];
wxString
fnFront
;
wxString
NameLayerCu
,
NameLayerCmp
,
msg
;
wxString
fnBack
;
FILE
*
LayerCu
=
NULL
,
*
LayerCmp
=
NULL
;
wxString
extension
;
wxString
msg
;
wxString
frontLayerName
;
wxString
backLayerName
;
wxString
Title
;
FILE
*
fpFront
=
NULL
;
FILE
*
fpBack
=
NULL
;
/* Calcul des echelles de conversion */
/* Calcul des echelles de conversion */
conv_unit
=
0.0001
;
/* unites = INCHES */
float
conv_unit
=
0.0001
;
/* unites = INCHES */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
File_Place_Offset
=
m_Auxiliary_Axis_Position
;
File_Place_Offset
=
m_Auxiliary_Axis_Position
;
/* Calcul du nombre de modules utiles ( Attribut CMS, non VIRTUAL ) ) */
/* Calcul du nombre de modules utiles ( Attribut CMS, non VIRTUAL ) ) */
NbMod
=
0
;
int
moduleCount
=
0
;
for
(
Module
=
m_Pcb
->
m_Modules
;
Module
;
Module
=
M
odule
->
Next
()
)
for
(
module
=
m_Pcb
->
m_Modules
;
module
;
module
=
m
odule
->
Next
()
)
{
{
if
(
M
odule
->
m_Attributs
&
MOD_VIRTUAL
)
if
(
m
odule
->
m_Attributs
&
MOD_VIRTUAL
)
{
{
D
(
printf
(
"skipping module %s because its virtual
\n
"
,
CONV_TO_UTF8
(
M
odule
->
GetReference
())
);)
D
(
printf
(
"skipping module %s because its virtual
\n
"
,
CONV_TO_UTF8
(
m
odule
->
GetReference
())
);)
continue
;
continue
;
}
}
if
(
(
M
odule
->
m_Attributs
&
MOD_CMS
)
==
0
)
if
(
(
m
odule
->
m_Attributs
&
MOD_CMS
)
==
0
)
{
{
#if 0 && defined(DEBUG) // enable this code to fix a bunch of mis-labeled modules:
#if 0 && defined(DEBUG) // enable this code to fix a bunch of mis-labeled modules:
if( !HasNonSMDPins(
M
odule ) )
if( !HasNonSMDPins(
m
odule ) )
M
odule->m_Attributs |= MOD_CMS; // all pins are SMD, fix the problem
m
odule->m_Attributs |= MOD_CMS; // all pins are SMD, fix the problem
else
else
{
{
printf( "skipping %s because its attribute is not CMS and it has non SMD pins\n", CONV_TO_UTF8(
M
odule->GetReference()) );
printf( "skipping %s because its attribute is not CMS and it has non SMD pins\n", CONV_TO_UTF8(
m
odule->GetReference()) );
continue;
continue;
}
}
#else
#else
...
@@ -107,39 +113,47 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -107,39 +113,47 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
#endif
#endif
}
}
if
(
Module
->
GetLayer
()
==
COPPER_LAYER_N
)
if
(
module
->
GetLayer
()
==
COPPER_LAYER_N
)
GenCu
=
TRUE
;
doBoardBack
=
true
;
NbMod
++
;
moduleCount
++
;
}
}
if
(
NbMod
==
0
)
if
(
moduleCount
==
0
)
{
{
DisplayError
(
this
,
_
(
"No Modules for Automated Placement"
),
20
);
return
;
DisplayError
(
this
,
_
(
"No Modules for Automated Placement"
),
20
);
return
;
}
}
fnFront
=
GetScreen
()
->
m_FileName
;
/* Init nom fichier */
frontLayerName
=
m_Pcb
->
GetLayerName
(
CMP_N
);
NameLayerCmp
=
GetScreen
()
->
m_FileName
;
extension
.
Printf
(
wxT
(
"-%s.pos"
),
frontLayerName
.
GetData
()
);
ChangeFileNameExt
(
NameLayerCmp
,
wxT
(
"-cmp.pos"
)
);
ChangeFileNameExt
(
fnFront
,
extension
);
LayerCmp
=
wxFopen
(
NameLayerCmp
,
wxT
(
"wt"
)
);
fpFront
=
wxFopen
(
fnFront
,
wxT
(
"wt"
)
);
if
(
LayerCmp
==
0
)
if
(
fpFront
==
0
)
{
{
msg
=
_
(
"Unable to create "
)
+
NameLayerCu
;
msg
=
_
(
"Unable to create "
)
+
fnFront
;
DisplayError
(
this
,
msg
);
return
;
DisplayError
(
this
,
msg
);
goto
exit
;
}
}
if
(
GenCu
)
if
(
doBoardBack
)
{
{
NameLayerCu
=
GetScreen
()
->
m_FileName
;
fnBack
=
GetScreen
()
->
m_FileName
;
ChangeFileNameExt
(
NameLayerCu
,
wxT
(
"-copper.pos"
)
);
LayerCu
=
wxFopen
(
NameLayerCu
,
wxT
(
"wt"
)
);
backLayerName
=
m_Pcb
->
GetLayerName
(
COPPER_LAYER_N
);
if
(
LayerCu
==
0
)
extension
.
Printf
(
wxT
(
"-%s.pos"
),
backLayerName
.
GetData
()
);
ChangeFileNameExt
(
fnBack
,
extension
);
fpBack
=
wxFopen
(
fnBack
,
wxT
(
"wt"
)
);
if
(
fpBack
==
0
)
{
{
msg
=
_
(
"Unable to create "
)
+
NameLayerCu
;
msg
=
_
(
"Unable to create "
)
+
fnBack
;
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
fclose
(
LayerCmp
);
goto
exit
;
return
;
}
}
}
}
...
@@ -148,82 +162,82 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -148,82 +162,82 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
/* Affichage du bilan : */
/* Affichage du bilan : */
MsgPanel
->
EraseMsgBox
();
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
this
,
0
,
_
(
"Component side place file:"
),
NameLayerCmp
,
BLUE
);
Affiche_1_Parametre
(
this
,
0
,
_
(
"Component side place file:"
),
fnFront
,
BLUE
);
if
(
GenCu
)
if
(
doBoardBack
)
Affiche_1_Parametre
(
this
,
32
,
_
(
"Copper side place file:"
),
NameLayerCu
,
BLUE
);
Affiche_1_Parametre
(
this
,
32
,
_
(
"Copper side place file:"
),
fnBack
,
BLUE
);
msg
.
Empty
();
msg
<<
NbMod
;
msg
.
Empty
();
msg
<<
moduleCount
;
Affiche_1_Parametre
(
this
,
65
,
_
(
"Module count"
),
msg
,
RED
);
Affiche_1_Parametre
(
this
,
65
,
_
(
"Module count"
),
msg
,
RED
);
/* Etablissement de la liste des modules par ordre alphabetique */
/* Etablissement de la liste des modules par ordre alphabetique */
Liste
=
(
LIST_MOD
*
)
MyZMalloc
(
NbMod
*
sizeof
(
LIST_MOD
)
);
Liste
=
(
LIST_MOD
*
)
MyZMalloc
(
moduleCount
*
sizeof
(
LIST_MOD
)
);
M
odule
=
m_Pcb
->
m_Modules
;
m
odule
=
m_Pcb
->
m_Modules
;
for
(
i
i
=
0
;
Module
;
Module
=
M
odule
->
Next
()
)
for
(
i
nt
ii
=
0
;
module
;
module
=
m
odule
->
Next
()
)
{
{
if
(
M
odule
->
m_Attributs
&
MOD_VIRTUAL
)
if
(
m
odule
->
m_Attributs
&
MOD_VIRTUAL
)
continue
;
continue
;
if
(
(
M
odule
->
m_Attributs
&
MOD_CMS
)
==
0
)
if
(
(
m
odule
->
m_Attributs
&
MOD_CMS
)
==
0
)
continue
;
continue
;
Liste
[
ii
].
m_Module
=
M
odule
;
Liste
[
ii
].
m_Module
=
m
odule
;
Liste
[
ii
].
m_Reference
=
M
odule
->
m_Reference
->
m_Text
;
Liste
[
ii
].
m_Reference
=
m
odule
->
m_Reference
->
m_Text
;
Liste
[
ii
].
m_Value
=
M
odule
->
m_Value
->
m_Text
;
Liste
[
ii
].
m_Value
=
m
odule
->
m_Value
->
m_Text
;
ii
++
;
ii
++
;
}
}
qsort
(
Liste
,
NbMod
,
sizeof
(
LIST_MOD
),
qsort
(
Liste
,
moduleCount
,
sizeof
(
LIST_MOD
),
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListeModCmp
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListeModCmp
);
/* Generation entete du fichier 'commentaires) */
/* Generation entete du fichier 'commentaires) */
sprintf
(
L
ine
,
"### Module positions - created on %s ###
\n
"
,
sprintf
(
l
ine
,
"### Module positions - created on %s ###
\n
"
,
DateAndTime
(
Buff
)
);
DateAndTime
(
Buff
)
);
fputs
(
Line
,
LayerCmp
);
fputs
(
line
,
fpFront
);
if
(
GenCu
)
if
(
doBoardBack
)
fputs
(
Line
,
LayerCu
);
fputs
(
line
,
fpBack
);
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
sprintf
(
L
ine
,
"### Printed by PcbNew version %s
\n
"
,
CONV_TO_UTF8
(
Title
)
);
sprintf
(
l
ine
,
"### Printed by PcbNew version %s
\n
"
,
CONV_TO_UTF8
(
Title
)
);
fputs
(
Line
,
LayerCmp
);
fputs
(
line
,
fpFront
);
if
(
GenCu
)
if
(
doBoardBack
)
fputs
(
Line
,
LayerCu
);
fputs
(
line
,
fpBack
);
sprintf
(
L
ine
,
"## Unit = inches, Angle = deg.
\n
"
);
sprintf
(
l
ine
,
"## Unit = inches, Angle = deg.
\n
"
);
fputs
(
Line
,
LayerCmp
);
fputs
(
line
,
fpFront
);
if
(
GenCu
)
if
(
doBoardBack
)
fputs
(
Line
,
LayerCu
);
fputs
(
line
,
fpBack
);
sprintf
(
Line
,
"## Side : Components
\n
"
);
sprintf
(
line
,
"## Side : %s
\n
"
,
CONV_TO_UTF8
(
frontLayerName
)
);
fputs
(
Line
,
LayerCmp
);
fputs
(
line
,
fpFront
);
if
(
GenCu
)
if
(
doBoardBack
)
{
{
sprintf
(
Line
,
"## Side : Copper
\n
"
);
sprintf
(
line
,
"## Side : %s
\n
"
,
CONV_TO_UTF8
(
backLayerName
)
);
fputs
(
Line
,
LayerCu
);
fputs
(
line
,
fpBack
);
}
}
sprintf
(
L
ine
,
sprintf
(
l
ine
,
"# Ref Val PosX PosY Rot Side
\n
"
);
"# Ref Val PosX PosY Rot Side
\n
"
);
fputs
(
Line
,
LayerCmp
);
fputs
(
line
,
fpFront
);
if
(
GenCu
)
if
(
doBoardBack
)
fputs
(
Line
,
LayerCu
);
fputs
(
line
,
fpBack
);
/* Generation lignes utiles du fichier */
/* Generation lignes utiles du fichier */
for
(
i
i
=
0
;
ii
<
NbMod
;
ii
++
)
for
(
i
nt
ii
=
0
;
ii
<
moduleCount
;
ii
++
)
{
{
wxPoint
module_pos
;
wxPoint
module_pos
;
wxString
ref
=
Liste
[
ii
].
m_Reference
;
wxString
ref
=
Liste
[
ii
].
m_Reference
;
wxString
val
=
Liste
[
ii
].
m_Value
;
wxString
val
=
Liste
[
ii
].
m_Value
;
sprintf
(
L
ine
,
"%-8.8s %-16.16s "
,
CONV_TO_UTF8
(
ref
),
CONV_TO_UTF8
(
val
)
);
sprintf
(
l
ine
,
"%-8.8s %-16.16s "
,
CONV_TO_UTF8
(
ref
),
CONV_TO_UTF8
(
val
)
);
module_pos
=
Liste
[
ii
].
m_Module
->
m_Pos
;
module_pos
=
Liste
[
ii
].
m_Module
->
m_Pos
;
module_pos
.
x
-=
File_Place_Offset
.
x
;
module_pos
.
x
-=
File_Place_Offset
.
x
;
module_pos
.
y
-=
File_Place_Offset
.
y
;
module_pos
.
y
-=
File_Place_Offset
.
y
;
char
*
text
=
Line
+
strlen
(
L
ine
);
char
*
text
=
line
+
strlen
(
l
ine
);
sprintf
(
text
,
" %9.4f %9.4f %8.1f "
,
sprintf
(
text
,
" %9.4f %9.4f %8.1f "
,
(
float
)
module_pos
.
x
*
conv_unit
,
(
float
)
module_pos
.
x
*
conv_unit
,
(
float
)
module_pos
.
y
*
conv_unit
,
(
float
)
module_pos
.
y
*
conv_unit
,
...
@@ -231,32 +245,40 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -231,32 +245,40 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
CMP_N
)
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
CMP_N
)
{
{
strcat
(
Line
,
"Cmp.
\n
"
);
strcat
(
line
,
CONV_TO_UTF8
(
frontLayerName
)
);
fputs
(
Line
,
LayerCmp
);
strcat
(
line
,
"
\n
"
);
fputs
(
line
,
fpFront
);
}
}
else
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
COPPER_LAYER_N
)
else
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
COPPER_LAYER_N
)
{
{
strcat
(
Line
,
"Cu
\n
"
);
strcat
(
line
,
CONV_TO_UTF8
(
backLayerName
)
);
fputs
(
Line
,
LayerCu
);
strcat
(
line
,
"
\n
"
);
fputs
(
line
,
fpBack
);
}
}
}
}
/* Generation fin du fichier */
/* Generation fin du fichier */
fputs
(
"## End
\n
"
,
LayerCmp
);
fputs
(
"## End
\n
"
,
fpFront
);
fclose
(
LayerCmp
);
if
(
GenCu
)
if
(
doBoardBack
)
{
fputs
(
"## End
\n
"
,
fpBack
);
fputs
(
"## End
\n
"
,
LayerCu
);
fclose
(
LayerCu
);
}
MyFree
(
Liste
);
MyFree
(
Liste
);
SetLocaleTo_Default
(
);
// revert to the current locale
SetLocaleTo_Default
(
);
// revert to the current locale
msg
=
wxT
(
"Cmp File: "
)
+
NameLayerCmp
;
msg
=
frontLayerName
+
wxT
(
" File: "
)
+
fnFront
;
if
(
GenCu
)
msg
+=
wxT
(
"
\n
Cu File: "
)
+
NameLayerCu
;
if
(
doBoardBack
)
msg
+=
wxT
(
"
\n\n
"
)
+
backLayerName
+
wxT
(
" File: "
)
+
fnBack
;
DisplayInfo
(
this
,
msg
);
DisplayInfo
(
this
,
msg
);
exit
:
if
(
fpFront
)
fclose
(
fpFront
);
if
(
fpBack
)
fclose
(
fpBack
);
}
}
...
@@ -270,8 +292,8 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
...
@@ -270,8 +292,8 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
float
conv_unit
;
float
conv_unit
;
MODULE
*
Module
;
MODULE
*
Module
;
D_PAD
*
pad
;
D_PAD
*
pad
;
char
L
ine
[
1024
],
Buff
[
80
];
char
l
ine
[
1024
],
Buff
[
80
];
wxString
FullFileName
,
NameLayerCmp
,
msg
;
wxString
FullFileName
,
fnFront
,
msg
;
FILE
*
rptfile
;
FILE
*
rptfile
;
wxPoint
module_pos
;
wxPoint
module_pos
;
...
@@ -297,12 +319,12 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
...
@@ -297,12 +319,12 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
SetLocaleTo_C_standard
(
);
SetLocaleTo_C_standard
(
);
/* Generation entete du fichier 'commentaires) */
/* Generation entete du fichier 'commentaires) */
sprintf
(
L
ine
,
"## Module report - date %s
\n
"
,
DateAndTime
(
Buff
)
);
sprintf
(
l
ine
,
"## Module report - date %s
\n
"
,
DateAndTime
(
Buff
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
sprintf
(
L
ine
,
"## Created by PcbNew version %s
\n
"
,
CONV_TO_UTF8
(
Title
)
);
sprintf
(
l
ine
,
"## Created by PcbNew version %s
\n
"
,
CONV_TO_UTF8
(
Title
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
fputs
(
"## Unit = inches, Angle = deg.
\n
"
,
rptfile
);
fputs
(
"## Unit = inches, Angle = deg.
\n
"
,
rptfile
);
/* Generation lignes utiles du fichier */
/* Generation lignes utiles du fichier */
...
@@ -312,30 +334,30 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
...
@@ -312,30 +334,30 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
m_Pcb
->
ComputeBoundaryBox
();
m_Pcb
->
ComputeBoundaryBox
();
fputs
(
"
\n
$BOARD
\n
"
,
rptfile
);
fputs
(
"
\n
$BOARD
\n
"
,
rptfile
);
fputs
(
"unit INCH
\n
"
,
rptfile
);
fputs
(
"unit INCH
\n
"
,
rptfile
);
sprintf
(
L
ine
,
"upper_left_corner %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"upper_left_corner %9.6f %9.6f
\n
"
,
(
float
)
m_Pcb
->
m_BoundaryBox
.
GetX
()
*
conv_unit
,
(
float
)
m_Pcb
->
m_BoundaryBox
.
GetX
()
*
conv_unit
,
(
float
)
m_Pcb
->
m_BoundaryBox
.
GetY
()
*
conv_unit
);
(
float
)
m_Pcb
->
m_BoundaryBox
.
GetY
()
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"lower_right_corner %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"lower_right_corner %9.6f %9.6f
\n
"
,
(
float
)
(
m_Pcb
->
m_BoundaryBox
.
GetRight
()
)
*
conv_unit
,
(
float
)
(
m_Pcb
->
m_BoundaryBox
.
GetRight
()
)
*
conv_unit
,
(
float
)
(
m_Pcb
->
m_BoundaryBox
.
GetBottom
()
)
*
conv_unit
);
(
float
)
(
m_Pcb
->
m_BoundaryBox
.
GetBottom
()
)
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
fputs
(
"$EndBOARD
\n\n
"
,
rptfile
);
fputs
(
"$EndBOARD
\n\n
"
,
rptfile
);
Module
=
(
MODULE
*
)
m_Pcb
->
m_Modules
;
Module
=
(
MODULE
*
)
m_Pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
{
{
sprintf
(
L
ine
,
"$MODULE
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Reference
->
m_Text
)
);
sprintf
(
l
ine
,
"$MODULE
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Reference
->
m_Text
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"reference
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Reference
->
m_Text
)
);
sprintf
(
l
ine
,
"reference
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Reference
->
m_Text
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"value
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Value
->
m_Text
)
);
sprintf
(
l
ine
,
"value
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_Value
->
m_Text
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"footprint
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_LibRef
)
);
sprintf
(
l
ine
,
"footprint
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
Module
->
m_LibRef
)
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
msg
=
wxT
(
"attribut"
);
msg
=
wxT
(
"attribut"
);
if
(
Module
->
m_Attributs
&
MOD_VIRTUAL
)
if
(
Module
->
m_Attributs
&
MOD_VIRTUAL
)
...
@@ -350,47 +372,47 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
...
@@ -350,47 +372,47 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
module_pos
=
Module
->
m_Pos
;
module_pos
=
Module
->
m_Pos
;
module_pos
.
x
-=
File_Place_Offset
.
x
;
module_pos
.
x
-=
File_Place_Offset
.
x
;
module_pos
.
y
-=
File_Place_Offset
.
y
;
module_pos
.
y
-=
File_Place_Offset
.
y
;
sprintf
(
L
ine
,
"position %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"position %9.6f %9.6f
\n
"
,
(
float
)
module_pos
.
x
*
conv_unit
,
(
float
)
module_pos
.
x
*
conv_unit
,
(
float
)
module_pos
.
y
*
conv_unit
);
(
float
)
module_pos
.
y
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"orientation %.2f
\n
"
,
(
float
)
Module
->
m_Orient
/
10
);
sprintf
(
l
ine
,
"orientation %.2f
\n
"
,
(
float
)
Module
->
m_Orient
/
10
);
if
(
Module
->
GetLayer
()
==
CMP_N
)
if
(
Module
->
GetLayer
()
==
CMP_N
)
strcat
(
L
ine
,
"layer component
\n
"
);
strcat
(
l
ine
,
"layer component
\n
"
);
else
if
(
Module
->
GetLayer
()
==
COPPER_LAYER_N
)
else
if
(
Module
->
GetLayer
()
==
COPPER_LAYER_N
)
strcat
(
L
ine
,
"layer copper
\n
"
);
strcat
(
l
ine
,
"layer copper
\n
"
);
else
else
strcat
(
L
ine
,
"layer other
\n
"
);
strcat
(
l
ine
,
"layer other
\n
"
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
Module
->
Write_3D_Descr
(
rptfile
);
Module
->
Write_3D_Descr
(
rptfile
);
for
(
pad
=
Module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
for
(
pad
=
Module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
{
fprintf
(
rptfile
,
"$PAD
\"
%.4s
\"\n
"
,
pad
->
m_Padname
);
fprintf
(
rptfile
,
"$PAD
\"
%.4s
\"\n
"
,
pad
->
m_Padname
);
sprintf
(
L
ine
,
"position %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"position %9.6f %9.6f
\n
"
,
(
float
)
pad
->
m_Pos0
.
x
*
conv_unit
,
(
float
)
pad
->
m_Pos0
.
x
*
conv_unit
,
(
float
)
pad
->
m_Pos0
.
y
*
conv_unit
);
(
float
)
pad
->
m_Pos0
.
y
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"size %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"size %9.6f %9.6f
\n
"
,
(
float
)
pad
->
m_Size
.
x
*
conv_unit
,
(
float
)
pad
->
m_Size
.
x
*
conv_unit
,
(
float
)
pad
->
m_Size
.
y
*
conv_unit
);
(
float
)
pad
->
m_Size
.
y
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"drill %9.6f
\n
"
,
(
float
)
pad
->
m_Drill
.
x
*
conv_unit
);
sprintf
(
l
ine
,
"drill %9.6f
\n
"
,
(
float
)
pad
->
m_Drill
.
x
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"shape_offset %9.6f %9.6f
\n
"
,
sprintf
(
l
ine
,
"shape_offset %9.6f %9.6f
\n
"
,
(
float
)
pad
->
m_Offset
.
x
*
conv_unit
,
(
float
)
pad
->
m_Offset
.
x
*
conv_unit
,
(
float
)
pad
->
m_Offset
.
y
*
conv_unit
);
(
float
)
pad
->
m_Offset
.
y
*
conv_unit
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"orientation %.2f
\n
"
,
(
float
)
(
pad
->
m_Orient
-
Module
->
m_Orient
)
/
10
);
sprintf
(
l
ine
,
"orientation %.2f
\n
"
,
(
float
)
(
pad
->
m_Orient
-
Module
->
m_Orient
)
/
10
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
const
char
*
shape_name
[
6
]
=
const
char
*
shape_name
[
6
]
=
{
"??? "
,
"Circ"
,
"Rect"
,
"Oval"
,
"trap"
,
"spec"
};
{
"??? "
,
"Circ"
,
"Rect"
,
"Oval"
,
"trap"
,
"spec"
};
sprintf
(
L
ine
,
"Shape %s
\n
"
,
shape_name
[
pad
->
m_PadShape
]
);
sprintf
(
l
ine
,
"Shape %s
\n
"
,
shape_name
[
pad
->
m_PadShape
]
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
int
layer
=
0
;
int
layer
=
0
;
if
(
pad
->
m_Masque_Layer
&
CUIVRE_LAYER
)
if
(
pad
->
m_Masque_Layer
&
CUIVRE_LAYER
)
...
@@ -398,8 +420,8 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
...
@@ -398,8 +420,8 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
if
(
pad
->
m_Masque_Layer
&
CMP_LAYER
)
if
(
pad
->
m_Masque_Layer
&
CMP_LAYER
)
layer
|=
2
;
layer
|=
2
;
const
char
*
layer_name
[
4
]
=
{
"??? "
,
"copper"
,
"component"
,
"all"
};
const
char
*
layer_name
[
4
]
=
{
"??? "
,
"copper"
,
"component"
,
"all"
};
sprintf
(
L
ine
,
"Layer %s
\n
"
,
layer_name
[
layer
]
);
sprintf
(
l
ine
,
"Layer %s
\n
"
,
layer_name
[
layer
]
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
fprintf
(
rptfile
,
"$EndPAD
\n
"
);
fprintf
(
rptfile
,
"$EndPAD
\n
"
);
}
}
...
@@ -438,13 +460,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
...
@@ -438,13 +460,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
{
{
double
conv_unit
,
ux0
,
uy0
,
dx
,
dy
;
double
conv_unit
,
ux0
,
uy0
,
dx
,
dy
;
double
rayon
,
width
;
double
rayon
,
width
;
char
L
ine
[
1024
];
char
l
ine
[
1024
];
/* Calcul des echelles de conversion */
/* Calcul des echelles de conversion */
conv_unit
=
0.0001
;
/* unites = INCHES */
conv_unit
=
0.0001
;
/* unites = INCHES */
/* coord de depart */
/* coord de depart */
ux0
=
PtDrawSegment
->
m_Start
.
x
*
conv_unit
;
ux0
=
PtDrawSegment
->
m_Start
.
x
*
conv_unit
;
uy0
=
PtDrawSegment
->
m_Start
.
y
*
conv_unit
;
uy0
=
PtDrawSegment
->
m_Start
.
y
*
conv_unit
;
/* coord d'arrivee */
/* coord d'arrivee */
dx
=
PtDrawSegment
->
m_End
.
x
*
conv_unit
;
dx
=
PtDrawSegment
->
m_End
.
x
*
conv_unit
;
dy
=
PtDrawSegment
->
m_End
.
y
*
conv_unit
;
dy
=
PtDrawSegment
->
m_End
.
y
*
conv_unit
;
...
@@ -455,41 +479,45 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
...
@@ -455,41 +479,45 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
{
{
case
S_CIRCLE
:
case
S_CIRCLE
:
rayon
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
rayon
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
sprintf
(
Line
,
"$CIRCLE
\n
"
);
fputs
(
L
ine
,
rptfile
);
sprintf
(
line
,
"$CIRCLE
\n
"
);
fputs
(
l
ine
,
rptfile
);
sprintf
(
L
ine
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
sprintf
(
l
ine
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
sprintf
(
L
ine
,
"radius %.6lf
\n
"
,
rayon
);
sprintf
(
l
ine
,
"radius %.6lf
\n
"
,
rayon
);
sprintf
(
L
ine
,
"width %.6lf
\n
"
,
width
);
sprintf
(
l
ine
,
"width %.6lf
\n
"
,
width
);
sprintf
(
L
ine
,
"$EndCIRCLE
\n
"
);
sprintf
(
l
ine
,
"$EndCIRCLE
\n
"
);
fputs
(
L
ine
,
rptfile
);
fputs
(
l
ine
,
rptfile
);
break
;
break
;
case
S_ARC
:
case
S_ARC
:
{
{
int
endx
=
PtDrawSegment
->
m_End
.
x
,
endy
=
PtDrawSegment
->
m_End
.
y
;
int
endx
=
PtDrawSegment
->
m_End
.
x
,
endy
=
PtDrawSegment
->
m_End
.
y
;
rayon
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
rayon
=
hypot
(
dx
-
ux0
,
dy
-
uy0
);
RotatePoint
(
&
endx
,
RotatePoint
(
&
endx
,
&
endy
,
&
endy
,
PtDrawSegment
->
m_Start
.
x
,
PtDrawSegment
->
m_Start
.
x
,
PtDrawSegment
->
m_Start
.
y
,
PtDrawSegment
->
m_Start
.
y
,
PtDrawSegment
->
m_Angle
);
PtDrawSegment
->
m_Angle
);
sprintf
(
Line
,
"$ARC
\n
"
);
fputs
(
Line
,
rptfile
);
sprintf
(
Line
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
// @todo this is a bug, cannot sprintf into line more than once, should use fprintf instead
sprintf
(
Line
,
"start %.6lf %.6lf
\n
"
,
endx
*
conv_unit
,
endy
*
conv_unit
);
sprintf
(
line
,
"$ARC
\n
"
);
fputs
(
line
,
rptfile
);
sprintf
(
Line
,
"end %.6lf %.6lf
\n
"
,
dx
,
dy
);
sprintf
(
line
,
"centre %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
sprintf
(
Line
,
"width %.6lf
\n
"
,
width
);
sprintf
(
line
,
"start %.6lf %.6lf
\n
"
,
endx
*
conv_unit
,
endy
*
conv_unit
);
sprintf
(
Line
,
"$EndARC
\n
"
);
sprintf
(
line
,
"end %.6lf %.6lf
\n
"
,
dx
,
dy
);
fputs
(
Line
,
rptfile
);
sprintf
(
line
,
"width %.6lf
\n
"
,
width
);
}
sprintf
(
line
,
"$EndARC
\n
"
);
fputs
(
line
,
rptfile
);
}
break
;
break
;
default
:
default
:
sprintf
(
Line
,
"$LINE
\n
"
);
sprintf
(
line
,
"$LINE
\n
"
);
fputs
(
Line
,
rptfile
);
fputs
(
line
,
rptfile
);
sprintf
(
Line
,
"start %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
sprintf
(
Line
,
"end %.6lf %.6lf
\n
"
,
dx
,
dy
);
// @todo this is a bug, cannot sprintf into line more than once, should use fprintf instead
sprintf
(
Line
,
"width %.6lf
\n
"
,
width
);
sprintf
(
line
,
"start %.6lf %.6lf
\n
"
,
ux0
,
uy0
);
sprintf
(
Line
,
"$EndLINE
\n
"
);
sprintf
(
line
,
"end %.6lf %.6lf
\n
"
,
dx
,
dy
);
fputs
(
Line
,
rptfile
);
sprintf
(
line
,
"width %.6lf
\n
"
,
width
);
sprintf
(
line
,
"$EndLINE
\n
"
);
fputs
(
line
,
rptfile
);
break
;
break
;
}
}
}
}
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