43 const int courtyardEpsilon =
pcbIUScale.mmToIU( 0.005 );
69 const int courtyardH =
pcbIUScale.mmToIU( 1.0 );
70 const int courtyardW =
pcbIUScale.mmToIU( 2.0 );
72 const std::vector<VECTOR2I> courtyardPoints = {
75 { courtyardW, courtyardH },
103 std::unique_ptr<PCB_SHAPE> courtyardPoly = std::make_unique<PCB_SHAPE>( &fp,
SHAPE_T::POLY );
104 courtyardPoly->SetLayer(
F_CrtYd );
105 courtyardPoly->SetPolyPoints( courtyardPoints );
106 courtyardPoly->SetWidth( lineW );
108 fp.
Add( courtyardPoly.release() );
118 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
124 fp.
Move( moveVector );
125 expectedCourtyard.
Move( moveVector );
126 expectedHull.
Move( moveVector );
130 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
132 assertHullMatch( expectedHull );
141 assertCourtyardMatches(
F_CrtYd, expectedCourtyard );
143 assertHullMatch( expectedHull );
154 assertCourtyardMatches(
B_CrtYd, expectedCourtyard );
156 assertHullMatch( expectedHull );
172 file->name = wxS(
"model.step" );
177 std::string payload( 4096,
'k' );
178 file->decompressedData.assign( payload.begin(), payload.end() );
181 hash.
add( file->decompressedData );
193 std::vector<std::unique_ptr<FOOTPRINT>> clones;
195 for(
int ii = 0; ii < 4; ++ii )
199 clones.back()->GetEmbeddedFile( wxS(
"model.step" ) );
218 const int shapeSize =
pcbIUScale.mmToIU( 3.0 );
221 std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( &fp,
SHAPE_T::RECTANGLE );
222 shape->SetLayer(
F_Cu );
223 shape->SetStart(
VECTOR2I( 0, 0 ) );
224 shape->SetEnd(
VECTOR2I( shapeSize, shapeSize ) );
227 fp.
Add( shape.release() );
239 std::unique_ptr<PCB_FIELD> field( fp.
GetField(
id ) );
252 wxString token = wxS(
"VALUE" );
270 userField->
SetText( wxS(
"PESD5V0S1BL" ) );
271 fp->
Add( userField );
280 std::vector<PCB_FIELD> newFields;
285 newFields.push_back( *fp->
GetField(
id ) );
288 newFields[1].SetText( wxS(
"new value" ) );
291 std::vector<PCB_FIELD*> added;
292 std::vector<PCB_FIELD*> detached;
336 std::vector<PCB_FIELD> newFields;
339 newFields.push_back( *field );
347 std::vector<PCB_FIELD*> added;
348 std::vector<PCB_FIELD*> detached;
365 std::vector<PCB_FIELD> newFields;
370 newFields.push_back( *fp.
GetField(
id ) );
374 fp.
Remove( orphan.get() );
377 std::vector<PCB_FIELD*> added;
378 std::vector<PCB_FIELD*> detached;
402 footprint.
Add( poly );
431 auto addPad = [](
FOOTPRINT* aFootprint )
434 pad->SetNumber(
"1" );
437 aFootprint->Add(
pad );
442 auto update = [&](
bool aResetClearanceOverrides )
447 PAD*
pad = addPad( existing );
451 board.
Add( existing );
456 addPad( fromLibrary );
461 true,
true,
true, aResetClearanceOverrides,
true,
false );
462 commit.
Push( wxT(
"Update Footprint" ) );
468 return fromLibrary->
Pads()[0];
471 const PAD* kept = update(
false );
477 const PAD* reset = update(
true );
constexpr EDA_IU_SCALE pcbIUScale
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
BOARD_ITEM_CONTAINER * GetParent() const
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, FLIP_DIRECTION aFlipDirection, bool aMatchPadPositions, bool aDeleteExtraTexts=true, bool aResetTextLayers=true, bool aResetTextEffects=true, bool aResetTextPositions=true, bool aResetTextContent=true, bool aResetFabricationAttrs=true, bool aResetClearanceOverrides=true, bool aReset3DModels=true, bool aResetTransform=false, bool *aUpdated=nullptr, bool *aShifted=nullptr)
Replace aExisting with aNew, preserving connectivity and metadata.
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
static constexpr BOX2< VECTOR2I > ByCorners(const VECTOR2I &aCorner1, const VECTOR2I &aCorner2)
SHAPE_POLY_SET & GetPolyShape()
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
bool HasFile(const wxString &name) const
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
static RETURN_CODE CompressAndEncode(EMBEDDED_FILE &aFile)
Take data from the decompressedData buffer and compresses it using ZSTD into the compressedEncodedDat...
A logical library item identifier and consists of various portions much like a URI.
A streaming C++ equivalent for MurmurHash3_x64_128.
FORCE_INLINE void add(const std::string &input)
FORCE_INLINE HASH_128 digest()
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
ZONE_CONNECTION GetLocalZoneConnection() const
void SetPolyShape(const SHAPE_POLY_SET &aShape) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
SHAPE_POLY_SET GetLibraryPolyShape() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void Mirror(const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection)
Mirror the line points about y or x (or both).
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_360
static constexpr EDA_ANGLE ANGLE_180
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID
A quick note on layer IDs:
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
bool ChainsAreCyclicallyEqual(const SHAPE_LINE_CHAIN &aChainA, const SHAPE_LINE_CHAIN &aChainB, int aTol)
Check that two chains are cyclically equal.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Utility functions for working with shapes.
std::string ToString() const
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
BOOST_CHECK_PREDICATE(ArePolylineEndPointsNearCircle,(chain)(c.m_geom.m_center_point)(radius)(accuracy+epsilon))
BOOST_TEST_CONTEXT("Test Clearance")
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
VECTOR2< int32_t > VECTOR2I
@ FULL
pads are covered by copper