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
3b658b4b
Commit
3b658b4b
authored
Apr 24, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs #568896 and #569312
parent
c58c388a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
88 deletions
+62
-88
build_BOM.cpp
eeschema/build_BOM.cpp
+53
-80
dialog_build_BOM.h
eeschema/dialog_build_BOM.h
+2
-1
plot.cpp
eeschema/plot.cpp
+6
-6
dialog_netlist.cpp
pcbnew/dialog_netlist.cpp
+1
-1
No files found.
eeschema/build_BOM.cpp
View file @
3b658b4b
...
@@ -71,7 +71,6 @@ static bool SortLabelsByValue( const LABEL_OBJECT& obj1,
...
@@ -71,7 +71,6 @@ static bool SortLabelsByValue( const LABEL_OBJECT& obj1,
static
bool
SortLabelsBySheet
(
const
LABEL_OBJECT
&
obj1
,
static
bool
SortLabelsBySheet
(
const
LABEL_OBJECT
&
obj1
,
const
LABEL_OBJECT
&
obj2
);
const
LABEL_OBJECT
&
obj2
);
static
void
DeleteSubCmp
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
);
static
void
DeleteSubCmp
(
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
);
static
int
PrintListeGLabel
(
FILE
*
f
,
std
::
vector
<
LABEL_OBJECT
>&
aList
);
static
int
PrintListeGLabel
(
FILE
*
f
,
std
::
vector
<
LABEL_OBJECT
>&
aList
);
int
RefDesStringCompare
(
const
char
*
obj1
,
const
char
*
obj2
);
int
RefDesStringCompare
(
const
char
*
obj1
,
const
char
*
obj2
);
...
@@ -204,7 +203,7 @@ void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aInc
...
@@ -204,7 +203,7 @@ void DIALOG_BUILD_BOM::CreatePartsList( const wxString& aFullFileName, bool aInc
/* sort component list by value*/
/* sort component list by value*/
sort
(
cmplist
.
begin
(),
cmplist
.
end
(),
SortComponentsByValue
);
sort
(
cmplist
.
begin
(),
cmplist
.
end
(),
SortComponentsByValue
);
PrintComponentsListByPart
(
f
,
cmplist
);
PrintComponentsListByPart
(
f
,
cmplist
,
aIncludeSubComponents
);
fclose
(
f
);
fclose
(
f
);
}
}
...
@@ -369,6 +368,11 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
...
@@ -369,6 +368,11 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
// Ensure always null terminate m_Ref.
// Ensure always null terminate m_Ref.
item
.
m_Reference
[
sizeof
(
item
.
m_Reference
)
-
1
]
=
0
;
item
.
m_Reference
[
sizeof
(
item
.
m_Reference
)
-
1
]
=
0
;
// Skip pseudo components:
// pseudo components have a reference starting by #. Mainly power symbols
if
(
item
.
m_Reference
[
0
]
==
'#'
)
continue
;
// Real component found, push it in list
aList
.
push_back
(
item
);
aList
.
push_back
(
item
);
}
}
}
}
...
@@ -683,8 +687,6 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
...
@@ -683,8 +687,6 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
continue
;
continue
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
aList
[
ii
].
m_Reference
[
0
]
==
'#'
)
continue
;
Multi
=
0
;
Multi
=
0
;
Unit
=
' '
;
Unit
=
' '
;
...
@@ -694,14 +696,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
...
@@ -694,14 +696,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if
(
(
Multi
>
1
)
&&
aIncludeSubComponents
)
if
(
(
Multi
>
1
)
&&
aIncludeSubComponents
)
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
Unit
=
aList
[
ii
].
m_Unit
+
'1'
-
1
;
Unit
=
aList
[
ii
].
m_Unit
+
'1'
-
1
;
#else
#else
Unit
=
aList
[
ii
].
m_Unit
+
'A'
-
1
;
Unit
=
aList
[
ii
].
m_Unit
+
'A'
-
1
;
#endif
#endif
...
@@ -711,38 +707,24 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
...
@@ -711,38 +707,24 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if
(
CompactForm
)
if
(
CompactForm
)
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
fprintf
(
f
,
"%s%c%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%s%c%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
),
s_ExportSeparatorSymbol
,
VALUE
)
->
m_Text
),
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
DATASHEET
)
->
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
DATASHEET
)
->
m_Text
)
);
#else
#else
fprintf
(
f
,
"%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%s%c%s"
,
CmpName
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
#endif
#endif
else
else
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
fprintf
(
f
,
"| %-10s %-12s %-20s"
,
CmpName
,
fprintf
(
f
,
"| %-10s %-12s %-20s"
,
CmpName
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
),
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
),
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
DATASHEET
)
->
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
DATASHEET
)
->
m_Text
)
);
#else
#else
fprintf
(
f
,
"| %-10s %-12s"
,
CmpName
,
fprintf
(
f
,
"| %-10s %-12s"
,
CmpName
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
)
);
#endif
#endif
if
(
aIncludeSubComponents
)
if
(
aIncludeSubComponents
)
{
{
msg
=
aList
[
ii
].
m_SheetPath
.
PathHumanReadable
();
msg
=
aList
[
ii
].
m_SheetPath
.
PathHumanReadable
();
...
@@ -794,82 +776,76 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
...
@@ -794,82 +776,76 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
*/
*/
int
DIALOG_BUILD_BOM
::
PrintComponentsListByPart
(
int
DIALOG_BUILD_BOM
::
PrintComponentsListByPart
(
FILE
*
f
,
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
)
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
aIncludeSubComponents
)
{
{
int
qty
=
1
;
int
qty
=
0
;
wxString
RefName
;
wxString
RefName
;
wxString
fullRefName
;
// reference + part Id (for multiple parts per package
wxString
ValName
;
wxString
ValName
;
wxString
NxtName
;
wxString
RNames
;
wxString
RNames
;
EDA_BaseStruct
*
DrawList
;
wxString
lastRef
;
EDA_BaseStruct
*
NxtList
;
wxString
unitId
;
SCH_COMPONENT
*
DrawLibItem
;
SCH_COMPONENT
*
currCmp
,
*
nextCmp
;
SCH_COMPONENT
*
NxtLibItem
;
SCH_COMPONENT
dummyCmp
;
// A dummy component, to store fields
SCH_COMPONENT
dummyCmp
;
// A dummy component, to store fields
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aList
.
size
();
ii
++
)
{
{
DrawList
=
aList
[
ii
].
m_RootCmp
;
currCmp
=
(
SCH_COMPONENT
*
)
aList
[
ii
].
m_RootCmp
;
if
(
DrawList
==
NULL
)
if
(
ii
<
aList
.
size
()
-
1
)
continue
;
nextCmp
=
aList
[
ii
+
1
].
m_RootCmp
;
if
(
DrawList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
else
continue
;
nextCmp
=
NULL
;
if
(
aList
[
ii
].
m_Reference
[
0
]
==
'#'
)
continue
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
(
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
.
IsEmpty
()
)
)
continue
;
// Store fields. Store non empty fields only.
// Store fields. Store non empty fields only.
for
(
int
jj
=
FOOTPRINT
;
jj
<
DrawLibItem
->
GetFieldCount
();
jj
++
)
for
(
int
jj
=
FOOTPRINT
;
jj
<
currCmp
->
GetFieldCount
();
jj
++
)
{
{
if
(
!
DrawLibItem
->
GetField
(
jj
)
->
m_Text
.
IsEmpty
()
)
if
(
!
currCmp
->
GetField
(
jj
)
->
m_Text
.
IsEmpty
()
)
dummyCmp
.
GetField
(
jj
)
->
m_Text
=
DrawLibItem
->
GetField
(
jj
)
->
m_Text
;
dummyCmp
.
GetField
(
jj
)
->
m_Text
=
currCmp
->
GetField
(
jj
)
->
m_Text
;
}
}
NxtLibItem
=
NULL
;
RefName
=
CONV_FROM_UTF8
(
aList
[
ii
].
m_Reference
);
for
(
unsigned
ij
=
ii
+
1
;
ij
<
aList
.
size
();
ij
++
)
ValName
=
currCmp
->
GetField
(
VALUE
)
->
m_Text
;
int
multi
=
0
;
if
(
aIncludeSubComponents
)
{
{
NxtList
=
aList
[
ij
].
m_RootCmp
;
LIB_COMPONENT
*
Entry
=
CMP_LIBRARY
::
FindLibraryComponent
(
currCmp
->
m_ChipName
);
if
(
NxtList
==
NULL
)
if
(
Entry
)
continue
;
multi
=
Entry
->
GetPartCount
();
if
(
NxtList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
if
(
multi
<=
1
)
continue
;
multi
=
0
;
if
(
aList
[
ij
].
m_Reference
[
0
]
==
'#'
)
continue
;
NxtLibItem
=
(
SCH_COMPONENT
*
)
NxtList
;
if
(
(
NxtLibItem
->
GetField
(
VALUE
)
->
m_Text
.
IsEmpty
()
)
)
{
continue
;
}
break
;
}
}
if
(
NxtLibItem
!=
NULL
)
if
(
multi
&&
aList
[
ii
].
m_Unit
>
0
)
NxtName
=
NxtLibItem
->
GetField
(
VALUE
)
->
m_Text
;
unitId
.
Printf
(
wxT
(
"%c"
),
'A'
-
1
+
aList
[
ii
].
m_Unit
)
;
else
else
unitId
.
Empty
();
NxtName
=
wxT
(
""
)
;
fullRefName
=
RefName
+
unitId
;
RefName
=
CONV_FROM_UTF8
(
aList
[
ii
].
m_Reference
);
if
(
RNames
.
IsEmpty
()
)
ValName
=
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
;
RNames
=
fullRefName
;
else
if
(
!
NxtName
.
CmpNoCase
(
ValName
)
)
RNames
<<
wxT
(
", "
)
<<
fullRefName
;
{
// In multi parts per package, we have the reference more than once
// but we must count only one package
if
(
lastRef
!=
RefName
)
qty
++
;
qty
++
;
RNames
<<
wxT
(
", "
)
<<
RefName
;
lastRef
=
RefName
;
// if the next cmoponent has same value the line will be printed after.
if
(
nextCmp
&&
nextCmp
->
GetField
(
VALUE
)
->
m_Text
.
CmpNoCase
(
ValName
)
==
0
)
continue
;
continue
;
}
// Print line for the current component value:
fprintf
(
f
,
"%15s%c%3d"
,
CONV_TO_UTF8
(
ValName
),
s_ExportSeparatorSymbol
,
qty
);
fprintf
(
f
,
"%15s%c%3d"
,
CONV_TO_UTF8
(
ValName
),
s_ExportSeparatorSymbol
,
qty
);
qty
=
1
;
if
(
IsFieldChecked
(
FOOTPRINT
)
)
if
(
IsFieldChecked
(
FOOTPRINT
)
)
fprintf
(
f
,
"%c%15s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%15s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
CONV_TO_UTF8
(
currCmp
->
GetField
(
FOOTPRINT
)
->
m_Text
)
);
#if defined(KICAD_GOST)
#if defined(KICAD_GOST)
fprintf
(
f
,
"%c%20s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%20s"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
DrawLibItem
->
GetField
(
DATASHEET
)
->
m_Text
)
);
CONV_TO_UTF8
(
currCmp
->
GetField
(
DATASHEET
)
->
m_Text
)
);
#endif
#endif
// print fields, on demand
// print fields, on demand
...
@@ -880,14 +856,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
...
@@ -880,14 +856,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
CONV_TO_UTF8
(
dummyCmp
.
GetField
(
jj
)
->
m_Text
)
);
CONV_TO_UTF8
(
dummyCmp
.
GetField
(
jj
)
->
m_Text
)
);
}
}
fprintf
(
f
,
"%c%s%s"
,
s_ExportSeparatorSymbol
,
fprintf
(
f
,
"%c%s
\n
"
,
s_ExportSeparatorSymbol
,
CONV_TO_UTF8
(
RefName
),
CONV_TO_UTF8
(
RNames
)
);
CONV_TO_UTF8
(
RNames
)
);
fputs
(
"
\n
"
,
f
);
// Clear strings, to prepare next component
// Clear strings and values, to prepare next component
qty
=
0
;
RNames
.
Empty
();
RNames
.
Empty
();
for
(
int
jj
=
FOOTPRINT
;
jj
<
DrawLibItem
->
GetFieldCount
();
jj
++
)
for
(
int
jj
=
FOOTPRINT
;
jj
<
currCmp
->
GetFieldCount
();
jj
++
)
dummyCmp
.
GetField
(
jj
)
->
m_Text
.
Empty
();
dummyCmp
.
GetField
(
jj
)
->
m_Text
.
Empty
();
}
}
...
@@ -926,8 +901,6 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
...
@@ -926,8 +901,6 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
continue
;
continue
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
aList
[
ii
].
m_Reference
[
0
]
==
'#'
)
continue
;
Multi
=
0
;
Multi
=
0
;
Unit
=
' '
;
Unit
=
' '
;
...
...
eeschema/dialog_build_BOM.h
View file @
3b658b4b
...
@@ -34,7 +34,8 @@ private:
...
@@ -34,7 +34,8 @@ private:
bool
CompactForm
,
bool
aIncludeSubComponents
);
bool
CompactForm
,
bool
aIncludeSubComponents
);
int
PrintComponentsListByVal
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
int
PrintComponentsListByVal
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
aIncludeSubComponents
);
bool
aIncludeSubComponents
);
int
PrintComponentsListByPart
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
);
int
PrintComponentsListByPart
(
FILE
*
f
,
std
::
vector
<
OBJ_CMP_TO_LIST
>&
aList
,
bool
aIncludeSubComponents
);
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
bool
IsFieldChecked
(
int
aFieldId
);
bool
IsFieldChecked
(
int
aFieldId
);
...
...
eeschema/plot.cpp
View file @
3b658b4b
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
static
void
Plot_Hierarchical_PIN_Sheet
(
PLOTTER
*
plotter
,
static
void
Plot_Hierarchical_PIN_Sheet
(
PLOTTER
*
plotter
,
SCH_SHEET_PIN
*
Struct
);
SCH_SHEET_PIN
*
Struct
);
static
void
PlotTextField
(
PLOTTER
*
plotter
,
SCH_COMPONENT
*
DrawLibItem
,
static
void
PlotTextField
(
PLOTTER
*
plotter
,
SCH_COMPONENT
*
DrawLibItem
,
int
FieldNumber
,
int
IsMulti
,
int
DrawMode
);
int
FieldNumber
,
bool
IsMulti
,
int
DrawMode
);
static
void
PlotNoConnectStruct
(
PLOTTER
*
plotter
,
SCH_NO_CONNECT
*
Struct
)
static
void
PlotNoConnectStruct
(
PLOTTER
*
plotter
,
SCH_NO_CONNECT
*
Struct
)
...
@@ -53,10 +53,10 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
...
@@ -53,10 +53,10 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
Entry
->
Plot
(
plotter
,
DrawLibItem
->
m_Multi
,
DrawLibItem
->
m_Convert
,
Entry
->
Plot
(
plotter
,
DrawLibItem
->
m_Multi
,
DrawLibItem
->
m_Convert
,
DrawLibItem
->
m_Pos
,
TransMat
);
DrawLibItem
->
m_Pos
,
TransMat
);
bool
isMulti
=
Entry
->
GetPartCount
()
>
1
;
for
(
int
i
=
0
;
i
<
NUMBER_OF_FIELDS
;
i
++
)
for
(
int
fieldId
=
0
;
fieldId
<
NUMBER_OF_FIELDS
;
fieldId
++
)
{
{
PlotTextField
(
plotter
,
DrawLibItem
,
i
,
0
,
0
);
PlotTextField
(
plotter
,
DrawLibItem
,
fieldId
,
isMulti
,
0
);
}
}
}
}
...
@@ -65,13 +65,13 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
...
@@ -65,13 +65,13 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
* Input:
* Input:
* DrawLibItem: pointer to the component
* DrawLibItem: pointer to the component
* FieldNumber: Number Field
* FieldNumber: Number Field
* IsMulti:
No Null flag if there are several sides by housing
.
* IsMulti:
true flag if there are several parts per package
.
* Only useful for the field to add a reference to this one
* Only useful for the field to add a reference to this one
* The identification from (A, B ...)
* The identification from (A, B ...)
* DrawMode: trace mode
* DrawMode: trace mode
*/
*/
static
void
PlotTextField
(
PLOTTER
*
plotter
,
SCH_COMPONENT
*
DrawLibItem
,
static
void
PlotTextField
(
PLOTTER
*
plotter
,
SCH_COMPONENT
*
DrawLibItem
,
int
FieldNumber
,
int
IsMulti
,
int
DrawMode
)
int
FieldNumber
,
bool
IsMulti
,
int
DrawMode
)
{
{
SCH_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
SCH_FIELD
*
field
=
DrawLibItem
->
GetField
(
FieldNumber
);
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
EDA_Colors
color
=
UNSPECIFIED_COLOR
;
...
...
pcbnew/dialog_netlist.cpp
View file @
3b658b4b
...
@@ -70,7 +70,7 @@ void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event )
...
@@ -70,7 +70,7 @@ void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event )
{
{
wxFileName
fn
=
lastNetlistRead
;
wxFileName
fn
=
lastNetlistRead
;
lastPath
=
fn
.
GetPath
();
lastPath
=
fn
.
GetPath
();
lastNetlistRead
=
fn
.
GetName
();
lastNetlistRead
=
fn
.
Get
Full
Name
();
}
}
wxLogDebug
(
wxT
(
"Last net list read path <%s>, file name <%s>."
),
wxLogDebug
(
wxT
(
"Last net list read path <%s>, file name <%s>."
),
...
...
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