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 <roberto.fer.bau@gmail.com>
5  * Copyright (C) 2020-2021 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 
35 class BOARD;
36 class BOARD_STACKUP_ITEM;
37 class PCB_DIMENSION_BASE;
38 
40 {
41 public:
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;
56  m_doneNetClassWarning = false;
57  m_numNets = 0;
58  m_progressReporter = aProgressReporter;
59  }
60 
61 
63  {
64  for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem : m_libraryMap )
65  {
66  FOOTPRINT* footprint = libItem.second;
67 
68  if( footprint )
69  delete footprint;
70  }
71  }
72 
77  void Load( BOARD* aBoard, PROJECT* aProject );
78 
83  std::vector<FOOTPRINT*> GetLoadedLibraryFootpints() const;
84 
85 private:
90  std::map<LAYER_ID, PCB_LAYER_ID> m_layermap;
91  std::map<SYMDEF_ID, FOOTPRINT*> m_libraryMap;
93  std::map<GROUP_ID, PCB_GROUP*> m_groupMap;
97  std::map<COMPONENT_ID, FOOTPRINT*> m_componentMap;
101 
109  using ASSOCIATED_COPPER_PADS = std::map<PAD_ID, std::vector<PAD_ID>>;
110 
114  std::map<SYMDEF_ID, ASSOCIATED_COPPER_PADS> m_librarycopperpads;
115 
116  std::map<NET_ID, NETINFO_ITEM*> m_netMap;
117  std::map<ROUTECODE_ID, NETCLASSPTR> m_netClassMap;
118  std::map<TEMPLATE_ID, ZONE*> m_zonesMap;
119  std::vector<LAYER_ID> m_powerPlaneLayers;
120  wxPoint m_designCenter;
123  std::set<HATCHCODE_ID> m_hatchcodesTested;
126  std::set<PADCODE_ID> m_padcodesTested;
128  bool m_doneCopperWarning;
132  bool m_doneNetClassWarning;
134  int m_numNets;
136 
137 
138  // Functions for loading individual elements:
139  void loadBoardStackup();
140  void remapUnsureLayers();
141  void loadDesignRules();
142  void loadComponentLibrary();
143  void loadGroups();
144  void loadBoards();
145  void loadFigures();
146  void loadTexts();
147  void loadDimensions();
148  void loadAreas();
149  void loadComponents();
151  void loadTemplates();
152  void loadCoppers();
153  void loadNets();
154  void loadTextVariables();
155 
156  // Helper functions for element loading:
157  void logBoardStackupWarning( const wxString& aCadstarLayerName,
158  const PCB_LAYER_ID& aKiCadLayer );
159  void logBoardStackupMessage( const wxString& aCadstarLayerName,
160  const PCB_LAYER_ID& aKiCadLayer );
161  void initStackupItem( const LAYER& aCadstarLayer, BOARD_STACKUP_ITEM* aKiCadItem,
162  int aDielectricSublayer );
163  void loadLibraryFigures( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
164  void loadLibraryCoppers( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
165  void loadLibraryAreas( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
166  void loadLibraryPads( const SYMDEF_PCB& aComponent, FOOTPRINT* aFootprint );
167  void loadComponentAttributes( const COMPONENT& aComponent, FOOTPRINT* aFootprint );
168  void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute,
169  long aStartWidth = std::numeric_limits<long>::max(),
170  long aEndWidth = std::numeric_limits<long>::max() );
171 
173  int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
174  void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
175  void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim );
176 
177 
182 
183  //Helper functions for drawing /loading objects onto screen:
184 
197  void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
198  const GROUP_ID& aCadstarGroupID = wxEmptyString,
199  const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
200  const wxPoint& aMoveVector = { 0, 0 },
201  const double& aRotationAngle = 0.0,
202  const double& aScalingFactor = 1.0,
203  const wxPoint& aTransformCentre = { 0, 0 },
204  const bool& aMirrorInvert = false );
205 
220  void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
221  const int& aLineThickness, const wxString& aShapeName,
222  BOARD_ITEM_CONTAINER* aContainer,
223  const GROUP_ID& aCadstarGroupID = wxEmptyString,
224  const wxPoint& aMoveVector = { 0, 0 },
225  const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0,
226  const wxPoint& aTransformCentre = { 0, 0 },
227  const bool& aMirrorInvert = false );
228 
242  void drawCadstarCutoutsAsShapes( const std::vector<CUTOUT>& aCutouts,
243  const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
244  BOARD_ITEM_CONTAINER* aContainer,
245  const GROUP_ID& aCadstarGroupID = wxEmptyString,
246  const wxPoint& aMoveVector = { 0, 0 },
247  const double& aRotationAngle = 0.0,
248  const double& aScalingFactor = 1.0,
249  const wxPoint& aTransformCentre = { 0, 0 },
250  const bool& aMirrorInvert = false );
251 
266  void drawCadstarVerticesAsShapes( const std::vector<VERTEX>& aCadstarVertices,
267  const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
268  BOARD_ITEM_CONTAINER* aContainer,
269  const GROUP_ID& aCadstarGroupID = wxEmptyString,
270  const wxPoint& aMoveVector = { 0, 0 },
271  const double& aRotationAngle = 0.0,
272  const double& aScalingFactor = 1.0,
273  const wxPoint& aTransformCentre = { 0, 0 },
274  const bool& aMirrorInvert = false );
275 
288  std::vector<PCB_SHAPE*> getShapesFromVertices( const std::vector<VERTEX>& aCadstarVertices,
289  BOARD_ITEM_CONTAINER* aContainer = nullptr,
290  const GROUP_ID& aCadstarGroupID = wxEmptyString,
291  const wxPoint& aMoveVector = { 0, 0 },
292  const double& aRotationAngle = 0.0,
293  const double& aScalingFactor = 1.0,
294  const wxPoint& aTransformCentre = { 0, 0 },
295  const bool& aMirrorInvert = false );
296 
310  PCB_SHAPE* getShapeFromVertex( const POINT& aCadstarStartPoint,
311  const VERTEX& aCadstarVertex,
312  BOARD_ITEM_CONTAINER* aContainer = nullptr,
313  const GROUP_ID& aCadstarGroupID = wxEmptyString,
314  const wxPoint& aMoveVector = { 0, 0 },
315  const double& aRotationAngle = 0.0,
316  const double& aScalingFactor = 1.0,
317  const wxPoint& aTransformCentre = { 0, 0 },
318  const bool& aMirrorInvert = false );
319 
327  ZONE* getZoneFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness,
328  BOARD_ITEM_CONTAINER* aParentContainer );
329 
342  SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape,
343  const int& aLineThickness = -1,
344  BOARD_ITEM_CONTAINER* aContainer = nullptr,
345  const wxPoint& aMoveVector = { 0, 0 },
346  const double& aRotationAngle = 0.0,
347  const double& aScalingFactor = 1.0,
348  const wxPoint& aTransformCentre = { 0, 0 },
349  const bool& aMirrorInvert = false );
350 
356  SHAPE_LINE_CHAIN getLineChainFromShapes( const std::vector<PCB_SHAPE*> aShapes );
357 
369  std::vector<PCB_TRACK*> makeTracksFromShapes( const std::vector<PCB_SHAPE*> aShapes,
370  BOARD_ITEM_CONTAINER* aParentContainer,
371  NETINFO_ITEM* aNet = nullptr,
372  PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
373  int aWidthOverride = -1 );
374 
382  void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
383  const ATTRIBUTE_ID& aCadstarAttributeID, FOOTPRINT* aFootprint,
384  const wxString& aAttributeValue );
385 
394  void applyRouteOffset( wxPoint* aPointToOffset, const wxPoint& aRefPoint,
395  const long& aOffsetAmount );
396 
397  //Helper Functions for obtaining CADSTAR elements in the parsed structures
398  int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
399  COPPERCODE getCopperCode( const COPPERCODE_ID& aCadstaCopperCodeID );
400  HATCHCODE getHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
401  LAYERPAIR getLayerPair( const LAYERPAIR_ID& aCadstarLayerPairID );
402  PADCODE getPadCode( const PADCODE_ID& aCadstarPadCodeID );
403  PART getPart( const PART_ID& aCadstarPartID );
404  ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
405  TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
406  VIACODE getViaCode( const VIACODE_ID& aCadstarViaCodeID );
407  wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
408  wxString getAttributeValue( const ATTRIBUTE_ID& aCadstarAttributeID,
409  const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
410 
411  // Helper Functions for obtaining individual elements as KiCad elements:
412  double getHatchCodeAngleDegrees( const HATCHCODE_ID& aCadstarHatchcodeID );
413  PAD* getKiCadPad( const COMPONENT_PAD& aCadstarPad, FOOTPRINT* aParent );
414  PAD*& getPadReference( FOOTPRINT* aFootprint, const PAD_ID aCadstarPadID );
415  FOOTPRINT* getFootprintFromCadstarID( const COMPONENT_ID& aCadstarComponentID );
416  int getKiCadHatchCodeThickness( const HATCHCODE_ID& aCadstarHatchcodeID );
417  int getKiCadHatchCodeGap( const HATCHCODE_ID& aCadstarHatchcodeID );
418  PCB_GROUP* getKiCadGroup( const GROUP_ID& aCadstarGroupID );
419 
425  wxPoint getKiCadPoint( const wxPoint& aCadstarPoint );
426 
432  int getKiCadLength( long long aCadstarLength )
433  {
434  return aCadstarLength * KiCadUnitMultiplier;
435  }
436 
442  double getAngleTenthDegree( const long long& aCadstarAngle )
443  {
444  // CADSTAR v6 (which outputted Format Version 8) and earlier versions used 1/10 degree
445  // as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Format
446  // Version 9 and later) is the version that introduced 1/1000 degree for angles.
447  if( Header.Format.Version > 8 )
448  {
449  return (double) aCadstarAngle / 100.0;
450  }
451  else
452  {
453  return (double) aCadstarAngle;
454  }
455  }
456 
462  double getAngleDegrees( const long long& aCadstarAngle )
463  {
464  return getAngleTenthDegree( aCadstarAngle ) / 10.0;
465  }
466 
472  double getPolarAngle( const wxPoint& aPoint );
473 
480  NETINFO_ITEM* getKiCadNet( const NET_ID& aCadstarNetID );
481 
488  PCB_LAYER_ID getKiCadCopperLayerID( unsigned int aLayerNum, bool aDetectMaxLayer = true );
489 
495  bool isLayerSet( const LAYER_ID& aCadstarLayerID );
496 
502  PCB_LAYER_ID getKiCadLayer( const LAYER_ID& aCadstarLayerID );
503 
509  LSET getKiCadLayerSet( const LAYER_ID& aCadstarLayerID );
510 
511 
512  bool isFootprint( BOARD_ITEM_CONTAINER* aContainer )
513  {
514  return aContainer && aContainer->Type() == PCB_FOOTPRINT_T;
515  }
516 
517 
518  void addToGroup( const GROUP_ID& aCadstarGroupID, BOARD_ITEM* aKiCadItem );
519 
526  GROUP_ID createUniqueGroupID( const wxString& aName );
527 };
528 
529 
530 #endif // CADSTAR_PCB_ARCHIVE_LOADER_H_
COPPERCODE getCopperCode(const COPPERCODE_ID &aCadstaCopperCodeID)
int getKiCadLength(long long aCadstarLength)
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.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
void applyDimensionSettings(const DIMENSION &aCadstarDim, PCB_DIMENSION_BASE *aKiCadDim)
Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format based on S-expressions.
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
Container for project specific data.
Definition: project.h:62
double getAngleDegrees(const long long &aCadstarAngle)
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
std::map< COMPONENT_ID, FOOTPRINT * > m_componentMap
Map between Cadstar and KiCad components on the board.
double getAngleTenthDegree(const long long &aCadstarAngle)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
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 wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
wxPoint getKiCadPoint(const wxPoint &aCadstarPoint)
Scales, offsets and inverts y axis to make the point usable directly in KiCad.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
A progress reporter interface for use in multi-threaded environments.
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
LAYER_MAPPING_HANDLER m_layerMappingHandler
Callback to get layer mapping.
wxPoint m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
PCB_GROUP * getKiCadGroup(const GROUP_ID &aCadstarGroupID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
long PAD_ID
Pad identifier (pin) in the PCB.
void remapUnsureLayers()
Callback m_layerMappingHandler for layers we aren't sure of.
bool m_doneSpacingClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
std::map< SYMDEF_ID, FOOTPRINT * > m_libraryMap
Map between Cadstar and KiCad components in the library.
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
Abstract dimension API.
Definition: pcb_dimension.h:95
void checkAndLogHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
std::set< HATCHCODE_ID > m_hatchcodesTested
Used by checkAndLogHatchCode() to avoid multiple duplicate warnings.
void loadComponentAttributes(const COMPONENT &aComponent, FOOTPRINT *aFootprint)
void logBoardStackupWarning(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
void loadLibraryPads(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
std::vector< FOOTPRINT * > GetLoadedLibraryFootpints() const
Return a copy of the loaded library footprints (caller owns the objects)
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
std::map< GROUP_ID, PCB_GROUP * > m_groupMap
Map between Cadstar and KiCad groups.
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.
void loadLibraryAreas(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
PAD * getKiCadPad(const COMPONENT_PAD &aCadstarPad, FOOTPRINT *aParent)
bool m_doneNetClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
double getPolarAngle(const wxPoint &aPoint)
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
PART getPart(const PART_ID &aCadstarPartID)
Normal via.
Definition: router_tool.cpp:70
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 wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
void initStackupItem(const LAYER &aCadstarLayer, BOARD_STACKUP_ITEM *aKiCadItem, int aDielectricSublayer)
void loadLibraryCoppers(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
Represent a set of closed polygons.
bool isFootprint(BOARD_ITEM_CONTAINER *aContainer)
int loadNetVia(const NET_ID &aCadstarNetID, const NET_PCB::VIA &aCadstarVia)
Load via and return via size.
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
CADSTAR_PCB_ARCHIVE_LOADER(wxString aFilename, LAYER_MAPPING_HANDLER aLayerMappingHandler, bool aLogLayerWarnings, PROGRESS_REPORTER *aProgressReporter)
void applyRouteOffset(wxPoint *aPointToOffset, const wxPoint &aRefPoint, const long &aOffsetAmount)
CADSTAR's Post Processor does an action called "Route Offset" which is applied when a route is wider ...
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
An abstract shape on 2D plane.
Definition: shape.h:116
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())
int getKiCadHatchCodeThickness(const HATCHCODE_ID &aCadstarHatchcodeID)
void Load(BOARD *aBoard, PROJECT *aProject)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
std::map< TEMPLATE_ID, ZONE * > m_zonesMap
Map between Cadstar and KiCad zones.
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
Manage one layer needed to make a physical board.
Definition: board_stackup.h:89
PCB_SHAPE * getShapeFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
std::map< PAD_ID, std::vector< PAD_ID > > ASSOCIATED_COPPER_PADS
Map of pad anchor points (first) to copper pads (second).
Represents a CADSTAR PCB Archive (CPA) file.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
PADCODE getPadCode(const PADCODE_ID &aCadstarPadCodeID)
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
Handle the data for a net.
Definition: netinfo.h:64
std::map< NET_ID, NETINFO_ITEM * > m_netMap
Map between Cadstar and KiCad Nets.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
bool m_logLayerWarnings
Used in loadBoardStackup()
GROUP_ID createUniqueGroupID(const wxString &aName)
Adds a new PCB_GROUP* to m_groupMap.
Represent a polyline (an zero-thickness chain of connected line segments).
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
PCB_LAYER_ID getKiCadLayer(const LAYER_ID &aCadstarLayerID)
PROGRESS_REPORTER * m_progressReporter
PAD *& getPadReference(FOOTPRINT *aFootprint, const PAD_ID aCadstarPadID)
void addToGroup(const GROUP_ID &aCadstarGroupID, BOARD_ITEM *aKiCadItem)
void loadLibraryFigures(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
void calculateZonePriorities()
Tries to make a best guess as to the zone priorities based on the pour status.
long Version
Archive version number (e.g.
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
bool isLayerSet(const LAYER_ID &aCadstarLayerID)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
std::map< LAYER_ID, PCB_LAYER_ID > m_layermap
Map between Cadstar and KiCad Layers.
Definition: pad.h:57
double getHatchCodeAngleDegrees(const HATCHCODE_ID &aCadstarHatchcodeID)
std::map< SYMDEF_ID, ASSOCIATED_COPPER_PADS > m_librarycopperpads
Associated copper pads (if any) for each component library definition.
HATCHCODE getHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
FOOTPRINT * getFootprintFromCadstarID(const COMPONENT_ID &aCadstarComponentID)
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 wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the cutouts on m_board object.
VIACODE getViaCode(const VIACODE_ID &aCadstarViaCodeID)
std::map< ROUTECODE_ID, NETCLASSPTR > m_netClassMap
Map between Cadstar and KiCad classes.
std::vector< LAYER_ID > m_powerPlaneLayers
List of layers that are marked as power plane in CADSTAR.
LSET getKiCadLayerSet(const LAYER_ID &aCadstarLayerID)
SHAPE_POLY_SET getPolySetFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness=-1, BOARD_ITEM_CONTAINER *aContainer=nullptr, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &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)
int m_numNets
Number of nets loaded so far.
SHAPE_LINE_CHAIN getLineChainFromShapes(const std::vector< PCB_SHAPE * > aShapes)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
int KiCadUnitMultiplier
Use this value to convert units in this CPA file to KiCad units.
Linear, leader (radius/diameter) or angular dimension.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
std::vector< PCB_SHAPE * > getShapesFromVertices(const std::vector< VERTEX > &aCadstarVertices, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a vector of pointers to PCB_SHAPE objects.