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 &aDefaultUnits, const wxString &actualConversion)
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (const 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
 
EDA_ANGLE 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 37 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 38 of file pcb_cutout.cpp.

38 :
39 PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
40{
41 m_objType = wxT( 'C' );
42}
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 45 of file pcb_cutout.cpp.

46{
47}

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_POLYGON::AddToBoard ( )
overridevirtualinherited

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 185 of file pcb_polygon.cpp.

186{
187 int i = 0;
188
189 if( m_outline.GetCount() > 0 )
190 {
191 ZONE* zone = new ZONE( m_board );
192 m_board->Add( zone, ADD_MODE::APPEND );
193
194 zone->SetLayer( m_KiCadLayer );
195 zone->SetNetCode( m_netCode );
196
197 // add outline
198 for( i = 0; i < (int) m_outline.GetCount(); i++ )
199 {
200 zone->AppendCorner( VECTOR2I( KiROUND( m_outline[i]->x ),
201 KiROUND( m_outline[i]->y ) ), -1 );
202 }
203
204 zone->SetLocalClearance( m_width );
205
207
209 zone->GetDefaultHatchPitch(), true );
210
211 if ( m_objType == wxT( 'K' ) )
212 {
213 zone->SetIsRuleArea( true );
214 zone->SetDoNotAllowTracks( true );
215 zone->SetDoNotAllowVias( true );
216 zone->SetDoNotAllowPads( true );
217 zone->SetDoNotAllowCopperPour( true );
218 zone->SetDoNotAllowFootprints( false );
219 }
220 else if( m_objType == wxT( 'C' ) )
221 {
222 // convert cutouts to keepouts because standalone cutouts are not supported in KiCad
223 zone->SetIsRuleArea( true );
224 zone->SetDoNotAllowCopperPour( true );
225 zone->SetDoNotAllowTracks( false );
226 zone->SetDoNotAllowVias( false );
227 zone->SetDoNotAllowPads( false );
228 zone->SetDoNotAllowFootprints( false );
229 }
230
231 //if( m_filled )
232 // zone->BuildFilledPolysListData( m_board );
233 }
234}
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:754
VERTICES_ARRAY m_outline
Definition: pcb_polygon.h:66
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void SetDoNotAllowPads(bool aEnable)
Definition: zone.h:708
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch, bool aRebuilBorderdHatch)
Set all hatch parameters for the zone.
Definition: zone.cpp:820
void SetDoNotAllowCopperPour(bool aEnable)
Definition: zone.h:705
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:260
void SetIsRuleArea(bool aEnable)
Definition: zone.h:704
void SetDoNotAllowTracks(bool aEnable)
Definition: zone.h:707
void SetDoNotAllowVias(bool aEnable)
Definition: zone.h:706
void SetLocalClearance(int aClearance)
Definition: zone.h:153
void SetDoNotAllowFootprints(bool aEnable)
Definition: zone.h:709
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:760
void SetAssignedPriority(unsigned aPriority)
Definition: zone.h:107
static int GetDefaultHatchPitch()
Definition: zone.cpp:985
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:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

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::SetAssignedPriority(), ZONE::SetBorderDisplayStyle(), ZONE::SetDoNotAllowCopperPour(), ZONE::SetDoNotAllowFootprints(), ZONE::SetDoNotAllowPads(), ZONE::SetDoNotAllowTracks(), ZONE::SetDoNotAllowVias(), ZONE::SetIsRuleArea(), ZONE::SetLayer(), ZONE::SetLocalClearance(), and BOARD_CONNECTED_ITEM::SetNetCode().

◆ AddToFootprint()

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

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 161 of file pcb_polygon.cpp.

162{
164 {
165 FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
166 aFootprint->Add( dwg );
167
168 dwg->SetStroke( STROKE_PARAMS( 0 ) );
169 dwg->SetLayer( m_KiCadLayer );
170
171 auto outline = new std::vector<VECTOR2I>;
172 for( auto point : m_outline )
173 outline->push_back( VECTOR2I( point->x, point->y ) );
174
175 dwg->SetPolyPoints( *outline );
176 dwg->SetStart0( *outline->begin() );
177 dwg->SetEnd0( outline->back() );
178 dwg->SetDrawCoord();
179
180 delete( outline );
181 }
182}
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:226
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
Definition: eda_shape.cpp:1121
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:568
void SetEnd0(const VECTOR2I &aPoint)
Definition: fp_shape.h:94
void SetStart0(const VECTOR2I &aPoint)
Definition: fp_shape.h:91
virtual void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:80
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:72
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
bool IsNonCopperLayer(int aLayerId)
Test whether a layer is a non copper layer.
Definition: layer_ids.h:836

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

◆ 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 237 of file pcb_polygon.cpp.

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

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 &  aDefaultUnits,
const wxString &  actualConversion 
)
inherited

Definition at line 108 of file pcb_polygon.cpp.

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

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

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

◆ GetKiCadLayer()

◆ GetNetCode()

int PCAD2KICAD::PCB_COMPONENT::GetNetCode ( const 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 50 of file pcb_cutout.cpp.

53{
54 XNODE* lNode;
55
56 lNode = FindNode( aNode, wxT( "pcbPoly" ) );
57
58 if( lNode )
59 {
60 // retrieve cutout outline
61 FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
62
63 m_positionX = m_outline[0]->x;
64 m_positionY = m_outline[0]->y;
65 }
66 else
67 {
68 return false;
69 }
70
71 return true;
72}
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)

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}

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 245 of file pcb_polygon.cpp.

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

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 63 of file pcb_component.h.

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

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 67 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: