KiCad PCB EDA Suite
cadstar_pcb_archive_loader.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2021 Roberto Fernandez Bautista <[email protected]>
5 * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef CADSTAR_PCB_ARCHIVE_LOADER_H_
27#define CADSTAR_PCB_ARCHIVE_LOADER_H_
28
31#include <board.h>
32#include <footprint.h>
33#include <set>
34
35class BOARD;
38
40{
41public:
42 explicit CADSTAR_PCB_ARCHIVE_LOADER( wxString aFilename,
43 LAYER_MAPPING_HANDLER aLayerMappingHandler,
44 bool aLogLayerWarnings,
45 PROGRESS_REPORTER* aProgressReporter )
46 : CADSTAR_PCB_ARCHIVE_PARSER( aFilename )
47 {
48 m_layerMappingHandler = aLayerMappingHandler;
49 m_logLayerWarnings = aLogLayerWarnings;
50 m_board = nullptr;
51 m_project = nullptr;
52 m_designCenter.x = 0;
53 m_designCenter.y = 0;
54 m_doneCopperWarning = false;
58 m_numNets = 0;
60 m_progressReporter = aProgressReporter;
61 }
62
63
65 {
66 for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem : m_libraryMap )
67 {
68 FOOTPRINT* footprint = libItem.second;
69
70 if( footprint )
71 delete footprint;
72 }
73 }
74
79 void Load( BOARD* aBoard, PROJECT* aProject );
80
85 std::vector<FOOTPRINT*> GetLoadedLibraryFootpints() const;
86
87private:
92 std::map<LAYER_ID, PCB_LAYER_ID> m_layermap;
94 std::map<SYMDEF_ID, FOOTPRINT*> m_libraryMap;
98 std::map<GROUP_ID, PCB_GROUP*> m_groupMap;
102 std::map<COMPONENT_ID, FOOTPRINT*> m_componentMap;
106
111 using ASSOCIATED_COPPER_PADS = std::map<PAD_ID, std::vector<PAD_ID>>;
112
116 std::map<SYMDEF_ID, ASSOCIATED_COPPER_PADS> m_librarycopperpads;
117
118 std::map<NET_ID, NETINFO_ITEM*> m_netMap;
119 std::map<std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID>, std::shared_ptr<NETCLASS>>
121 std::map<TEMPLATE_ID, ZONE*> m_zonesMap;
122 std::vector<LAYER_ID> m_powerPlaneLayers;
128 std::set<HATCHCODE_ID> m_hatchcodesTested;
130 std::set<PADCODE_ID> m_padcodesTested;
141
142
143 // Functions for loading individual elements:
144 void loadBoardStackup();
145 void remapUnsureLayers();
146 void loadDesignRules();
148 void loadGroups();
149 void loadBoards();
150 void loadFigures();
151 void loadTexts();
152 void loadDimensions();
153 void loadAreas();
154 void loadComponents();
156 void loadTemplates();
157 void loadCoppers();
158 void loadNets();
159 void loadTextVariables();
160
161 // Helper functions for element loading:
162 void logBoardStackupWarning( const wxString& aCadstarLayerName,
163 const PCB_LAYER_ID& aKiCadLayer );
164 void logBoardStackupMessage( const wxString& aCadstarLayerName,
165 const PCB_LAYER_ID& aKiCadLayer );
166 void initStackupItem( const LAYER& aCadstarLayer, BOARD_STACKUP_ITEM* aKiCadItem,
167 int aDielectricSublayer );
168 void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
169 void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
170 void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
171 void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
172 void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint );
173 void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute,
174 long aStartWidth = std::numeric_limits<long>::max(),
175 long aEndWidth = std::numeric_limits<long>::max() );
176
178 int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
179 void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
180 void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim );
181
182
187
188 //Helper functions for drawing /loading objects onto screen:
189
202 void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
203 const GROUP_ID& aCadstarGroupID = wxEmptyString,
204 const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
205 const VECTOR2I& aMoveVector = { 0, 0 },
206 const double& aRotationAngle = 0.0,
207 const double& aScalingFactor = 1.0,
208 const VECTOR2I& aTransformCentre = { 0, 0 },
209 const bool& aMirrorInvert = false );
210
225 void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
226 const int& aLineThickness, const wxString& aShapeName,
227 BOARD_ITEM_CONTAINER* aContainer,
228 const GROUP_ID& aCadstarGroupID = wxEmptyString,
229 const VECTOR2I& aMoveVector = { 0, 0 },
230 const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0,
231 const VECTOR2I& aTransformCentre = { 0, 0 },
232 const bool& aMirrorInvert = false );
233
247 void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
248 const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
249 BOARD_ITEM_CONTAINER* aContainer,
250 const GROUP_ID& aCadstarGroupID = wxEmptyString,
251 const VECTOR2I& aMoveVector = { 0, 0 },
252 const double& aRotationAngle = 0.0,
253 const double& aScalingFactor = 1.0,
254 const VECTOR2I& aTransformCentre = { 0, 0 },
255 const bool& aMirrorInvert = false );
256
271 void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
272 const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
273 BOARD_ITEM_CONTAINER* aContainer,
274 const GROUP_ID& aCadstarGroupID = wxEmptyString,
275 const VECTOR2I& aMoveVector = { 0, 0 },
276 const double& aRotationAngle = 0.0,
277 const double& aScalingFactor = 1.0,
278 const VECTOR2I& aTransformCentre = { 0, 0 },
279 const bool& aMirrorInvert = false );
280
293 std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
294 BOARD_ITEM_CONTAINER* aContainer = nullptr,
295 const GROUP_ID& aCadstarGroupID = wxEmptyString,
296 const VECTOR2I& aMoveVector = { 0, 0 },
297 const double& aRotationAngle = 0.0,
298 const double& aScalingFactor = 1.0,
299 const VECTOR2I& aTransformCentre = { 0, 0 },
300 const bool& aMirrorInvert = false );
301
315 PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
316 const VERTEX& aCadstarVertex,
317 BOARD_ITEM_CONTAINER* aContainer = nullptr,
318 const GROUP_ID& aCadstarGroupID = wxEmptyString,
319 const VECTOR2I& aMoveVector = { 0, 0 },
320 const double& aRotationAngle = 0.0,
321 const double& aScalingFactor = 1.0,
322 const VECTOR2I& aTransformCentre = { 0, 0 },
323 const bool& aMirrorInvert = false );
324
332 ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness,
333 BOARD_ITEM_CONTAINER* aParentContainer );
334
347 SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape,
348 const int& aLineThickness = -1,
349 BOARD_ITEM_CONTAINER* aContainer = nullptr,
350 const VECTOR2I& aMoveVector = { 0, 0 },
351 const double& aRotationAngle = 0.0,
352 const double& aScalingFactor = 1.0,
353 const VECTOR2I& aTransformCentre = { 0, 0 },
354 const bool& aMirrorInvert = false );
355
361 SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*> aShapes );
362
375 std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*> aShapes,
376 BOARD_ITEM_CONTAINER* aParentContainer,
377 NETINFO_ITEM* aNet = nullptr,
378 PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
379 int aWidthOverride = -1 );
380
388 void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
389 const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint,
390 const wxString& aAttributeValue );
391
400 void applyRouteOffset( VECTOR2I* aPointToOffset, const VECTOR2I& aRefPoint,
401 const long& aOffsetAmount );
402
406 void applyTextCode( EDA_TEXT* aKiCadText, const TEXTCODE_ID& aCadstarTextCodeID );
407
408 //Helper Functions for obtaining CADSTAR elements in the parsed structures
409 int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
410 COPPERCODE getCopperCode( const COPPERCODE_ID& aCadstaCopperCodeID );
411 HATCHCODE getHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
412 LAYERPAIR getLayerPair( const LAYERPAIR_ID& aCadstarLayerPairID );
413 PADCODE getPadCode( const PADCODE_ID& aCadstarPadCodeID );
414 PART getPart( const PART_ID& aCadstarPartID );
415 ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
416 TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
417 VIACODE getViaCode( const VIACODE_ID& aCadstarViaCodeID );
418 wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
419 wxString getAttributeValue( const ATTRIBUTE_ID& aCadstarAttributeID,
420 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
421 LAYER_TYPE getLayerType( const LAYER_ID aCadstarLayerID );
422
423 // Helper Functions for obtaining individual elements as KiCad elements:
424 EDA_ANGLE getHatchCodeAngle( const HATCHCODE_ID& aCadstarHatchcodeID );
425 PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent );
426 PAD*& getPadReference( FOOTPRINT* aFootprint, const PAD_ID aCadstarPadID );
427 FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID );
428 int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID );
429 int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID );
430 PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID );
431
437 VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
438
444 int getKiCadLength( long long aCadstarLength )
445 {
446 return aCadstarLength * KiCadUnitMultiplier;
447 }
448
454 double getAngleTenthDegree( const long long& aCadstarAngle )
455 {
456 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
457 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
458 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
459 if( Header.Format.Version > 8 )
460 {
461 return (double) aCadstarAngle / 100.0;
462 }
463 else
464 {
465 return (double) aCadstarAngle;
466 }
467 }
468
474 EDA_ANGLE getAngle( const long long& aCadstarAngle )
475 {
476 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
477 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
478 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
479 if( Header.Format.Version > 8 )
480 {
481 return EDA_ANGLE( aCadstarAngle / 1000.0, DEGREES_T );
482 }
483 else
484 {
485 return EDA_ANGLE( (int) aCadstarAngle, TENTHS_OF_A_DEGREE_T );
486 }
487 }
488
494 double getAngleDegrees( const long long& aCadstarAngle )
495 {
496 return getAngleTenthDegree( aCadstarAngle ) / 10.0;
497 }
498
505 NETINFO_ITEM* getKiCadNet( const NET_ID& aCadstarNetID );
506
513 PCB_LAYER_ID getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer = true );
514
520 bool isLayerSet( const LAYER_ID& aCadstarLayerID );
521
527 PCB_LAYER_ID getKiCadLayer( const LAYER_ID& aCadstarLayerID );
528
534 LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID );
535
536
538 {
539 return aContainer && aContainer->Type() == PCB_FOOTPRINT_T;
540 }
541
542
543 void addToGroup( const GROUP_ID& aCadstarGroupID, BOARD_ITEM* aKiCadItem );
544
551 GROUP_ID createUniqueGroupID( const wxString& aName );
552};
553
554
555#endif // CADSTAR_PCB_ARCHIVE_LOADER_H_
Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format based on S-expressions.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
Manage one layer needed to make a physical board.
Definition: board_stackup.h:91
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:269
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
PROGRESS_REPORTER * m_progressReporter
PCB_SHAPE * getShapeFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
std::map< TEMPLATE_ID, ZONE * > m_zonesMap
Map between Cadstar and KiCad zones.
std::map< std::tuple< ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID >, std::shared_ptr< NETCLASS > > m_netClassMap
Map between Cadstar and KiCad classes.
CADSTAR_PCB_ARCHIVE_LOADER(wxString aFilename, LAYER_MAPPING_HANDLER aLayerMappingHandler, bool aLogLayerWarnings, PROGRESS_REPORTER *aProgressReporter)
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
int getKiCadLength(long long aCadstarLength)
void initStackupItem(const LAYER &aCadstarLayer, BOARD_STACKUP_ITEM *aKiCadItem, int aDielectricSublayer)
int m_numCopperLayers
Number of layers in the design.
std::vector< LAYER_ID > m_powerPlaneLayers
List of layers that are marked as power plane in CADSTAR.
bool isLayerSet(const LAYER_ID &aCadstarLayerID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
void drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, const wxString &aShapeName, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
FOOTPRINT * getFootprintFromCadstarID(const COMPONENT_ID &aCadstarComponentID)
PADCODE getPadCode(const PADCODE_ID &aCadstarPadCodeID)
int loadNetVia(const NET_ID &aCadstarNetID, const NET_PCB::VIA &aCadstarVia)
Load via and return via size.
EDA_ANGLE getAngle(const long long &aCadstarAngle)
void applyTextCode(EDA_TEXT *aKiCadText, const TEXTCODE_ID &aCadstarTextCodeID)
Apply cadstar textcode parameters to a KiCad text object.
std::map< COMPONENT_ID, FOOTPRINT * > m_componentMap
Map between Cadstar and KiCad components on the board.
void applyDimensionSettings(const DIMENSION &aCadstarDim, PCB_DIMENSION_BASE *aKiCadDim)
void drawCadstarVerticesAsShapes(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
void loadNetTracks(const NET_ID &aCadstarNetID, const NET_PCB::ROUTE &aCadstarRoute, long aStartWidth=std::numeric_limits< long >::max(), long aEndWidth=std::numeric_limits< long >::max())
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
VIACODE getViaCode(const VIACODE_ID &aCadstarViaCodeID)
VECTOR2I m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
void Load(BOARD *aBoard, PROJECT *aProject)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
void logBoardStackupWarning(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
std::vector< FOOTPRINT * > GetLoadedLibraryFootpints() const
Return a copy of the loaded library footprints (caller owns the objects)
void checkAndLogHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
bool m_doneSpacingClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
int m_numNets
Number of nets loaded so far.
void loadLibraryPads(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
PAD * getKiCadPad(const COMPONENT_PAD &aCadstarPad, FOOTPRINT *aParent)
void drawCadstarCutoutsAsShapes(const std::vector< CUTOUT > &aCutouts, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPEs to draw the cutouts on m_board object.
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
SHAPE_POLY_SET getPolySetFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness=-1, BOARD_ITEM_CONTAINER *aContainer=nullptr, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a SHAPE_POLY_SET object from a Cadstar SHAPE.
void logBoardStackupMessage(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
SHAPE_LINE_CHAIN getLineChainFromShapes(const std::vector< PCB_SHAPE * > aShapes)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
std::map< NET_ID, NETINFO_ITEM * > m_netMap
Map between Cadstar and KiCad Nets.
void loadComponentAttributes(const COMPONENT &aComponent, FOOTPRINT *aFootprint)
PCB_GROUP * getKiCadGroup(const GROUP_ID &aCadstarGroupID)
bool m_logLayerWarnings
Used in loadBoardStackup()
HATCHCODE getHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
void loadLibraryCoppers(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
LAYER_TYPE getLayerType(const LAYER_ID aCadstarLayerID)
bool isFootprint(BOARD_ITEM_CONTAINER *aContainer)
void loadLibraryFigures(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
void applyRouteOffset(VECTOR2I *aPointToOffset, const VECTOR2I &aRefPoint, const long &aOffsetAmount)
CADSTAR's Post Processor does an action called "Route Offset" which is applied when a route is wider ...
VECTOR2I getKiCadPoint(const VECTOR2I &aCadstarPoint)
Scales, offsets and inverts y axis to make the point usable directly in KiCad.
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
void remapUnsureLayers()
Callback m_layerMappingHandler for layers we aren't sure of.
double getAngleTenthDegree(const long long &aCadstarAngle)
LSET getKiCadLayerSet(const LAYER_ID &aCadstarLayerID)
void addToGroup(const GROUP_ID &aCadstarGroupID, BOARD_ITEM *aKiCadItem)
std::map< SYMDEF_ID, FOOTPRINT * > m_libraryMap
Map between Cadstar and KiCad components in the library.
COPPERCODE getCopperCode(const COPPERCODE_ID &aCadstaCopperCodeID)
std::vector< PCB_SHAPE * > getShapesFromVertices(const std::vector< VERTEX > &aCadstarVertices, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a vector of pointers to PCB_SHAPE objects.
std::map< PAD_ID, std::vector< PAD_ID > > ASSOCIATED_COPPER_PADS
Map of pad anchor points (first) to copper pads (second).
EDA_ANGLE getHatchCodeAngle(const HATCHCODE_ID &aCadstarHatchcodeID)
int getKiCadHatchCodeThickness(const HATCHCODE_ID &aCadstarHatchcodeID)
PCB_LAYER_ID getKiCadLayer(const LAYER_ID &aCadstarLayerID)
std::set< HATCHCODE_ID > m_hatchcodesTested
Used by checkAndLogHatchCode() to avoid multiple duplicate warnings.
void loadLibraryAreas(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
GROUP_ID createUniqueGroupID(const wxString &aName)
Adds a new PCB_GROUP* to m_groupMap.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
std::vector< PCB_TRACK * > makeTracksFromShapes(const std::vector< PCB_SHAPE * > aShapes, BOARD_ITEM_CONTAINER *aParentContainer, NETINFO_ITEM *aNet=nullptr, PCB_LAYER_ID aLayerOverride=UNDEFINED_LAYER, int aWidthOverride=-1)
Returns a vector of pointers to TRACK/ARC objects.
void addAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const ATTRIBUTE_ID &aCadstarAttributeID, FOOTPRINT *aFootprint, const wxString &aAttributeValue)
Adds a CADSTAR Attribute to a KiCad footprint.
std::map< GROUP_ID, PCB_GROUP * > m_groupMap
Map between Cadstar and KiCad groups.
bool calculateZonePriorities(PCB_LAYER_ID &aLayer)
Tries to make a best guess as to the zone priorities based on the pour status.
std::map< LAYER_ID, PCB_LAYER_ID > m_layermap
Map between Cadstar and KiCad Layers.
PAD *& getPadReference(FOOTPRINT *aFootprint, const PAD_ID aCadstarPadID)
bool m_doneNetClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
double getAngleDegrees(const long long &aCadstarAngle)
PART getPart(const PART_ID &aCadstarPartID)
LAYER_MAPPING_HANDLER m_layerMappingHandler
Callback to get layer mapping.
std::map< SYMDEF_ID, ASSOCIATED_COPPER_PADS > m_librarycopperpads
Associated copper pads (if any) for each component library definition.
Represents a CADSTAR PCB Archive (CPA) file.
long PAD_ID
Pad identifier (pin) in the PCB.
int KiCadUnitMultiplier
Use this value to convert units in this CPA file to KiCad units.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
Handle the data for a net.
Definition: netinfo.h:67
Definition: pad.h:60
Abstract dimension API.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
Definition: project.h:64
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition: shape.h:124
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
@ TENTHS_OF_A_DEGREE_T
Definition: eda_angle.h:30
@ DEGREES_T
Definition: eda_angle.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
std::function< std::map< wxString, PCB_LAYER_ID >(const std::vector< INPUT_LAYER_DESC > &)> LAYER_MAPPING_HANDLER
Pointer to a function that takes a map of source and KiCad layers and returns a re-mapped version.
@ VIA
Normal via.
Definition: router_tool.cpp:90
long Version
Archive version number (e.g.
Linear, leader (radius/diameter) or angular dimension.
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86