KiCad PCB EDA Suite
Loading...
Searching...
No Matches
AM_PRIMITIVE Class Reference

An aperture macro primitive as given in gerber layer format doc. More...

#include <am_primitive.h>

Public Member Functions

 AM_PRIMITIVE (bool aGerbMetric, AM_PRIMITIVE_ID aId=AMP_UNKNOWN)
 
 ~AM_PRIMITIVE ()
 
bool IsAMPrimitiveExposureOn (APERTURE_MACRO *aApertMacro) const
 
void ConvertBasicShapeToPolygon (APERTURE_MACRO *aApertMacro, SHAPE_POLY_SET &aShapeBuffer)
 Generate the polygonal shape of the primitive shape of an aperture macro instance.
 

Public Attributes

AM_PRIMITIVE_ID m_Primitive_id
 The primitive type.
 
AM_PARAMS m_Params
 A sequence of parameters used by the primitive.
 
bool m_GerbMetric
 
int m_LocalParamLevel
 

Private Member Functions

void ConvertShapeToPolygon (APERTURE_MACRO *aApertMacroe, std::vector< VECTOR2I > &aBuffer)
 Convert a shape to an equivalent polygon.
 

Detailed Description

An aperture macro primitive as given in gerber layer format doc.

See https://www.ucamco.com/en/news/gerber-layer-format-specification-revision-????

Definition at line 91 of file am_primitive.h.

Constructor & Destructor Documentation

◆ AM_PRIMITIVE()

AM_PRIMITIVE::AM_PRIMITIVE ( bool  aGerbMetric,
AM_PRIMITIVE_ID  aId = AMP_UNKNOWN 
)
inline

Definition at line 103 of file am_primitive.h.

References m_GerbMetric, m_LocalParamLevel, and m_Primitive_id.

◆ ~AM_PRIMITIVE()

AM_PRIMITIVE::~AM_PRIMITIVE ( )
inline

Definition at line 111 of file am_primitive.h.

Member Function Documentation

◆ ConvertBasicShapeToPolygon()

void AM_PRIMITIVE::ConvertBasicShapeToPolygon ( APERTURE_MACRO aApertMacro,
SHAPE_POLY_SET aShapeBuffer 
)

◆ ConvertShapeToPolygon()

void AM_PRIMITIVE::ConvertShapeToPolygon ( APERTURE_MACRO aApertMacroe,
std::vector< VECTOR2I > &  aBuffer 
)
private

Convert a shape to an equivalent polygon.

Arcs and circles are approximated by segments. Useful when a shape is not a graphic primitive (shape with hole, rotated shape ... ) and cannot be easily drawn.

Note
Some schapes conbining circles and solid lines (rectangles), only rectangles are converted because circles are very easy to draw (no rotation problem) so convert them in polygons and draw them as polygons is not a good idea.

Definition at line 415 of file am_primitive.cpp.

References AMP_CIRCLE, AMP_COMMENT, AMP_LINE2, AMP_LINE20, AMP_LINE_CENTER, AMP_LINE_LOWER_LEFT, AMP_MOIRE, AMP_OUTLINE, AMP_POLYGON, AMP_THERMAL, AMP_UNKNOWN, ANGLE_0, ANGLE_360, ANGLE_90, DEGREES_T, delta, KiROUND(), m_GerbMetric, m_Params, m_Primitive_id, mapPt(), RADIANS_T, RotatePoint(), scaletoIU(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ConvertBasicShapeToPolygon().

◆ IsAMPrimitiveExposureOn()

bool AM_PRIMITIVE::IsAMPrimitiveExposureOn ( APERTURE_MACRO aApertMacro) const
Returns
true if the first parameter is not 0 (it can be only 0 or 1). Some but not all primitives use the first parameter as an exposure control. Others are always ON. In a aperture macro shape, a basic primitive with exposure off is a hole in the shape it is NOT a negative shape

Definition at line 58 of file am_primitive.cpp.

References AMP_CIRCLE, AMP_LINE2, AMP_LINE20, AMP_LINE_CENTER, AMP_LINE_LOWER_LEFT, AMP_MOIRE, AMP_OUTLINE, AMP_POLYGON, AMP_THERMAL, AMP_UNKNOWN, m_Params, and m_Primitive_id.

Member Data Documentation

◆ m_GerbMetric

bool AM_PRIMITIVE::m_GerbMetric

Definition at line 96 of file am_primitive.h.

Referenced by AM_PRIMITIVE(), ConvertBasicShapeToPolygon(), and ConvertShapeToPolygon().

◆ m_LocalParamLevel

int AM_PRIMITIVE::m_LocalParamLevel

Definition at line 98 of file am_primitive.h.

Referenced by AM_PRIMITIVE(), and APERTURE_MACRO::EvalLocalParams().

◆ m_Params

AM_PARAMS AM_PRIMITIVE::m_Params

A sequence of parameters used by the primitive.

Definition at line 95 of file am_primitive.h.

Referenced by ConvertBasicShapeToPolygon(), ConvertShapeToPolygon(), IsAMPrimitiveExposureOn(), and GERBER_FILE_IMAGE::ReadApertureMacro().

◆ m_Primitive_id

AM_PRIMITIVE_ID AM_PRIMITIVE::m_Primitive_id

The documentation for this class was generated from the following files: