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
370356b6
Commit
370356b6
authored
Nov 30, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preparing Gerbview enhancements.Add comments
parent
6396c2eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
77 deletions
+89
-77
class_am_param.cpp
gerbview/class_am_param.cpp
+5
-2
class_am_param.h
gerbview/class_am_param.h
+70
-70
class_aperture_macro.h
gerbview/class_aperture_macro.h
+14
-5
No files found.
gerbview/class_am_param.cpp
View file @
370356b6
...
...
@@ -61,6 +61,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
}
}
/**
* Function ReadParam
* Read one aperture macro parameter
...
...
@@ -76,6 +77,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
bool
AM_PARAM
::
ReadParam
(
char
*&
aText
)
{
bool
found
=
false
;
if
(
*
aText
==
'$'
)
// value defined later, in aperture description
{
++
aText
;
...
...
@@ -91,6 +93,7 @@ bool AM_PARAM::ReadParam( char*& aText )
// Skip extra characters and separator
while
(
*
aText
&&
(
*
aText
!=
','
)
&&
(
*
aText
!=
'*'
)
)
aText
++
;
if
(
*
aText
==
','
)
aText
++
;
...
...
gerbview/class_am_param.h
View file @
370356b6
...
...
@@ -31,74 +31,74 @@
#define _AM_PARAM_H_
/*
An aperture macro defines a complex shape and is a list of aperture primitives.
Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
Inside a given aperture primitive, a fixed list of parameters defines info
about the shape: size, thickness, number of vertex ...
Each parameter can be an immediate value or a defered value.
When value is defered, it is defined when the aperture macro is instancied by
an ADD macro command
Actual values of a par
meter can also be the result of an arithmetic operation.
Here is some examples:
An immediate value:
3.5
A deferend value:
$2 means: replace me by the second value given in the ADD command
Actual value as arithmetic calculation:
$2/2+1
Note also a defered parameter can be defined in aperture macro,
but outside aperture primitives. Example
%AMRECTHERM*
$4=$3/2* parameter $4 is half value of parameter $3
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
and $4 is defined inside the macro
Some examples of aperture macro definition
A simple definition, no parameters:
%AMMOIRE10*
6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
Example of instanciation:
%ADD19THERM19*%
A simple definition, one parameter:
%AMCIRCLE*
1,1,$1,0,0*
Example of instanciation:
%ADD11CIRCLE,.5*%
A definition, with parameters and arithmetic operations:
%AMVECTOR*
2,1,$1,0,0,$2+1,$3,-135*%
Example of instanciation:
%ADD12VECTOR,0.05X0X0*%
A more complicated aperture macro definition, with parameters and arihmetic operations:
%AMRNDREC*
0 this is a comment*
21,1,$1+$1,$2+$2-$3-$3,0,0,0*
21,1,$1+$1-$3-$3,$2+$2,0,0,0*
1,1,$3+$3,$1-$3,$2-$3*
1,1,$3+$3,$3-$1,$2-$3*
1,1,$3+$3,$1-$3,$3-$2*
1,1,$3+$3,$3-$1,$3-$2*%
Example of instanciation:
A more complicated sample of aperture macro definition:
G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
%AMRECTHERM*
$4=$3/2*
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
Example of instanciation:
%ADD28RECTHERM,0.035591X0.041496X0.005000*%
*/
*
An aperture macro defines a complex shape and is a list of aperture primitives.
*
Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
*
Inside a given aperture primitive, a fixed list of parameters defines info
*
about the shape: size, thickness, number of vertex ...
*
*
Each parameter can be an immediate value or a defered value.
*
When value is defered, it is defined when the aperture macro is instancied by
*
an ADD macro command
*
* Actual values of a para
meter can also be the result of an arithmetic operation.
*
*
Here is some examples:
*
An immediate value:
*
3.5
*
A deferend value:
*
$2 means: replace me by the second value given in the ADD command
*
Actual value as arithmetic calculation:
*
$2/2+1
*
*
Note also a defered parameter can be defined in aperture macro,
*
but outside aperture primitives. Example
*
%AMRECTHERM*
*
$4=$3/2* parameter $4 is half value of parameter $3
*
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
*
For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
*
and $4 is defined inside the macro
*
*
Some examples of aperture macro definition
*
A simple definition, no parameters:
*
%AMMOIRE10*
*
6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
*
Example of instanciation:
*
%ADD19THERM19*%
*
*
A simple definition, one parameter:
*
%AMCIRCLE*
*
1,1,$1,0,0*
*
Example of instanciation:
*
%ADD11CIRCLE,.5*%
*
*
A definition, with parameters and arithmetic operations:
*
%AMVECTOR*
*
2,1,$1,0,0,$2+1,$3,-135*%
*
Example of instanciation:
*
%ADD12VECTOR,0.05X0X0*%
*
*
A more complicated aperture macro definition, with parameters and arihmetic operations:
*
%AMRNDREC*
*
0 this is a comment*
*
21,1,$1+$1,$2+$2-$3-$3,0,0,0*
*
21,1,$1+$1-$3-$3,$2+$2,0,0,0*
*
1,1,$3+$3,$1-$3,$2-$3*
*
1,1,$3+$3,$3-$1,$2-$3*
*
1,1,$3+$3,$1-$3,$3-$2*
*
1,1,$3+$3,$3-$1,$3-$2*%
*
Example of instanciation:
*
*
A more complicated sample of aperture macro definition:
*
G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
*
%AMRECTHERM*
*
$4=$3/2*
*
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
*
21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
*
21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
*
21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
*
Example of instanciation:
*
%ADD28RECTHERM,0.035591X0.041496X0.005000*%
*/
#include <vector>
...
...
@@ -114,8 +114,7 @@ Example of instanciation:
*/
class
AM_PARAM
{
public
:
AM_PARAM
()
:
public
:
AM_PARAM
()
:
index
(
-
1
),
value
(
0
.
0
)
{}
...
...
@@ -147,6 +146,7 @@ public:
index
=
aIndex
;
}
/**
* Function ReadParam
* Read one aperture macro parameter
...
...
gerbview/class_aperture_macro.h
View file @
370356b6
...
...
@@ -36,6 +36,16 @@
#include "base_struct.h"
#include "class_am_param.h"
/*
* An aperture macro defines a complex shape and is a list of aperture primitives.
* Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
* Inside a given aperture primitive, a fixed list of parameters defines info
* about the shape: size, thickness, number of vertex ...
*
* Each parameter can be an immediate value or a defered value.
* When value is defered, it is defined when the aperture macro is instancied by
* an ADD macro command
*/
/**
* Enum AM_PRIMITIVE_ID
...
...
@@ -74,8 +84,7 @@ public:
bool
m_GerbMetric
;
// units for this primitive:
// false = Inches, true = metric
public
:
AM_PRIMITIVE
(
bool
aGerbMetric
,
AM_PRIMITIVE_ID
aId
=
AMP_UNKNOWN
)
public
:
AM_PRIMITIVE
(
bool
aGerbMetric
,
AM_PRIMITIVE_ID
aId
=
AMP_UNKNOWN
)
{
primitive_id
=
aId
;
m_GerbMetric
=
aGerbMetric
;
...
...
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