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
84 void Load( BOARD* aBoard, PROJECT* aProject );
85
86
92 std::vector<std::unique_ptr<FOOTPRINT>> LoadFpLibrary();
93
98 std::vector<FOOTPRINT*> GetLoadedLibraryFootpints() const;
99
100private:
105 void reportError( const wxString& aMsg ) const
106 {
107 if( m_reporter )
108 m_reporter->Report( aMsg, RPT_SEVERITY_ERROR );
109 }
110
111 void reportWarning( const wxString& aMsg ) const
112 {
113 if( m_reporter )
114 m_reporter->Report( aMsg, RPT_SEVERITY_WARNING );
115 }
116
117 void reportInfo( const wxString& aMsg ) const
118 {
119 if( m_reporter )
120 m_reporter->Report( aMsg, RPT_SEVERITY_INFO );
121 }
122
128 std::map<LAYER_ID, PCB_LAYER_ID> m_layermap;
130 std::map<SYMDEF_ID, FOOTPRINT*> m_libraryMap;
134 std::map<GROUP_ID, PCB_GROUP*> m_groupMap;
138 std::map<COMPONENT_ID, FOOTPRINT*> m_componentMap;
142
147 using ASSOCIATED_COPPER_PADS = std::map<PAD_ID, std::vector<PAD_ID>>;
148
152 std::map<SYMDEF_ID, ASSOCIATED_COPPER_PADS> m_librarycopperpads;
153
154 std::map<NET_ID, NETINFO_ITEM*> m_netMap;
155 std::map<std::tuple<ROUTECODE_ID, NETCLASS_ID, SPACING_CLASS_ID>, std::shared_ptr<NETCLASS>>
157 std::map<TEMPLATE_ID, ZONE*> m_zonesMap;
158 std::vector<LAYER_ID> m_powerPlaneLayers;
164 std::set<HATCHCODE_ID> m_hatchcodesTested;
166 std::set<PADCODE_ID> m_padcodesTested;
177
178
179 // Functions for loading individual elements:
180 void loadBoardStackup();
181 void remapUnsureLayers();
182 void loadDesignRules();
184 void loadGroups();
185 void loadBoards();
186 void loadFigures();
187 void loadTexts();
188 void loadDimensions();
189 void loadAreas();
190 void loadComponents();
192 void loadTemplates();
193 void loadCoppers();
194 void loadNets();
195 void loadTextVariables();
196
197 // Helper functions for element loading:
198 void logBoardStackupWarning( const wxString& aCadstarLayerName,
199 const PCB_LAYER_ID& aKiCadLayer );
200 void logBoardStackupMessage( const wxString& aCadstarLayerName,
201 const PCB_LAYER_ID& aKiCadLayer );
202 void initStackupItem( const LAYER& aCadstarLayer, BOARD_STACKUP_ITEM* aKiCadItem,
203 int aDielectricSublayer );
204 void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
205 void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
206 void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
207 void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
208 void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint );
209 void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute,
210 long aDefaultRouteWidth,
211 long aStartWidth = std::numeric_limits<long>::max(),
212 long aEndWidth = std::numeric_limits<long>::max() );
213
215 int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
216 void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
217 void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim );
218
219
224
225 //Helper functions for drawing /loading objects onto screen:
226
239 void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
240 const GROUP_ID& aCadstarGroupID = wxEmptyString,
241 const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
242 const VECTOR2I& aMoveVector = { 0, 0 },
243 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
244 const VECTOR2I& aTransformCentre = { 0, 0 },
245 bool aMirrorInvert = false );
246
261 void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
262 int aLineThickness, const wxString& aShapeName,
263 BOARD_ITEM_CONTAINER* aContainer,
264 const GROUP_ID& aCadstarGroupID = wxEmptyString,
265 const VECTOR2I& aMoveVector = { 0, 0 },
266 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
267 const VECTOR2I& aTransformCentre = { 0, 0 },
268 bool aMirrorInvert = false );
269
283 void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
284 const PCB_LAYER_ID& aKiCadLayer, int aLineThickness,
285 BOARD_ITEM_CONTAINER* aContainer,
286 const GROUP_ID& aCadstarGroupID = wxEmptyString,
287 const VECTOR2I& aMoveVector = { 0, 0 },
288 double aRotationAngle = 0.0,
289 double aScalingFactor = 1.0,
290 const VECTOR2I& aTransformCentre = { 0, 0 },
291 bool aMirrorInvert = false );
292
307 void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
308 const PCB_LAYER_ID& aKiCadLayer, int aLineThickness,
309 BOARD_ITEM_CONTAINER* aContainer,
310 const GROUP_ID& aCadstarGroupID = wxEmptyString,
311 const VECTOR2I& aMoveVector = { 0, 0 },
312 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
313 const VECTOR2I& aTransformCentre = { 0, 0 },
314 bool aMirrorInvert = false );
315
328 std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
329 BOARD_ITEM_CONTAINER* aContainer = nullptr,
330 const GROUP_ID& aCadstarGroupID = wxEmptyString,
331 const VECTOR2I& aMoveVector = { 0, 0 },
332 double aRotationAngle = 0.0,
333 double aScalingFactor = 1.0,
334 const VECTOR2I& aTransformCentre = { 0, 0 },
335 bool aMirrorInvert = false );
336
350 PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
351 const VERTEX& aCadstarVertex,
352 BOARD_ITEM_CONTAINER* aContainer = nullptr,
353 const GROUP_ID& aCadstarGroupID = wxEmptyString,
354 const VECTOR2I& aMoveVector = { 0, 0 },
355 double aRotationAngle = 0.0, double aScalingFactor = 1.0,
356 const VECTOR2I& aTransformCentre = { 0, 0 },
357 bool aMirrorInvert = false );
358
366 ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness,
367 BOARD_ITEM_CONTAINER* aParentContainer );
368
381 SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape, int aLineThickness = -1,
382 BOARD_ITEM_CONTAINER* aContainer = nullptr,
383 const VECTOR2I& aMoveVector = { 0, 0 },
384 double aRotationAngle = 0.0,
385 double aScalingFactor = 1.0,
386 const VECTOR2I& aTransformCentre = { 0, 0 },
387 bool aMirrorInvert = false );
388
394 SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*>& aShapes );
395
408 std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*>& aShapes,
409 BOARD_ITEM_CONTAINER* aParentContainer,
410 NETINFO_ITEM* aNet = nullptr,
411 PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
412 int aWidthOverride = -1 );
413
421 void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
422 const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint,
423 const wxString& aAttributeValue );
424
433 void applyRouteOffset( VECTOR2I* aPointToOffset, const VECTOR2I& aRefPoint,
434 const long& aOffsetAmount );
435
439 void applyTextCode( EDA_TEXT* aKiCadText, const TEXTCODE_ID& aCadstarTextCodeID );
440
441 //Helper Functions for obtaining CADSTAR elements in the parsed structures
442 int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
443 COPPERCODE getCopperCode( const COPPERCODE_ID& aCadstaCopperCodeID );
444 HATCHCODE getHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
445 LAYERPAIR getLayerPair( const LAYERPAIR_ID& aCadstarLayerPairID );
446 PADCODE getPadCode( const PADCODE_ID& aCadstarPadCodeID );
447 PART getPart( const PART_ID& aCadstarPartID );
448 ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
449 TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
450 VIACODE getViaCode( const VIACODE_ID& aCadstarViaCodeID );
451 wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
452 wxString getAttributeValue( const ATTRIBUTE_ID& aCadstarAttributeID,
453 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
454 LAYER_TYPE getLayerType( const LAYER_ID aCadstarLayerID );
455
456 // Helper Functions for obtaining individual elements as KiCad elements:
457 EDA_ANGLE getHatchCodeAngle( const HATCHCODE_ID& aCadstarHatchcodeID );
458 PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent );
459
466 VECTOR2I applyPadShape( PAD* aPad, PCB_LAYER_ID aPadLayer, const CADSTAR_PAD_SHAPE& aShape );
467
468 PAD*& getPadReference( FOOTPRINT* aFootprint, const PAD_ID aCadstarPadID );
469 FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID );
470 int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID );
471 int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID );
472 PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID );
473
479 VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
480
486 int getKiCadLength( long long aCadstarLength )
487 {
488 return aCadstarLength * KiCadUnitMultiplier;
489 }
490
496 double getAngleTenthDegree( const long long& aCadstarAngle )
497 {
498 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
499 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
500 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
501 if( Header.Format.Version > 8 )
502 {
503 return (double) aCadstarAngle / 100.0;
504 }
505 else
506 {
507 return (double) aCadstarAngle;
508 }
509 }
510
516 EDA_ANGLE getAngle( const long long& aCadstarAngle )
517 {
518 // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
519 // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
520 // Version 9 and later) is the version that introduced 1/1000 degree for angles.
521 if( Header.Format.Version > 8 )
522 {
523 return EDA_ANGLE( aCadstarAngle / 1000.0, DEGREES_T );
524 }
525 else
526 {
527 return EDA_ANGLE( (int) aCadstarAngle, TENTHS_OF_A_DEGREE_T );
528 }
529 }
530
536 double getAngleDegrees( const long long& aCadstarAngle )
537 {
538 return getAngleTenthDegree( aCadstarAngle ) / 10.0;
539 }
540
547 NETINFO_ITEM* getKiCadNet( const NET_ID& aCadstarNetID );
548
555 PCB_LAYER_ID getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer = true );
556
562 bool isLayerSet( const LAYER_ID& aCadstarLayerID );
563
569 PCB_LAYER_ID getKiCadLayer( const LAYER_ID& aCadstarLayerID );
570
576 LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID );
577
578
580 {
581 return aContainer && aContainer->Type() == PCB_FOOTPRINT_T;
582 }
583
584
585 void addToGroup( const GROUP_ID& aCadstarGroupID, BOARD_ITEM* aKiCadItem );
586
593 GROUP_ID createUniqueGroupID( const wxString& aName );
594};
595
596
597#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:409
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.
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)
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)
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)
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.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
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.
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:30
@ DEGREES_T
Definition eda_angle.h:31
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
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:683