EAGLE SCH: Improve detail of curved shape imports (0.01mm error)

Follow-up from https://gitlab.com/kicad/code/kicad/-/merge_requests/1445
This commit is contained in:
Roberto Fernandez Bautista 2023-01-10 22:45:46 +01:00
parent 99d02ac7c0
commit 33249d37b0
4 changed files with 9 additions and 5 deletions

View File

@ -1221,7 +1221,7 @@ SCH_SHAPE* SCH_EAGLE_PLUGIN::loadPolyLine( wxXmlNode* aPolygonNode )
{
SHAPE_ARC arc;
arc.ConstructFromStartEndAngle( prev_pt, pt, -EDA_ANGLE( *prev_curve, DEGREES_T ) );
poly->GetPolyShape().Append( arc );
poly->GetPolyShape().Append( arc, -1, -1, ARC_ACCURACY );
}
else
{
@ -2052,7 +2052,7 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr<LIB_SYMBOL>& aS
{
SHAPE_ARC arc;
arc.ConstructFromStartEndAngle( prev_pt, pt, -EDA_ANGLE( *prev_curve, DEGREES_T ) );
poly->GetPolyShape().Append( arc );
poly->GetPolyShape().Append( arc, -1, -1, ARC_ACCURACY );
}
else
{

View File

@ -81,6 +81,8 @@ typedef boost::ptr_map<wxString, EPART> EPART_LIST;
class SCH_EAGLE_PLUGIN : public SCH_PLUGIN
{
public:
const double ARC_ACCURACY = SCH_IU_PER_MM * 0.01; // 0.01mm
SCH_EAGLE_PLUGIN();
~SCH_EAGLE_PLUGIN();

View File

@ -601,9 +601,11 @@ public:
* @param aArc The arc to be inserted
* @param aOutline Index of the polygon
* @param aHole Index of the hole (-1 for the main outline)
* @param aAccuracy Accuracy of the arc representation in IU
* @return the number of points in the arc (including the interpolated points from the arc)
*/
int Append( SHAPE_ARC& aArc, int aOutline = -1, int aHole = -1 );
int Append( SHAPE_ARC& aArc, int aOutline = -1, int aHole = -1,
double aAccuracy = SHAPE_ARC::DefaultAccuracyForPCB() );
/**
* Adds a vertex in the globally indexed position \a aGlobalIndex.

View File

@ -273,7 +273,7 @@ int SHAPE_POLY_SET::Append( int x, int y, int aOutline, int aHole, bool aAllowDu
}
int SHAPE_POLY_SET::Append( SHAPE_ARC& aArc, int aOutline, int aHole )
int SHAPE_POLY_SET::Append( SHAPE_ARC& aArc, int aOutline, int aHole, double aAccuracy )
{
assert( m_polys.size() );
@ -290,7 +290,7 @@ int SHAPE_POLY_SET::Append( SHAPE_ARC& aArc, int aOutline, int aHole )
assert( aOutline < (int) m_polys.size() );
assert( idx < (int) m_polys[aOutline].size() );
m_polys[aOutline][idx].Append( aArc );
m_polys[aOutline][idx].Append( aArc, aAccuracy );
return m_polys[aOutline][idx].PointCount();
}