Gerbview: Fix 2 (minor) issues in aperture macro "moire". Add a .gbr test file for this aperture macro.
This commit is contained in:
parent
03da56a9b5
commit
9fdcba8229
|
@ -283,16 +283,23 @@ void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
||||||
wxPoint aCentre, int aRadius,
|
wxPoint aCentre, int aRadius,
|
||||||
int aCircleToSegmentsCount, int aWidth )
|
int aCircleToSegmentsCount, int aWidth )
|
||||||
{
|
{
|
||||||
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
// Compute the corners positions and creates the poly
|
||||||
|
|
||||||
// Compute the corners posituions and creates poly
|
|
||||||
wxPoint curr_point;
|
wxPoint curr_point;
|
||||||
int inner_radius = aRadius - ( aWidth / 2 );
|
int inner_radius = aRadius - ( aWidth / 2 );
|
||||||
int outer_radius = inner_radius + aWidth;
|
int outer_radius = inner_radius + aWidth;
|
||||||
|
|
||||||
|
if( inner_radius <= 0 )
|
||||||
|
{ //In this case, the ring is just a circle (no hole inside)
|
||||||
|
TransformCircleToPolygon( aCornerBuffer, aCentre, aRadius + ( aWidth / 2 ),
|
||||||
|
aCircleToSegmentsCount );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
aCornerBuffer.NewOutline();
|
aCornerBuffer.NewOutline();
|
||||||
|
|
||||||
// Draw the inner circle of the ring
|
// Draw the inner circle of the ring
|
||||||
|
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
||||||
|
|
||||||
for( int ii = 0; ii < 3600; ii += delta )
|
for( int ii = 0; ii < 3600; ii += delta )
|
||||||
{
|
{
|
||||||
curr_point.x = inner_radius;
|
curr_point.x = inner_radius;
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
* %AMMOIRE10*
|
* %AMMOIRE10*
|
||||||
* 6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
|
* 6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
|
||||||
* Example of instanciation:
|
* Example of instanciation:
|
||||||
* %ADD19THERM19*%
|
* %ADD19MOIRE10*%
|
||||||
*
|
*
|
||||||
* A simple definition, one parameter:
|
* A simple definition, one parameter:
|
||||||
* %AMCIRCLE*
|
* %AMCIRCLE*
|
||||||
|
|
|
@ -280,15 +280,25 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
|
||||||
// Draw circles:
|
// Draw circles:
|
||||||
wxPoint center = aParent->GetABPosition( curPos );
|
wxPoint center = aParent->GetABPosition( curPos );
|
||||||
// adjust outerDiam by this on each nested circle
|
// adjust outerDiam by this on each nested circle
|
||||||
int diamAdjust = (gap + penThickness); //*2; //Should we use * 2 ?
|
int diamAdjust = (gap + penThickness) * 2;
|
||||||
|
|
||||||
for( int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
|
for( int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
|
||||||
{
|
{
|
||||||
if( outerDiam <= 0 )
|
if( outerDiam <= 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Note: outerDiam is the outer diameter of the ring.
|
||||||
|
// the ring graphic diameter is (outerDiam - penThickness)
|
||||||
|
if( outerDiam <= penThickness )
|
||||||
|
{ // No room to draw a ring (no room for the hole):
|
||||||
|
// draw a circle instead (with no hole), with the right diameter
|
||||||
|
TransformCircleToPolygon( aShapeBuffer, center,
|
||||||
|
outerDiam / 2, seg_per_circle );
|
||||||
|
}
|
||||||
|
else
|
||||||
TransformRingToPolygon( aShapeBuffer, center,
|
TransformRingToPolygon( aShapeBuffer, center,
|
||||||
(outerDiam - penThickness) / 2, seg_per_circle, penThickness );
|
(outerDiam - penThickness) / 2,
|
||||||
|
seg_per_circle, penThickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the cross:
|
// Draw the cross:
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
G04 Verification of moire aperture macro *
|
||||||
|
%MOMM*%
|
||||||
|
%FSLAX23Y23*%
|
||||||
|
%OFA0.0000B0.0000*%
|
||||||
|
G90*
|
||||||
|
G04 parameters are
|
||||||
|
G04 1 X coordinate of center point, a decimal*
|
||||||
|
G04 2 Y coordinate of center point, a decimal*
|
||||||
|
G04 3 Outer diameter of outer concentric ring, a decimal >= 0*
|
||||||
|
G04 4 Ring thickness, a decimal >= 0*
|
||||||
|
G04 5 Gap between rings, a decimal >= 0*
|
||||||
|
G04 6 Maximum number of rings, an integer >= 0*
|
||||||
|
G04 7 Cross hair thickness, a decimal >= 0*
|
||||||
|
G04 8 Cross hair length, a decimal >= 0*
|
||||||
|
G04 9 Rotation angle of the moiré primitive*
|
||||||
|
%AMMOIRE*
|
||||||
|
6,0,0, 11.0,1.3,1.2,6, 0.2,14, 20*
|
||||||
|
%
|
||||||
|
G04 Outline*
|
||||||
|
%ADD10C,0.1*%
|
||||||
|
X0Y0D02*
|
||||||
|
G54D10*
|
||||||
|
X0Y0D01*
|
||||||
|
X40000D01*
|
||||||
|
Y40000D01*
|
||||||
|
X0D01*
|
||||||
|
Y0D01*
|
||||||
|
G04 Draw Moire *
|
||||||
|
%ADD10MOIRE*%
|
||||||
|
G54D10*
|
||||||
|
X20000Y20000D03*
|
||||||
|
M02*
|
Loading…
Reference in New Issue