KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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
34#include <memory>
35#include <set>
36
37class BOARD;
40
42{
43public:
44 explicit CADSTAR_PCB_ARCHIVE_LOADER( wxString aFilename,
45 LAYER_MAPPING_HANDLER aLayerMappingHandler,
46 bool aLogLayerWarnings,
47 PROGRESS_REPORTER* aProgressReporter )
48 : CADSTAR_PCB_ARCHIVE_PARSER( aFilename )
49 {
50 m_layerMappingHandler = aLayerMappingHandler;
51 m_logLayerWarnings = aLogLayerWarnings;
52 m_board = nullptr;
53 m_project = nullptr;
54 m_designCenter.x = 0;
55 m_designCenter.y = 0;
56 m_doneCopperWarning = false;
60 m_numNets = 0;
62 m_progressReporter = aProgressReporter;
63 }
64
65
67 {
68 for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem : m_libraryMap )
69 {
70 FOOTPRINT* footprint = libItem.second;
71
72 if( footprint )
73 delete footprint;
74 }
75 }
76
81 void Load( BOARD* aBoard, PROJECT* aProject );
82
83
88 std::vector<std::unique_ptr<FOOTPRINT>> LoadLibrary();
89
94 std::vector<FOOTPRINT*> GetLoadedLibraryFootpints() const;
95
96private:
101 std::map<LAYER_ID, PCB_LAYER_ID> m_layermap;
103 std::map<SYMDEF_ID, FOOTPRINT*> m_libraryMap;
107 std::map<GROUP_ID, PCB_GROUP*> m_groupMap;
111 std::map<COMPONENT_ID, FOOTPRINT*> m_componentMap;
115
120 using ASSOCIATED_COPPER_PADS = std::map<PAD_ID, std::vector<PAD_ID>>;
121
125 std::map<SYMDEF_ID, ASSOCIATED_COPPER_PADS> m_librarycopperpads;
126
127 std::map<NET_ID, NETINFO_ITEM*> m_netMap;
128 std::map<std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID>, std::shared_ptr<NETCLASS>>
130 std::map<TEMPLATE_ID, ZONE*> m_zonesMap;
131 std::vector<LAYER_ID> m_powerPlaneLayers;
137 std::set<HATCHCODE_ID> m_hatchcodesTested;
139 std::set<PADCODE_ID> m_padcodesTested;
150
151
152 // Functions for loading individual elements:
153 void loadBoardStackup();
154 void remapUnsureLayers();
155 void loadDesignRules();
157 void loadGroups();
158 void loadBoards();
159 void loadFigures();
160 void loadTexts();
161 void loadDimensions();
162 void loadAreas();
163 void loadComponents();
165 void loadTemplates();
166 void loadCoppers();
167 void loadNets();
168 void loadTextVariables();
169
170 // Helper functions for element loading:
171 void logBoardStackupWarning( const wxString& aCadstarLayerName,
172 const PCB_LAYER_ID& aKiCadLayer );
173 void logBoardStackupMessage( const wxString& aCadstarLayerName,
174 const PCB_LAYER_ID& aKiCadLayer );
175 void initStackupItem( const LAYER& aCadstarLayer, BOARD_STACKUP_ITEM* aKiCadItem,
176 int aDielectricSublayer );
177 void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
178 void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
179 void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
180 void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
181 void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint );
182 void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute,
183 long aStartWidth = std::numeric_limits<long>::max(),
184 long aEndWidth = std::numeric_limits<long>::max() );
185
187 int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
188 void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
189 void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim );
190
191
196
197 //Helper functions for drawing /loading objects onto screen:
198
211 void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
212 const GROUP_ID& aCadstarGroupID = wxEmptyString,
213 const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
214 const VECTOR2I& aMoveVector = { 0, 0 },
215 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
216 const VECTOR2I& aTransformCentre = { 0, 0 },
217 bool aMirrorInvert = false );
218
233 void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
234 int aLineThickness, const wxString& aShapeName,
235 BOARD_ITEM_CONTAINER* aContainer,
236 const GROUP_ID& aCadstarGroupID = wxEmptyString,
237 const VECTOR2I& aMoveVector = { 0, 0 },
238 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
239 const VECTOR2I& aTransformCentre = { 0, 0 },
240 bool aMirrorInvert = false );
241
255 void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
256 const PCB_LAYER_ID& aKiCadLayer, int aLineThickness,
257 BOARD_ITEM_CONTAINER* aContainer,
258 const GROUP_ID& aCadstarGroupID = wxEmptyString,
259 const VECTOR2I& aMoveVector = { 0, 0 },
260 double aRotationAngle = 0.0,
261 double aScalingFactor = 1.0,
262 const VECTOR2I& aTransformCentre = { 0, 0 },
263 bool aMirrorInvert = false );
264
279 void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
280 const PCB_LAYER_ID& aKiCadLayer, int aLineThickness,
281 BOARD_ITEM_CONTAINER* aContainer,
282 const GROUP_ID& aCadstarGroupID = wxEmptyString,
283 const VECTOR2I& aMoveVector = { 0, 0 },
284 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
285 const VECTOR2I& aTransformCentre = { 0, 0 },
286 bool aMirrorInvert = false );
287
300 std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
301 BOARD_ITEM_CONTAINER* aContainer = nullptr,
302 const GROUP_ID& aCadstarGroupID = wxEmptyString,
303 const VECTOR2I& aMoveVector = { 0, 0 },
304 double aRotationAngle = 0.0,
305 double aScalingFactor = 1.0,
306 const VECTOR2I& aTransformCentre = { 0, 0 },
307 bool aMirrorInvert = false );
308
322 PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
323 const VERTEX& aCadstarVertex,
324 BOARD_ITEM_CONTAINER* aContainer = nullptr,
325 const GROUP_ID& aCadstarGroupID = wxEmptyString,
326 const VECTOR2I& aMoveVector = { 0, 0 },
327 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
328 const VECTOR2I& aTransformCentre = { 0, 0 },
329 bool aMirrorInvert = false );
330
338 ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness,
339 BOARD_ITEM_CONTAINER* aParentContainer );
340
353 SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape, int aLineThickness = -1,
354 BOARD_ITEM_CONTAINER* aContainer = nullptr,
355 const VECTOR2I& aMoveVector = { 0, 0 },
356 double aRotationAngle = 0.0,
357 double aScalingFactor = 1.0,
358 const VECTOR2I& aTransformCentre = { 0, 0 },
359 bool aMirrorInvert = false );
360
366 SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*>& aShapes );
367
380 std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*>& aShapes,
381 BOARD_ITEM_CONTAINER* aParentContainer,
382 NETINFO_ITEM* aNet = nullptr,
383 PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
384 int aWidthOverride = -1 );
385
393 void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
394 const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint,
395 const wxString& aAttributeValue );
396
405 void applyRouteOffset( VECTOR2I* aPointToOffset, const VECTOR2I& aRefPoint,
406 const long& aOffsetAmount );
407
411 void applyTextCode( EDA_TEXT* aKiCadText, const TEXTCODE_ID& aCadstarTextCodeID );
412
413 //Helper Functions for obtaining CADSTAR elements in the parsed structures
414 int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
415 COPPERCODE getCopperCode( const COPPERCODE_ID& aCadstaCopperCodeID );
416 HATCHCODE getHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
417 LAYERPAIR getLayerPair( const LAYERPAIR_ID& aCadstarLayerPairID );
418 PADCODE getPadCode( const PADCODE_ID& aCadstarPadCodeID );
419 PART getPart( const PART_ID& aCadstarPartID );
420 ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
421 TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
422 VIACODE getViaCode( const VIACODE_ID& aCadstarViaCodeID );
423 wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
424 wxString getAttributeValue( const ATTRIBUTE_ID& aCadstarAttributeID,
425 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
426 LAYER_TYPE getLayerType( const LAYER_ID aCadstarLayerID );
427
428 // Helper Functions for obtaining individual elements as KiCad elements:
429 EDA_ANGLE getHatchCodeAngle( const HATCHCODE_ID& aCadstarHatchcodeID );
430 PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent );
431 PAD*& getPadReference( FOOTPRINT* aFootprint, const PAD_ID aCadstarPadID );
432 FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID );
433 int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID );
434 int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID );
435 PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID );
436
442 VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
443
449 int getKiCadLength( long long aCadstarLength )
450 {
451 return aCadstarLength * KiCadUnitMultiplier;
452 }
453
459 double getAngleTenthDegree( const long long& aCadstarAngle )
460 {
461 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
462 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
463 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
464 if( Header.Format.Version > 8 )
465 {
466 return (double) aCadstarAngle / 100.0;
467 }
468 else
469 {
470 return (double) aCadstarAngle;
471 }
472 }
473
479 EDA_ANGLE getAngle( const long long& aCadstarAngle )
480 {
481 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
482 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
483 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
484 if( Header.Format.Version > 8 )
485 {
486 return EDA_ANGLE( aCadstarAngle / 1000.0, DEGREES_T );
487 }
488 else
489 {
490 return EDA_ANGLE( (int) aCadstarAngle, TENTHS_OF_A_DEGREE_T );
491 }
492 }
493
499 double getAngleDegrees( const long long& aCadstarAngle )
500 {
501 return getAngleTenthDegree( aCadstarAngle ) / 10.0;
502 }
503
510 NETINFO_ITEM* getKiCadNet( const NET_ID& aCadstarNetID );
511
518 PCB_LAYER_ID getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer = true );
519
525 bool isLayerSet( const LAYER_ID& aCadstarLayerID );
526
532 PCB_LAYER_ID getKiCadLayer( const LAYER_ID& aCadstarLayerID );
533
539 LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID );
540
541
543 {
544 return aContainer && aContainer->Type() == PCB_FOOTPRINT_T;
545 }
546
547
548 void addToGroup( const GROUP_ID& aCadstarGroupID, BOARD_ITEM* aKiCadItem );
549
556 GROUP_ID createUniqueGroupID( const wxString& aName );
557};
558
559
560#endif // CADSTAR_PCB_ARCHIVE_LOADER_H_
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:79
Manage one layer needed to make a physical board.
Definition: board_stackup.h:96
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
PROGRESS_REPORTER * m_progressReporter
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.
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
bool isLayerSet(const LAYER_ID &aCadstarLayerID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
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)
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 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a vector of pointers to PCB_SHAPE objects.
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.
SHAPE_LINE_CHAIN getLineChainFromShapes(const std::vector< PCB_SHAPE * > &aShapes)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
void applyDimensionSettings(const DIMENSION &aCadstarDim, PCB_DIMENSION_BASE *aKiCadDim)
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)
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.
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 drawCadstarCutoutsAsShapes(const std::vector< CUTOUT > &aCutouts, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Uses PCB_SHAPEs to draw the cutouts on m_board object.
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)
PCB_SHAPE * getShapeFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
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 drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, const wxString &aShapeName, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
void logBoardStackupMessage(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
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 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)
SHAPE_POLY_SET getPolySetFromCadstarShape(const SHAPE &aCadstarShape, int aLineThickness=-1, BOARD_ITEM_CONTAINER *aContainer=nullptr, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Returns a SHAPE_POLY_SET object from a Cadstar SHAPE.
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)
std::vector< std::unique_ptr< FOOTPRINT > > LoadLibrary()
Parse a CADSTAR PCB Archive and load the footprints contained within.
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
void drawCadstarVerticesAsShapes(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const VECTOR2I &aMoveVector={ 0, 0 }, double aRotationAngle=0.0, double aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, bool aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
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:101
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:79
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
Handle the data for a net.
Definition: netinfo.h:56
Definition: pad.h:54
Abstract dimension API.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:52
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:126
Handle a list of polygons defining a copper zone.
Definition: zone.h:73
@ 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:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
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.
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