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 The 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
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
25
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 <reporter.h>
34
35#include <memory>
36#include <set>
37
38class BOARD;
41
43{
44public:
45 explicit CADSTAR_PCB_ARCHIVE_LOADER( wxString aFilename,
46 LAYER_MAPPING_HANDLER aLayerMappingHandler,
47 bool aLogLayerWarnings,
48 PROGRESS_REPORTER* aProgressReporter,
49 REPORTER* aReporter = nullptr )
50 : CADSTAR_PCB_ARCHIVE_PARSER( aFilename )
51 {
52 m_reporter = aReporter;
53 m_layerMappingHandler = aLayerMappingHandler;
54 m_logLayerWarnings = aLogLayerWarnings;
55 m_board = nullptr;
56 m_project = nullptr;
57 m_designCenter.x = 0;
58 m_designCenter.y = 0;
59 m_doneCopperWarning = false;
63 m_numNets = 0;
65 m_progressReporter = aProgressReporter;
66 }
67
68
70 {
71 for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem : m_libraryMap )
72 {
73 FOOTPRINT* footprint = libItem.second;
74
75 if( footprint )
76 delete footprint;
77 }
78 }
79
85 void Load( BOARD* aBoard, PROJECT* aProject );
86
87
93 std::vector<std::unique_ptr<FOOTPRINT>> LoadFpLibrary();
94
99 std::vector<FOOTPRINT*> GetLoadedLibraryFootpints() const;
100
101private:
106 void reportError( const wxString& aMsg ) const
107 {
108 if( m_reporter )
109 m_reporter->Report( aMsg, RPT_SEVERITY_ERROR );
110 }
111
112 void reportWarning( const wxString& aMsg ) const
113 {
114 if( m_reporter )
115 m_reporter->Report( aMsg, RPT_SEVERITY_WARNING );
116 }
117
118 void reportInfo( const wxString& aMsg ) const
119 {
120 if( m_reporter )
121 m_reporter->Report( aMsg, RPT_SEVERITY_INFO );
122 }
123
129 std::map<LAYER_ID, PCB_LAYER_ID> m_layermap;
131 std::map<SYMDEF_ID, FOOTPRINT*> m_libraryMap;
135 std::map<GROUP_ID, PCB_GROUP*> m_groupMap;
139 std::map<COMPONENT_ID, FOOTPRINT*> m_componentMap;
143
148 using ASSOCIATED_COPPER_PADS = std::map<PAD_ID, std::vector<PAD_ID>>;
149
153 std::map<SYMDEF_ID, ASSOCIATED_COPPER_PADS> m_librarycopperpads;
154
155 std::map<NET_ID, NETINFO_ITEM*> m_netMap;
156 std::map<std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID>, std::shared_ptr<NETCLASS>>
158 std::map<TEMPLATE_ID, ZONE*> m_zonesMap;
159 std::vector<LAYER_ID> m_powerPlaneLayers;
165 std::set<HATCHCODE_ID> m_hatchcodesTested;
167 std::set<PADCODE_ID> m_padcodesTested;
178
179
180 // Functions for loading individual elements:
181 void loadBoardStackup();
182 void remapUnsureLayers();
183 void loadDesignRules();
185 void loadGroups();
186 void loadBoards();
187 void loadFigures();
188 void loadTexts();
189 void loadDimensions();
190 void loadAreas();
191 void loadComponents();
193 void loadTemplates();
194 void loadCoppers();
195 void loadNets();
196 void loadTextVariables();
197
198 // Helper functions for element loading:
199 void logBoardStackupWarning( const wxString& aCadstarLayerName,
200 const PCB_LAYER_ID& aKiCadLayer );
201 void logBoardStackupMessage( const wxString& aCadstarLayerName,
202 const PCB_LAYER_ID& aKiCadLayer );
203 void initStackupItem( const LAYER& aCadstarLayer, BOARD_STACKUP_ITEM* aKiCadItem,
204 int aDielectricSublayer );
205 void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
206 void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
207 void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
208 void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
209 void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint );
210 void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute,
211 long aDefaultRouteWidth,
212 long aStartWidth = std::numeric_limits<long>::max(),
213 long aEndWidth = std::numeric_limits<long>::max() );
214
216 int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
217 void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
218 void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim );
219
220
225
226 //Helper functions for drawing /loading objects onto screen:
227
240 void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
241 const GROUP_ID& aCadstarGroupID = wxEmptyString,
242 const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
243 const VECTOR2I& aMoveVector = { 0, 0 },
244 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
245 const VECTOR2I& aTransformCentre = { 0, 0 },
246 bool aMirrorInvert = false );
247
263 void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
264 int aLineThickness, LINE_STYLE aLineStyle, const wxString& aShapeName,
265 BOARD_ITEM_CONTAINER* aContainer,
266 const GROUP_ID& aCadstarGroupID = wxEmptyString,
267 const VECTOR2I& aMoveVector = { 0, 0 },
268 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
269 const VECTOR2I& aTransformCentre = { 0, 0 },
270 bool aMirrorInvert = false );
271
286 void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts, const PCB_LAYER_ID& aKiCadLayer,
287 int aLineThickness, BOARD_ITEM_CONTAINER* aContainer,
288 const GROUP_ID& aCadstarGroupID = wxEmptyString,
289 const VECTOR2I& aMoveVector = { 0, 0 },
290 double aRotationAngle = 0.0,
291 double aScalingFactor = 1.0,
292 const VECTOR2I& aTransformCentre = { 0, 0 },
293 bool aMirrorInvert = false );
294
310 void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
311 const PCB_LAYER_ID& aKiCadLayer,
312 int aLineThickness, LINE_STYLE aLineStyle,
313 BOARD_ITEM_CONTAINER* aContainer,
314 const GROUP_ID& aCadstarGroupID = wxEmptyString,
315 const VECTOR2I& aMoveVector = { 0, 0 },
316 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
317 const VECTOR2I& aTransformCentre = { 0, 0 },
318 bool aMirrorInvert = false );
319
332 std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
333 BOARD_ITEM_CONTAINER* aContainer = nullptr,
334 const GROUP_ID& aCadstarGroupID = wxEmptyString,
335 const VECTOR2I& aMoveVector = { 0, 0 },
336 double aRotationAngle = 0.0,
337 double aScalingFactor = 1.0,
338 const VECTOR2I& aTransformCentre = { 0, 0 },
339 bool aMirrorInvert = false );
340
355 PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
356 const VERTEX& aCadstarVertex,
357 BOARD_ITEM_CONTAINER* aContainer = nullptr,
358 const GROUP_ID& aCadstarGroupID = wxEmptyString,
359 const VECTOR2I& aMoveVector = { 0, 0 },
360 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
361 const VECTOR2I& aTransformCentre = { 0, 0 },
362 bool aMirrorInvert = false );
363
371 ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness,
372 BOARD_ITEM_CONTAINER* aParentContainer );
373
386 SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape, int aLineThickness = -1,
387 BOARD_ITEM_CONTAINER* aContainer = nullptr,
388 const VECTOR2I& aMoveVector = { 0, 0 },
389 double aRotationAngle = 0.0,
390 double aScalingFactor = 1.0,
391 const VECTOR2I& aTransformCentre = { 0, 0 },
392 bool aMirrorInvert = false );
393
399 SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*>& aShapes );
400
413 std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*>& aShapes,
414 BOARD_ITEM_CONTAINER* aParentContainer,
415 NETINFO_ITEM* aNet = nullptr,
416 PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
417 int aWidthOverride = -1 );
418
426 void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
427 const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint,
428 const wxString& aAttributeValue );
429
438 void applyRouteOffset( VECTOR2I* aPointToOffset, const VECTOR2I& aRefPoint,
439 const long& aOffsetAmount );
440
444 void applyTextCode( EDA_TEXT* aKiCadText, const TEXTCODE_ID& aCadstarTextCodeID );
445
446 // Helper Functions for obtaining CADSTAR elements in the parsed structures
447 int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
448 LINE_STYLE getLineStyle( const LINECODE_ID& aCadstarLineCodeID );
449 COPPERCODE getCopperCode( const COPPERCODE_ID& aCadstaCopperCodeID );
450 HATCHCODE getHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
451 LAYERPAIR getLayerPair( const LAYERPAIR_ID& aCadstarLayerPairID );
452 PADCODE getPadCode( const PADCODE_ID& aCadstarPadCodeID );
453 PART getPart( const PART_ID& aCadstarPartID );
454 ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
455 TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
456 VIACODE getViaCode( const VIACODE_ID& aCadstarViaCodeID );
457 wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
458 wxString getAttributeValue( const ATTRIBUTE_ID& aCadstarAttributeID,
459 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
460 LAYER_TYPE getLayerType( const LAYER_ID aCadstarLayerID );
461
462 // Helper Functions for obtaining individual elements as KiCad elements:
463 EDA_ANGLE getHatchCodeAngle( const HATCHCODE_ID& aCadstarHatchcodeID );
464 PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent );
465
472 VECTOR2I applyPadShape( PAD* aPad, PCB_LAYER_ID aPadLayer, const CADSTAR_PAD_SHAPE& aShape );
473
474 PAD*& getPadReference( FOOTPRINT* aFootprint, const PAD_ID aCadstarPadID );
475 FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID );
476 int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID );
477 int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID );
478 PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID );
479
485 VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
486
492 int getKiCadLength( long long aCadstarLength )
493 {
494 return aCadstarLength * KiCadUnitMultiplier;
495 }
496
502 double getAngleTenthDegree( const long long& aCadstarAngle )
503 {
504 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
505 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
506 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
507 if( Header.Format.Version > 8 )
508 {
509 return (double) aCadstarAngle / 100.0;
510 }
511 else
512 {
513 return (double) aCadstarAngle;
514 }
515 }
516
522 EDA_ANGLE getAngle( const long long& aCadstarAngle )
523 {
524 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
525 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
526 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
527 if( Header.Format.Version > 8 )
528 {
529 return EDA_ANGLE( aCadstarAngle / 1000.0, DEGREES_T );
530 }
531 else
532 {
533 return EDA_ANGLE( (int) aCadstarAngle, TENTHS_OF_A_DEGREE_T );
534 }
535 }
536
542 double getAngleDegrees( const long long& aCadstarAngle )
543 {
544 return getAngleTenthDegree( aCadstarAngle ) / 10.0;
545 }
546
553 NETINFO_ITEM* getKiCadNet( const NET_ID& aCadstarNetID );
554
561 PCB_LAYER_ID getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer = true );
562
568 bool isLayerSet( const LAYER_ID& aCadstarLayerID );
569
575 PCB_LAYER_ID getKiCadLayer( const LAYER_ID& aCadstarLayerID );
576
582 LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID );
583
584
586 {
587 return aContainer && aContainer->Type() == PCB_FOOTPRINT_T;
588 }
589
590
591 void addToGroup( const GROUP_ID& aCadstarGroupID, BOARD_ITEM* aKiCadItem );
592
599 GROUP_ID createUniqueGroupID( const wxString& aName );
600};
601
602
603#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:84
Manage one layer needed to make a physical board.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
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.
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
std::vector< std::unique_ptr< FOOTPRINT > > LoadFpLibrary()
Parse a CADSTAR PCB Archive and load the footprints contained within.
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
void drawCadstarVerticesAsShapes(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, LINE_STYLE aLineStyle, 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.
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.
REPORTER * m_reporter
Optional; may be nullptr.
void reportError(const wxString &aMsg) const
Report an import issue the user can act on.
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.
CADSTAR_PCB_ARCHIVE_LOADER(wxString aFilename, LAYER_MAPPING_HANDLER aLayerMappingHandler, bool aLogLayerWarnings, PROGRESS_REPORTER *aProgressReporter, REPORTER *aReporter=nullptr)
SHAPE_LINE_CHAIN getLineChainFromShapes(const std::vector< PCB_SHAPE * > &aShapes)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
std::map< PAD_ID, std::vector< PAD_ID > > ASSOCIATED_COPPER_PADS
Map of pad anchor points (first) to copper pads (second).
void applyDimensionSettings(const DIMENSION &aCadstarDim, PCB_DIMENSION_BASE *aKiCadDim)
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
void drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, int aLineThickness, LINE_STYLE aLineStyle, 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)
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
void reportInfo(const wxString &aMsg) const
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)
VECTOR2I applyPadShape(PAD *aPad, PCB_LAYER_ID aPadLayer, const CADSTAR_PAD_SHAPE &aShape)
Apply a CADSTAR pad shape to a single layer of a KiCad padstack.
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)
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)
void loadNetTracks(const NET_ID &aCadstarNetID, const NET_PCB::ROUTE &aCadstarRoute, long aDefaultRouteWidth, long aStartWidth=std::numeric_limits< long >::max(), long aEndWidth=std::numeric_limits< long >::max())
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)
void reportWarning(const wxString &aMsg) const
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.
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.
LINE_STYLE getLineStyle(const LINECODE_ID &aCadstarLineCodeID)
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
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.
long PAD_ID
Pad identifier (pin) in the PCB.
int KiCadUnitMultiplier
Use this value to convert units in this CPA file to KiCad units.
CADSTAR_PCB_ARCHIVE_PARSER(const wxString &aFilename)
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
Handle the data for a net.
Definition netinfo.h:50
Abstract dimension API.
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
Definition project.h:63
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
@ TENTHS_OF_A_DEGREE_T
Definition eda_angle.h:29
@ DEGREES_T
Definition eda_angle.h:30
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
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.
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
LINE_STYLE
Dashed line types.
Represent a point in x,y coordinates.
Represents a vertex in a shape.
Linear, leader (radius/diameter) or angular dimension.
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708