KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gerber_to_polyset.cpp File Reference

Go to the source code of this file.

Functions

SHAPE_POLY_SET ConvertGerberToPolySet (GERBER_FILE_IMAGE *aImage, int aTolerance)
 Convert a GERBER_FILE_IMAGE to a merged SHAPE_POLY_SET.
 

Function Documentation

◆ ConvertGerberToPolySet()

SHAPE_POLY_SET ConvertGerberToPolySet ( GERBER_FILE_IMAGE * aImage,
int aTolerance = 0 )

Convert a GERBER_FILE_IMAGE to a merged SHAPE_POLY_SET.

All draw items in the Gerber image are converted to polygons and merged using boolean union. This handles step-and-repeat expansion.

Note: This function may populate cached polygon data in the draw items.

Parameters
aImageThe Gerber file image to convert
aToleranceOptional inflation tolerance in nm for comparison purposes
Returns
A merged SHAPE_POLY_SET containing all copper areas

Definition at line 27 of file gerber_to_polyset.cpp.

References SHAPE_POLY_SET::Append(), APT_RECT, ARC_LOW_DEF_MM, SHAPE_POLY_SET::BooleanSubtract(), SHAPE_POLY_SET::CHole(), D_CODE::ConvertShapeToPolygon(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, GBR_ARC, GBR_SEGMENT, gerbIUScale, GERBER_FILE_IMAGE::GetItems(), SHAPE_POLY_SET::HoleCount(), SHAPE_POLY_SET::Inflate(), D_CODE::m_ApertType, D_CODE::m_Polygon, SHAPE_POLY_SET::NewHole(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), ROUND_ALL_CORNERS, SHAPE_POLY_SET::Simplify(), and TransformOvalToPolygon().

Referenced by GERBER_FILE_IMAGE::CalculateCopperArea(), and GERBVIEW_JOBS_HANDLER::JobGerberDiff().