Revert "STEP export: in board outlines, export Circles as Cylinders."
This reverts commit 09515fe821
.
It does not pass a QA test
This commit is contained in:
parent
09515fe821
commit
99bdb82dff
|
@ -238,22 +238,30 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
|
||||||
}
|
}
|
||||||
else if( graphic->GetShape() == SHAPE_T::CIRCLE )
|
else if( graphic->GetShape() == SHAPE_T::CIRCLE )
|
||||||
{
|
{
|
||||||
|
// make a circle by segments;
|
||||||
VECTOR2I center = graphic->GetCenter();
|
VECTOR2I center = graphic->GetCenter();
|
||||||
int radius = graphic->GetRadius();
|
|
||||||
VECTOR2I start = center;
|
VECTOR2I start = center;
|
||||||
|
int radius = graphic->GetRadius();
|
||||||
|
int steps = GetArcToSegmentCount( radius, aErrorMax, FULL_CIRCLE );
|
||||||
|
VECTOR2I nextPt;
|
||||||
|
|
||||||
start.x += radius;
|
start.x += radius;
|
||||||
|
|
||||||
// Add 360 deg Arc in currContour
|
for( int step = 0; step < steps; ++step )
|
||||||
SHAPE_ARC arc360( center, start, ANGLE_360, 0 );
|
|
||||||
currContour.Append( arc360, aErrorMax );
|
|
||||||
currContour.SetClosed( true );
|
|
||||||
|
|
||||||
// set shapeOwners for currContour points created by appending the arc360:
|
|
||||||
for( int ii = 1; ii < currContour.PointCount(); ++ii )
|
|
||||||
{
|
{
|
||||||
shapeOwners[ std::make_pair( currContour.CPoint( ii-1 ),
|
nextPt = start;
|
||||||
currContour.CPoint( ii ) ) ] = graphic;
|
RotatePoint( nextPt, center, ANGLE_360 * step / steps );
|
||||||
|
currContour.Append( nextPt );
|
||||||
|
|
||||||
|
if( firstPt )
|
||||||
|
firstPt = false;
|
||||||
|
else
|
||||||
|
shapeOwners[ std::make_pair( prevPt, nextPt ) ] = graphic;
|
||||||
|
|
||||||
|
prevPt = nextPt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currContour.SetClosed( true );
|
||||||
}
|
}
|
||||||
else if( graphic->GetShape() == SHAPE_T::RECT )
|
else if( graphic->GetShape() == SHAPE_T::RECT )
|
||||||
{
|
{
|
||||||
|
|
|
@ -415,56 +415,6 @@ bool STEP_PCB_MODEL::isBoardOutlineValid()
|
||||||
return m_pcb_labels.size() > 0;
|
return m_pcb_labels.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A helper function to know if a SHAPE_LINE_CHAIN is encoding a circle
|
|
||||||
static bool IsChainCircle( const SHAPE_LINE_CHAIN& aChain )
|
|
||||||
{
|
|
||||||
// If aChain is a circle it
|
|
||||||
// - contains only one arc
|
|
||||||
// - this arc has the same start and end point
|
|
||||||
const std::vector<SHAPE_ARC>& arcs = aChain.CArcs();
|
|
||||||
|
|
||||||
if( arcs.size() == 1 )
|
|
||||||
{
|
|
||||||
const SHAPE_ARC& arc = arcs[0];
|
|
||||||
|
|
||||||
if( arc. GetP0() == arc.GetP1() )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool STEP_PCB_MODEL::MakeShapeAsCylinder( TopoDS_Shape& aShape,
|
|
||||||
const SHAPE_LINE_CHAIN& aChain, double aThickness,
|
|
||||||
double aZposition, const VECTOR2D& aOrigin )
|
|
||||||
{
|
|
||||||
if( !aShape.IsNull() )
|
|
||||||
return false; // there is already data in the shape object
|
|
||||||
|
|
||||||
if( !aChain.IsClosed() )
|
|
||||||
return false; // the loop is not closed
|
|
||||||
|
|
||||||
const std::vector<SHAPE_ARC>& arcs = aChain.CArcs();
|
|
||||||
const SHAPE_ARC& arc = arcs[0];
|
|
||||||
|
|
||||||
TopoDS_Shape base_shape;
|
|
||||||
base_shape = BRepPrimAPI_MakeCylinder(
|
|
||||||
pcbIUScale.IUTomm( arc.GetRadius() ), aThickness ).Shape();
|
|
||||||
gp_Trsf shift;
|
|
||||||
shift.SetTranslation( gp_Vec( pcbIUScale.IUTomm( arc.GetCenter().x - aOrigin.x ),
|
|
||||||
-pcbIUScale.IUTomm( arc.GetCenter().y - aOrigin.y ),
|
|
||||||
aZposition ) );
|
|
||||||
BRepBuilderAPI_Transform round_shape( base_shape, shift );
|
|
||||||
aShape = round_shape;
|
|
||||||
|
|
||||||
if( aShape.IsNull() )
|
|
||||||
{
|
|
||||||
ReportMessage( wxT( "failed to create a cylinder vertical shape\n" ) );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool STEP_PCB_MODEL::MakeShape( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& aChain,
|
bool STEP_PCB_MODEL::MakeShape( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& aChain,
|
||||||
double aThickness, double aZposition, const VECTOR2D& aOrigin )
|
double aThickness, double aZposition, const VECTOR2D& aOrigin )
|
||||||
|
@ -475,10 +425,6 @@ bool STEP_PCB_MODEL::MakeShape( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& aC
|
||||||
if( !aChain.IsClosed() )
|
if( !aChain.IsClosed() )
|
||||||
return false; // the loop is not closed
|
return false; // the loop is not closed
|
||||||
|
|
||||||
// a SHAPE_LINE_CHAIN that is in fact a circle (one 360deg arc) is exported as cylinder
|
|
||||||
if( IsChainCircle( aChain ) )
|
|
||||||
return MakeShapeAsCylinder( aShape, aChain, aThickness, aZposition, aOrigin );
|
|
||||||
|
|
||||||
BRepBuilderAPI_MakeWire wire;
|
BRepBuilderAPI_MakeWire wire;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
|
|
@ -111,30 +111,9 @@ public:
|
||||||
// create the PCB model using the current outlines and drill holes
|
// create the PCB model using the current outlines and drill holes
|
||||||
bool CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin );
|
bool CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin );
|
||||||
|
|
||||||
/**
|
bool MakeShape( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& chain, double aThickness,
|
||||||
* Convert a SHAPE_LINE_CHAIN (closed) to a TopoDS_Shape (polygonal vertical prism)
|
|
||||||
* @param aShape is the TopoDS_Shape to initialize (must be empty)
|
|
||||||
* @param aChain is a closed SHAPE_LINE_CHAIN (a polygon)
|
|
||||||
* @param aThickness is the height of the created prism
|
|
||||||
* @param aOrigin is the origin of the coordinates
|
|
||||||
* @return true if success
|
|
||||||
*/
|
|
||||||
bool MakeShape( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& aChain, double aThickness,
|
|
||||||
double aZposition, const VECTOR2D& aOrigin );
|
double aZposition, const VECTOR2D& aOrigin );
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a SHAPE_LINE_CHAIN containing only one 360 deg arc to a TopoDS_Shape
|
|
||||||
* ( vertical cylinder)
|
|
||||||
* it is a specialized version of MakeShape()
|
|
||||||
* @param aShape is the TopoDS_Shape to initialize (must be empty)
|
|
||||||
* @param aChain is a closed SHAPE_LINE_CHAIN, image of a circle: containing one 360 deg arc
|
|
||||||
* @param aThickness is the height of the created cylinder
|
|
||||||
* @param aOrigin is the origin of the coordinates
|
|
||||||
* @return true if success
|
|
||||||
*/
|
|
||||||
bool MakeShapeAsCylinder( TopoDS_Shape& aShape, const SHAPE_LINE_CHAIN& aChain,
|
|
||||||
double aThickness, double aZposition, const VECTOR2D& aOrigin );
|
|
||||||
|
|
||||||
#ifdef SUPPORTS_IGES
|
#ifdef SUPPORTS_IGES
|
||||||
// write the assembly model in IGES format
|
// write the assembly model in IGES format
|
||||||
bool WriteIGES( const wxString& aFileName );
|
bool WriteIGES( const wxString& aFileName );
|
||||||
|
|
Loading…
Reference in New Issue