|
KiCad PCB EDA Suite
|
#include "allegro_builder.h"#include "allegro_db_utils.h"#include <cmath>#include <limits>#include <set>#include <tuple>#include <unordered_set>#include <convert/allegro_pcb_structs.h>#include <wx/log.h>#include <core/profile.h>#include <core/throttle.h>#include <base_units.h>#include <board_design_settings.h>#include <convert_basic_shapes_to_polygon.h>#include <geometry/shape_utils.h>#include <project/net_settings.h>#include <footprint.h>#include <netclass.h>#include <pad.h>#include <pcb_group.h>#include <pcb_text.h>#include <pcb_shape.h>#include <pcb_track.h>#include <priority_thread_pool_task.h>#include <zone.h>#include <zone_utils.h>Go to the source code of this file.
Classes | |
| struct | std::hash< LAYER_INFO > |
| class | ALLEGRO::LAYER_MAPPER |
| Class to handle the mapping for Allegro CLASS/SUBCLASS idiom to KiCad layers. More... | |
| struct | ALLEGRO::LAYER_MAPPER::CUSTOM_LAYER |
| Represents the information found in a single entry of a layer list. More... | |
| class | ALLEGRO::BOARD_BUILDER::ZONE_FILL_HANDLER |
| Filled zones have their own outline and the fill itself comes from a bunch of "related" spaces. More... | |
| struct | ALLEGRO::BOARD_BUILDER::ZONE_FILL_HANDLER::FILL_INFO |
| This is all the info needed to do the fill of one layer of one zone. More... | |
| class | ALLEGRO::BOARD_BUILDER::ZONE_FILL_HANDLER::COMPLEX_FIRST_FILL_TASK |
| Priority task dispatcher for zone fills - we want to do the biggest ones first. More... | |
Macros | |
| #define | BLK_FIELD(BLK_T, FIELD) |
Functions | |
| static uint32_t | PadGetNextInFootprint (const BLOCK_BASE &aBlock) |
| "Get Next" function for the pad list in a footprint's 0x32 list. | |
| static wxString | layerInfoDisplayName (const LAYER_INFO &aLayerInfo) |
| Build a unique display name for a LAYER_INFO entry from the static maps above, suitable for presentation in the layer mapping dialog. | |
| static bool | layerIsZone (const LAYER_INFO &aLayerInfo) |
| Some layers map to KiCad rule areas (zones) - for example a package keepout on ALL maps to a rule area in KiCad. | |
| static std::optional< LAYER_INFO > | tryLayerFromBlock (const BLOCK_BASE &aBlock) |
| Some blocks report layer info - if they do, return it else std::nullopt. | |
| LAYER_INFO | expectLayerFromBlock (const BLOCK_BASE &aBlock) |
| Get a layer from a block that has layer info. | |
| static int | clampForScale (double aValue) |
| static EDA_ANGLE | fromMillidegrees (uint32_t aMilliDegrees) |
| static std::unordered_set< LAYER_INFO > | ScanForLayers (const BRD_DB &aDb) |
| Look through some lists for a list of layers used. | |
| template<std::derived_from< BOARD_ITEM > T> | |
| void | BulkAddToBoard (BOARD &aBoard, std::vector< std::unique_ptr< T > > &&aItems) |
Variables | |
| static const wxChar *const | traceAllegroBuilder = wxT( "KICAD_ALLEGRO_BUILDER" ) |
| Flag to enable debug output of Allegro board construction. | |
| static const wxChar *const | traceAllegroPerf = wxT( "KICAD_ALLEGRO_PERF" ) |
| static const std::unordered_map< LAYER_INFO, PCB_LAYER_ID > | s_LayerKiMap |
| Map of the pre-set class:subclass pairs to standard layers. | |
| static const std::unordered_map< LAYER_INFO, wxString > | s_OptionalFixedMappings |
| Names for custom KiCad layers that correspond to pre-defined Allegro layers. | |
| #define BLK_FIELD | ( | BLK_T, | |
| FIELD ) |
Definition at line 72 of file allegro_builder.cpp.
Referenced by PadGetNextInFootprint().
| void BulkAddToBoard | ( | BOARD & | aBoard, |
| std::vector< std::unique_ptr< T > > && | aItems ) |
Definition at line 4054 of file allegro_builder.cpp.
References BOARD::Add(), BULK_APPEND, and BOARD::FinalizeBulkAdd().
Referenced by ALLEGRO::BOARD_BUILDER::createTables(), and ALLEGRO::BOARD_BUILDER::createZones().
|
static |
Definition at line 1064 of file allegro_builder.cpp.
References result.
Referenced by ALLEGRO::BOARD_BUILDER::scale(), ALLEGRO::BOARD_BUILDER::scale(), and ALLEGRO::BOARD_BUILDER::scaleSize().
| LAYER_INFO expectLayerFromBlock | ( | const BLOCK_BASE & | aBlock | ) |
Get a layer from a block that has layer info.
It's an error to request this from a block that doesn't support it.
Definition at line 442 of file allegro_builder.cpp.
References tryLayerFromBlock().
Referenced by ALLEGRO::BOARD_BUILDER::buildZone().
|
static |
Definition at line 1101 of file allegro_builder.cpp.
References DEGREES_T.
Referenced by ALLEGRO::BOARD_BUILDER::buildFootprint(), ALLEGRO::BOARD_BUILDER::buildOutline(), ALLEGRO::BOARD_BUILDER::buildOutline(), ALLEGRO::BOARD_BUILDER::buildPcbText(), ALLEGRO::BOARD_BUILDER::buildRect(), and ALLEGRO::BOARD_BUILDER::buildRect().
|
static |
Build a unique display name for a LAYER_INFO entry from the static maps above, suitable for presentation in the layer mapping dialog.
Refer to https://www.artwork.com/all2dxf/alleggeo.htm for layer orders.
Definition at line 193 of file allegro_builder.cpp.
References ALLEGRO::LAYER_INFO::ANALYSIS, ALLEGRO::LAYER_INFO::ANALYSIS_HIGH_ISOCONTOUR, ALLEGRO::LAYER_INFO::ANALYSIS_LOW_ISOCONTOUR, ALLEGRO::LAYER_INFO::ANALYSIS_MEDIUM1_ISOCONTOUR, ALLEGRO::LAYER_INFO::ANALYSIS_MEDIUM2_ISOCONTOUR, ALLEGRO::LAYER_INFO::ANALYSIS_MEDIUM3_ISOCONTOUR, ALLEGRO::LAYER_INFO::ANALYSIS_PCB_TEMPERATURE, ALLEGRO::LAYER_INFO::ANTI_ETCH, ALLEGRO::LAYER_INFO::ASSEMBLY_BOTTOM, ALLEGRO::LAYER_INFO::ASSEMBLY_TOP, ALLEGRO::LAYER_INFO::BGEOM_ASSEMBLY_DETAIL, ALLEGRO::LAYER_INFO::BGEOM_ASSEMBLY_NOTES, ALLEGRO::LAYER_INFO::BGEOM_BOTH_ROOMS, ALLEGRO::LAYER_INFO::BGEOM_BOTTOM_ROOM, ALLEGRO::LAYER_INFO::BGEOM_CONSTRAINT_AREA, ALLEGRO::LAYER_INFO::BGEOM_DESIGN_OUTLINE, ALLEGRO::LAYER_INFO::BGEOM_DIMENSION, ALLEGRO::LAYER_INFO::BGEOM_OFF_GRID_AREA, ALLEGRO::LAYER_INFO::BGEOM_OUTLINE, ALLEGRO::LAYER_INFO::BGEOM_PLACE_GRID_BOTTOM, ALLEGRO::LAYER_INFO::BGEOM_PLACE_GRID_TOP, ALLEGRO::LAYER_INFO::BGEOM_PLATING_BAR, ALLEGRO::LAYER_INFO::BGEOM_SILKSCREEN_BOTTOM, ALLEGRO::LAYER_INFO::BGEOM_SILKSCREEN_TOP, ALLEGRO::LAYER_INFO::BGEOM_SOLDERMASK_BOTTOM, ALLEGRO::LAYER_INFO::BGEOM_SOLDERMASK_TOP, ALLEGRO::LAYER_INFO::BGEOM_SWITCH_AREA_BOTTOM, ALLEGRO::LAYER_INFO::BGEOM_SWITCH_AREA_TOP, ALLEGRO::LAYER_INFO::BGEOM_TOOLING_CORNERS, ALLEGRO::LAYER_INFO::BGEOM_TOP_ROOM, ALLEGRO::LAYER_INFO::BOARD_GEOMETRY, ALLEGRO::LAYER_INFO::BOUNDARY, ALLEGRO::LAYER_INFO::COMPONENT_VALUE, ALLEGRO::LAYER_INFO::CONSTRAINTS_REGION, ALLEGRO::LAYER_INFO::CREG_ALL, ALLEGRO::LAYER_INFO::DEVICE_TYPE, ALLEGRO::LAYER_INFO::DFMT_OUTLINE, ALLEGRO::LAYER_INFO::DFMT_REVISION_BLOCK, ALLEGRO::LAYER_INFO::DFMT_REVISION_DATA, ALLEGRO::LAYER_INFO::DFMT_TITLE_BLOCK, ALLEGRO::LAYER_INFO::DFMT_TITLE_DATA, ALLEGRO::LAYER_INFO::DISPLAY_BOTTOM, ALLEGRO::LAYER_INFO::DISPLAY_TOP, ALLEGRO::LAYER_INFO::DRAWING_FORMAT, ALLEGRO::LAYER_INFO::ETCH, ALLEGRO::LAYER_INFO::KEEPIN_ALL, ALLEGRO::LAYER_INFO::KEEPOUT_ALL, ALLEGRO::LAYER_INFO::KEEPOUT_BOTTOM, ALLEGRO::LAYER_INFO::KEEPOUT_TOP, ALLEGRO::LAYER_INFO::m_Class, ALLEGRO::LAYER_INFO::m_Subclass, ALLEGRO::LAYER_INFO::MANUFACTURING, ALLEGRO::LAYER_INFO::MFR_AUTOSILK_BOTTOM, ALLEGRO::LAYER_INFO::MFR_AUTOSILK_TOP, ALLEGRO::LAYER_INFO::MFR_NCDRILL_FIGURE, ALLEGRO::LAYER_INFO::MFR_NCDRILL_LEGEND, ALLEGRO::LAYER_INFO::MFR_NO_GLOSS_ALL, ALLEGRO::LAYER_INFO::MFR_NO_GLOSS_BOTTOM, ALLEGRO::LAYER_INFO::MFR_NO_GLOSS_INTERNAL, ALLEGRO::LAYER_INFO::MFR_NO_GLOSS_TOP, ALLEGRO::LAYER_INFO::MFR_NO_PROBE_BOTTOM, ALLEGRO::LAYER_INFO::MFR_NO_PROBE_TOP, ALLEGRO::LAYER_INFO::MFR_PHOTOPLOT_OUTLINE, ALLEGRO::LAYER_INFO::MFR_PROBE_BOTTOM, ALLEGRO::LAYER_INFO::MFR_PROBE_TOP, ALLEGRO::LAYER_INFO::MFR_XSECTION_CHART, ALLEGRO::LAYER_INFO::PACKAGE_GEOMETRY, ALLEGRO::LAYER_INFO::PACKAGE_KEEPIN, ALLEGRO::LAYER_INFO::PACKAGE_KEEPOUT, ALLEGRO::LAYER_INFO::PGEOM_ASSEMBLY_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_ASSEMBLY_TOP, ALLEGRO::LAYER_INFO::PGEOM_BODY_CENTER, ALLEGRO::LAYER_INFO::PGEOM_DFA_BOUND_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_DFA_BOUND_TOP, ALLEGRO::LAYER_INFO::PGEOM_DISPLAY_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_DISPLAY_TOP, ALLEGRO::LAYER_INFO::PGEOM_PAD_STACK_NAME, ALLEGRO::LAYER_INFO::PGEOM_PASTEMASK_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_PASTEMASK_TOP, ALLEGRO::LAYER_INFO::PGEOM_PIN_NUMBER, ALLEGRO::LAYER_INFO::PGEOM_PLACE_BOUND_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_PLACE_BOUND_TOP, ALLEGRO::LAYER_INFO::PGEOM_SILKSCREEN_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_SILKSCREEN_TOP, ALLEGRO::LAYER_INFO::PGEOM_SOLDERMASK_BOTTOM, ALLEGRO::LAYER_INFO::PGEOM_SOLDERMASK_TOP, ALLEGRO::LAYER_INFO::PIN, ALLEGRO::LAYER_INFO::REF_DES, ALLEGRO::LAYER_INFO::ROUTE_KEEPIN, ALLEGRO::LAYER_INFO::ROUTE_KEEPOUT, ALLEGRO::LAYER_INFO::SILKSCREEN_BOTTOM, ALLEGRO::LAYER_INFO::SILKSCREEN_TOP, ALLEGRO::LAYER_INFO::TOLERANCE, ALLEGRO::LAYER_INFO::USER_PART_NUMBER, ALLEGRO::LAYER_INFO::VIA_CLASS, and ALLEGRO::LAYER_INFO::VIA_KEEPOUT.
Referenced by ALLEGRO::BOARD_BUILDER::createZones(), ALLEGRO::LAYER_MAPPER::FinalizeLayers(), and ALLEGRO::BOARD_BUILDER::setupLayers().
|
static |
Some layers map to KiCad rule areas (zones) - for example a package keepout on ALL maps to a rule area in KiCad.
Keepins are bit trickier, but they're still rule areas and might need custom DRC rules.
In Allegro, zone-y/shape-y is distinguished by class/subclass rather than object type.
Definition at line 389 of file allegro_builder.cpp.
References ALLEGRO::LAYER_INFO::BOUNDARY, ALLEGRO::LAYER_INFO::CONSTRAINTS_REGION, ALLEGRO::LAYER_INFO::m_Class, ALLEGRO::LAYER_INFO::PACKAGE_KEEPIN, ALLEGRO::LAYER_INFO::PACKAGE_KEEPOUT, ALLEGRO::LAYER_INFO::ROUTE_KEEPIN, ALLEGRO::LAYER_INFO::ROUTE_KEEPOUT, and ALLEGRO::LAYER_INFO::VIA_KEEPOUT.
Referenced by ALLEGRO::BOARD_BUILDER::buildFootprint(), ALLEGRO::BOARD_BUILDER::createBoardShapes(), and ALLEGRO::BOARD_BUILDER::createZones().
|
static |
"Get Next" function for the pad list in a footprint's 0x32 list.
Definition at line 78 of file allegro_builder.cpp.
References BLK_FIELD, ALLEGRO::BLOCK_BASE::GetBlockType(), ALLEGRO::BLOCK_BASE::GetKey(), ALLEGRO::BLOCK_BASE::GetOffset(), and THROW_IO_ERROR.
Referenced by ALLEGRO::BOARD_BUILDER::buildFootprint().
|
static |
Look through some lists for a list of layers used.
This isn't yet exhaustive, not sure if it needs to be. We could scan every single block if we wanted, but that would be a lot of blocks without layers. So walking lists seems more efficient.
The primary goal is to look for colliding layers like OUTLINE/DESIGN_OUTLINE so that we can remap one of them to something else.
We could also use this to find all the used layers and present them in the mapping dialog rather than auto-creating them layer during buildout.
Definition at line 1678 of file allegro_builder.cpp.
References info, ALLEGRO::BRD_DB::m_Header, and tryLayerFromBlock().
Referenced by ALLEGRO::BOARD_BUILDER::setupLayers().
|
static |
Some blocks report layer info - if they do, return it else std::nullopt.
Definition at line 407 of file allegro_builder.cpp.
References ALLEGRO::BlockDataAs(), and ALLEGRO::BLOCK_BASE::GetBlockType().
Referenced by ALLEGRO::BOARD_BUILDER::buildFootprint(), expectLayerFromBlock(), and ScanForLayers().
|
static |
Map of the pre-set class:subclass pairs to standard layers.
Allegro doesn't really have a neat mapping onto KiCad layers. In theory, we could use the Films to map things that actually end up on the silkscreen layer (films can pick things out by class:subclass), but that would be quite fiddly and would fail if the films weren't configured right.
Definition at line 112 of file allegro_builder.cpp.
Referenced by ALLEGRO::LAYER_MAPPER::FinalizeLayers(), and ALLEGRO::LAYER_MAPPER::GetLayer().
|
static |
Names for custom KiCad layers that correspond to pre-defined Allegro layers.
Multiple class:subclasses can share a layer name, in which case, they will share a layer.
This is a balance between running out of layers and dumping too much unrelated stuff on the same layer.
Definition at line 152 of file allegro_builder.cpp.
Referenced by ALLEGRO::LAYER_MAPPER::GetLayer().
|
static |
Definition at line 69 of file allegro_builder.cpp.