KiCad PCB EDA Suite
Loading...
Searching...
No Matches
am_primitive.h
Go to the documentation of this file.
1
4
5#ifndef AM_PRIMITIVE_H
6#define AM_PRIMITIVE_H
7
8/*
9 * This program source code file is part of KiCad, a free EDA CAD application.
10 *
11 * Copyright (C) 1992-2010 Jean-Pierre Charras <jp.charras at wanadoo.fr>
12 * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
13 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
29#include <vector>
30#include <set>
31
32#include <am_param.h>
33
34class SHAPE_POLY_SET;
35
36/*
37 * An aperture macro defines a complex shape and is a list of aperture primitives.
38 * Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
39 * Inside a given aperture primitive, a fixed list of parameters defines info
40 * about the shape: size, thickness, number of vertex ...
41 *
42 * Each parameter can be an immediate value or a deferred value.
43 * When value is deferred, it is defined when the aperture macro is instanced by
44 * an ADD macro command
45 * Note also a deferred parameter can be defined in aperture macro,
46 * but outside aperture primitives. Example
47 * %AMRECTHERM*
48 * $4=$3/2* parameter $4 is half value of parameter $3
49 * 21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
50 * For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
51 * and $4 is defined inside the macro
52 *
53 * Each basic shape can be a positive shape or a negative shape.
54 * a negative shape is "local" to the whole shape.
55 * It must be seen like a hole in the shape, and not like a standard negative object.
56 */
57
66 AMP_UNKNOWN = -1, // A value for uninitialized AM_PRIMITIVE.
67 AMP_COMMENT = 0, // A primitive description is not really a primitive, this is a
68 // comment
69 AMP_CIRCLE = 1, // Circle. (diameter and position)
70 AMP_LINE2 = 2, // Line with rectangle ends. (Width, start and end pos + rotation)
71 AMP_LINE20 = 20, // Same as AMP_LINE2
72 AMP_LINE_CENTER = 21, // Rectangle. (height, width and center pos + rotation)
73 AMP_LINE_LOWER_LEFT = 22, // Rectangle. (height, width and left bottom corner pos + rotation)
74 AMP_OUTLINE = 4, // Free polyline (n corners + rotation)
75 AMP_POLYGON = 5, // Closed regular polygon(diameter, number of vertices (3 to 10),
76 // rotation)
77 AMP_MOIRE = 6, // A cross hair with n concentric circles + rotation (deprecated in 2021)
78 AMP_THERMAL = 7 // Thermal shape (pos, outer and inner diameter, cross hair
79 // thickness + rotation)
80};
81
82
88{
89public:
92 bool m_GerbMetric; // units for this primitive:
93 // false = Inches, true = metric
94 int m_LocalParamLevel; // count of local param defined inside a aperture macro
95 // local param stack when this primitive is put in
96 // aperture macro primitive stack list
97 // not used outside a aperture macro
98
99 AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
100 {
101 m_Primitive_id = aId;
102 m_GerbMetric = aGerbMetric;
104 }
105
106
108
116 bool IsAMPrimitiveExposureOn( APERTURE_MACRO* aApertMacro ) const;
117
125#if 0
126 void ConvertBasicShapeToPolygon( const D_CODE* aDcode,
127 SHAPE_POLY_SET& aShapeBuffer );
128#endif
130 SHAPE_POLY_SET& aShapeBuffer );
131
132private:
143 //void ConvertShapeToPolygon( const D_CODE* aDcode, std::vector<VECTOR2I>& aBuffer );
144 void ConvertShapeToPolygon( APERTURE_MACRO* aApertMacroe, std::vector<VECTOR2I>& aBuffer );
145};
146
147
148#endif // ifndef AM_PRIMITIVE_H
std::vector< AM_PARAM > AM_PARAMS
Definition am_param.h:347
AM_PRIMITIVE_ID
The set of all "aperture macro primitives" (primitive numbers).
@ AMP_POLYGON
@ AMP_LINE_LOWER_LEFT
@ AMP_LINE2
@ AMP_CIRCLE
@ AMP_THERMAL
@ AMP_UNKNOWN
@ AMP_COMMENT
@ AMP_LINE_CENTER
@ AMP_MOIRE
@ AMP_OUTLINE
@ AMP_LINE20
void ConvertBasicShapeToPolygon(APERTURE_MACRO *aApertMacro, SHAPE_POLY_SET &aShapeBuffer)
Generate the polygonal shape of the primitive shape of an aperture macro instance.
bool IsAMPrimitiveExposureOn(APERTURE_MACRO *aApertMacro) const
void ConvertShapeToPolygon(APERTURE_MACRO *aApertMacroe, std::vector< VECTOR2I > &aBuffer)
Convert a shape to an equivalent polygon.
AM_PARAMS m_Params
A sequence of parameters used by the primitive.
AM_PRIMITIVE_ID m_Primitive_id
The primitive type.
int m_LocalParamLevel
AM_PRIMITIVE(bool aGerbMetric, AM_PRIMITIVE_ID aId=AMP_UNKNOWN)
Support the "aperture macro" defined within standard RS274X.
A gerber DCODE (also called Aperture) definition.
Definition dcode.h:76
Represent a set of closed polygons.