KiCad PCB EDA Suite
PCAD2KICAD::PCB_CUTOUT Class Reference

#include <pcb_cutout.h>

Inheritance diagram for PCAD2KICAD::PCB_CUTOUT:
PCAD2KICAD::PCB_POLYGON PCAD2KICAD::PCB_COMPONENT

Public Member Functions

 PCB_CUTOUT (PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
 
 ~PCB_CUTOUT ()
 
virtual bool Parse (XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion) override
 
virtual void SetPosOffset (int aX_offs, int aY_offs) override
 
virtual void Flip () override
 
void AddToFootprint (FOOTPRINT *aFootprint) override
 
void AddToBoard () override
 
void AssignNet (const wxString &aNetName)
 
void SetOutline (VERTICES_ARRAY *aOutline)
 
void FormPolygon (XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion)
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (wxString aNetName) const
 

Public Attributes

int m_width
 
int m_priority
 
VERTICES_ARRAY m_outline
 
ISLANDS_ARRAY m_islands
 
ISLANDS_ARRAY m_cutouts
 
int m_tag
 
char m_objType
 
int m_PCadLayer
 
PCB_LAYER_ID m_KiCadLayer
 
KIID m_uuid
 
int m_positionX
 
int m_positionY
 
int m_rotation
 
TTEXTVALUE m_name
 
wxString m_net
 
int m_netCode
 
wxString m_compRef
 
wxString m_patGraphRefName
 

Protected Attributes

bool m_filled
 
PCB_CALLBACKSm_callbacks
 
BOARDm_board
 

Detailed Description

Definition at line 39 of file pcb_cutout.h.

Constructor & Destructor Documentation

◆ PCB_CUTOUT()

PCAD2KICAD::PCB_CUTOUT::PCB_CUTOUT ( PCB_CALLBACKS aCallbacks,
BOARD aBoard,
int  aPCadLayer 
)

Definition at line 36 of file pcb_cutout.cpp.

36  :
37  PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
38 {
39  m_objType = wxT( 'C' );
40 }
PCB_POLYGON(PCB_CALLBACKS *aCallbacks, BOARD *aBoard, int aPCadLayer)
Definition: pcb_polygon.cpp:39

References PCAD2KICAD::PCB_COMPONENT::m_objType.

◆ ~PCB_CUTOUT()

PCAD2KICAD::PCB_CUTOUT::~PCB_CUTOUT ( )

Definition at line 43 of file pcb_cutout.cpp.

44 {
45 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_POLYGON::AddToBoard ( )
overridevirtualinherited

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 187 of file pcb_polygon.cpp.

188 {
189  int i = 0;
190 
191  if( m_outline.GetCount() > 0 )
192  {
193  ZONE* zone = new ZONE( m_board );
194  m_board->Add( zone, ADD_MODE::APPEND );
195 
196  zone->SetLayer( m_KiCadLayer );
197  zone->SetNetCode( m_netCode );
198 
199  // add outline
200  for( i = 0; i < (int) m_outline.GetCount(); i++ )
201  {
202  zone->AppendCorner( wxPoint( KiROUND( m_outline[i]->x ),
203  KiROUND( m_outline[i]->y ) ), -1 );
204  }
205 
206  zone->SetLocalClearance( m_width );
207 
208  zone->SetPriority( m_priority );
209 
211  zone->GetDefaultHatchPitch(), true );
212 
213  if ( m_objType == wxT( 'K' ) )
214  {
215  zone->SetIsRuleArea( true );
216  zone->SetDoNotAllowTracks( true );
217  zone->SetDoNotAllowVias( true );
218  zone->SetDoNotAllowPads( true );
219  zone->SetDoNotAllowCopperPour( true );
220  zone->SetDoNotAllowFootprints( false );
221  }
222  else if( m_objType == wxT( 'C' ) )
223  {
224  // convert cutouts to keepouts because standalone cutouts are not supported in KiCad
225  zone->SetIsRuleArea( true );
226  zone->SetDoNotAllowCopperPour( true );
227  zone->SetDoNotAllowTracks( false );
228  zone->SetDoNotAllowVias( false );
229  zone->SetDoNotAllowPads( false );
230  zone->SetDoNotAllowFootprints( false );
231  }
232 
233  //if( m_filled )
234  // zone->BuildFilledPolysListData( m_board );
235  }
236 }
void SetDoNotAllowTracks(bool aEnable)
Definition: zone.h:742
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Set all hatch parameters for the zone.
Definition: zone.cpp:896
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void SetPriority(unsigned aPriority)
Definition: zone.h:117
void SetIsRuleArea(bool aEnable)
Definition: zone.h:739
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:563
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
static int GetDefaultHatchPitch()
Definition: zone.cpp:1090
void SetDoNotAllowPads(bool aEnable)
Definition: zone.h:743
void SetDoNotAllowVias(bool aEnable)
Definition: zone.h:741
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:836
void SetDoNotAllowCopperPour(bool aEnable)
Definition: zone.h:740
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:236
void SetLocalClearance(int aClearance)
Definition: zone.h:158
void SetDoNotAllowFootprints(bool aEnable)
Definition: zone.h:744

References BOARD::Add(), APPEND, ZONE::AppendCorner(), DIAGONAL_EDGE, ZONE::GetDefaultHatchPitch(), KiROUND(), PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_netCode, PCAD2KICAD::PCB_COMPONENT::m_objType, PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_POLYGON::m_priority, PCAD2KICAD::PCB_POLYGON::m_width, ZONE::SetBorderDisplayStyle(), ZONE::SetDoNotAllowCopperPour(), ZONE::SetDoNotAllowFootprints(), ZONE::SetDoNotAllowPads(), ZONE::SetDoNotAllowTracks(), ZONE::SetDoNotAllowVias(), ZONE::SetIsRuleArea(), ZONE::SetLayer(), ZONE::SetLocalClearance(), BOARD_CONNECTED_ITEM::SetNetCode(), and ZONE::SetPriority().

◆ AddToFootprint()

void PCAD2KICAD::PCB_POLYGON::AddToFootprint ( FOOTPRINT aFootprint)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 163 of file pcb_polygon.cpp.

164 {
166  {
167  FP_SHAPE* dwg = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::POLYGON );
168  aFootprint->Add( dwg );
169 
170  dwg->SetWidth( 0 );
171  dwg->SetLayer( m_KiCadLayer );
172 
173  auto outline = new std::vector<wxPoint>;
174  for( auto point : m_outline )
175  outline->push_back( wxPoint( point->x, point->y ) );
176 
177  dwg->SetPolyPoints( *outline );
178  dwg->SetStart0( *outline->begin() );
179  dwg->SetEnd0( outline->back() );
180  dwg->SetDrawCoord();
181 
182  delete( outline );
183  }
184 }
void SetEnd0(const wxPoint &aPoint)
Definition: fp_shape.h:114
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Test whether a layer is a non copper layer.
polygon (not yet used for tracks, but could be in microwave apps)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:82
void SetStart0(const wxPoint &aPoint)
Definition: fp_shape.h:111
void SetWidth(int aWidth)
Definition: pcb_shape.h:117
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:468
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Definition: pcb_shape.cpp:1076

References FOOTPRINT::Add(), IsNonCopperLayer(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_POLYGON::m_outline, POLYGON, FP_SHAPE::SetDrawCoord(), FP_SHAPE::SetEnd0(), BOARD_ITEM::SetLayer(), PCB_SHAPE::SetPolyPoints(), FP_SHAPE::SetStart0(), and PCB_SHAPE::SetWidth().

◆ AssignNet()

void PCAD2KICAD::PCB_POLYGON::AssignNet ( const wxString &  aNetName)
inherited

◆ Flip()

void PCAD2KICAD::PCB_POLYGON::Flip ( )
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 239 of file pcb_polygon.cpp.

240 {
242 
244 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521

References PCAD2KICAD::PCB_COMPONENT::Flip(), FlipLayer(), and PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer.

◆ FormPolygon()

void PCAD2KICAD::PCB_POLYGON::FormPolygon ( XNODE aNode,
VERTICES_ARRAY *  aPolygon,
const wxString &  aDefaultMeasurementUnit,
const wxString &  actualConversion 
)
inherited

Definition at line 108 of file pcb_polygon.cpp.

111 {
112  XNODE* lNode;
113  double x, y;
114 
115  lNode = FindNode( aNode, wxT( "pt" ) );
116 
117  while( lNode )
118  {
119  if( lNode->GetName() == wxT( "pt" ) )
120  {
122  lNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
123  aPolygon->Add( new wxRealPoint( x, y ) );
124  }
125 
126  lNode = lNode->GetNext();
127  }
128 }
void SetDoublePrecisionPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, double *aX, double *aY, const wxString &aActualConversion)
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
XNODE * FindNode(XNODE *aChild, const wxString &aTag)

References PCAD2KICAD::FindNode(), XNODE::GetNext(), and PCAD2KICAD::SetDoublePrecisionPosition().

Referenced by PCAD2KICAD::PCB_FOOTPRINT::DoLayerContentsObjects(), PCAD2KICAD::PCB_KEEPOUT::Parse(), PCAD2KICAD::PCB_PLANE::Parse(), Parse(), PCAD2KICAD::PCB_COPPER_POUR::Parse(), and PCAD2KICAD::PCB_POLYGON::Parse().

◆ GetKiCadLayer()

◆ GetNetCode()

int PCAD2KICAD::PCB_COMPONENT::GetNetCode ( wxString  aNetName) const
inlineinherited

◆ Parse()

bool PCAD2KICAD::PCB_CUTOUT::Parse ( XNODE aNode,
const wxString &  aDefaultMeasurementUnit,
const wxString &  actualConversion 
)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_POLYGON.

Definition at line 48 of file pcb_cutout.cpp.

51 {
52  XNODE* lNode;
53 
54  lNode = FindNode( aNode, wxT( "pcbPoly" ) );
55 
56  if( lNode )
57  {
58  // retrieve cutout outline
59  FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
60 
61  m_positionX = m_outline[0]->x;
62  m_positionY = m_outline[0]->y;
63  }
64  else
65  {
66  return false;
67  }
68 
69  return true;
70 }
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
Hold an XML or S-expression element.
Definition: xnode.h:43
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)

References PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_POLYGON::FormPolygon(), PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_COMPONENT::m_positionX, and PCAD2KICAD::PCB_COMPONENT::m_positionY.

Referenced by PCAD2KICAD::PCB_FOOTPRINT::DoLayerContentsObjects().

◆ SetOutline()

void PCAD2KICAD::PCB_POLYGON::SetOutline ( VERTICES_ARRAY *  aOutline)
inherited

Definition at line 92 of file pcb_polygon.cpp.

93 {
94  int i;
95 
96  m_outline.Empty();
97 
98  for( i = 0; i < (int) aOutline->GetCount(); i++ )
99  m_outline.Add( new wxRealPoint( (*aOutline)[i]->x, (*aOutline)[i]->y ) );
100 
101  if( m_outline.Count() > 0 )
102  {
103  m_positionX = m_outline[0]->x;
104  m_positionY = m_outline[0]->y;
105  }
106 }
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47

References PCAD2KICAD::PCB_POLYGON::m_outline, PCAD2KICAD::PCB_COMPONENT::m_positionX, and PCAD2KICAD::PCB_COMPONENT::m_positionY.

Referenced by PCAD2KICAD::PCB_FOOTPRINT::DoLayerContentsObjects().

◆ SetPosOffset()

void PCAD2KICAD::PCB_POLYGON::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
overridevirtualinherited

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 247 of file pcb_polygon.cpp.

248 {
249  int i, island;
250 
251  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
252 
253  for( i = 0; i < (int) m_outline.GetCount(); i++ )
254  {
255  m_outline[i]->x += aX_offs;
256  m_outline[i]->y += aY_offs;
257  }
258 
259  for( island = 0; island < (int) m_islands.GetCount(); island++ )
260  {
261  for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
262  {
263  (*m_islands[island])[i]->x += aX_offs;
264  (*m_islands[island])[i]->y += aY_offs;
265  }
266  }
267 
268  for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
269  {
270  for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
271  {
272  (*m_cutouts[island])[i]->x += aX_offs;
273  (*m_cutouts[island])[i]->y += aY_offs;
274  }
275  }
276 }
ISLANDS_ARRAY m_cutouts
Definition: pcb_polygon.h:49
virtual void SetPosOffset(int aX_offs, int aY_offs)
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:47
ISLANDS_ARRAY m_islands
Definition: pcb_polygon.h:48

References PCAD2KICAD::PCB_POLYGON::m_cutouts, PCAD2KICAD::PCB_POLYGON::m_islands, PCAD2KICAD::PCB_POLYGON::m_outline, and PCAD2KICAD::PCB_COMPONENT::SetPosOffset().

Member Data Documentation

◆ m_board

◆ m_callbacks

◆ m_compRef

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited

◆ m_cutouts

ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_cutouts
inherited

◆ m_filled

bool PCAD2KICAD::PCB_POLYGON::m_filled
protectedinherited

◆ m_islands

ISLANDS_ARRAY PCAD2KICAD::PCB_POLYGON::m_islands
inherited

◆ m_KiCadLayer

◆ m_name

◆ m_net

◆ m_netCode

◆ m_objType

◆ m_outline

◆ m_patGraphRefName

wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited

◆ m_PCadLayer

◆ m_positionX

◆ m_positionY

◆ m_priority

int PCAD2KICAD::PCB_POLYGON::m_priority
inherited

◆ m_rotation

◆ m_tag

int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 48 of file pcb_component.h.

Referenced by PCAD2KICAD::PCB_COMPONENT::PCB_COMPONENT().

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 52 of file pcb_component.h.

◆ m_width

int PCAD2KICAD::PCB_POLYGON::m_width
inherited

The documentation for this class was generated from the following files: