more about step exporter (export more copper graphic objects).
This commit is contained in:
parent
c54c254f96
commit
636e63f0c5
|
@ -28,6 +28,7 @@
|
||||||
#include <board_design_settings.h>
|
#include <board_design_settings.h>
|
||||||
#include <footprint.h>
|
#include <footprint.h>
|
||||||
#include <pcb_track.h>
|
#include <pcb_track.h>
|
||||||
|
#include <pcb_shape.h>
|
||||||
#include <pad.h>
|
#include <pad.h>
|
||||||
#include <fp_lib_table.h>
|
#include <fp_lib_table.h>
|
||||||
#include "step_pcb_model.h"
|
#include "step_pcb_model.h"
|
||||||
|
@ -280,7 +281,6 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||||
if( pcblayer != F_Cu && pcblayer != B_Cu )
|
if( pcblayer != F_Cu && pcblayer != B_Cu )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SHAPE_POLY_SET copper_shapes;
|
|
||||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
if( pcblayer == F_Cu )
|
if( pcblayer == F_Cu )
|
||||||
|
@ -288,7 +288,32 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
|
||||||
else
|
else
|
||||||
aTrack->TransformShapeToPolygon( m_bottom_copper_shapes, pcblayer, 0, maxError, ERROR_INSIDE );
|
aTrack->TransformShapeToPolygon( m_bottom_copper_shapes, pcblayer, 0, maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
//m_pcbModel->AddCopperPolygonShapes( &copper_shapes, pcblayer == F_Cu, aOrigin );
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin )
|
||||||
|
{
|
||||||
|
PCB_SHAPE* graphic = dynamic_cast<PCB_SHAPE*>( aItem );
|
||||||
|
|
||||||
|
if( ! graphic )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PCB_LAYER_ID pcblayer = graphic->GetLayer();
|
||||||
|
|
||||||
|
if( pcblayer != F_Cu && pcblayer != B_Cu )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SHAPE_POLY_SET copper_shapes;
|
||||||
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
|
|
||||||
|
if( pcblayer == F_Cu )
|
||||||
|
graphic->TransformShapeToPolygon( m_top_copper_shapes, pcblayer, 0,
|
||||||
|
maxError, ERROR_INSIDE );
|
||||||
|
else
|
||||||
|
graphic->TransformShapeToPolygon( m_bottom_copper_shapes, pcblayer, 0,
|
||||||
|
maxError, ERROR_INSIDE );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -345,6 +370,9 @@ bool EXPORTER_STEP::buildBoard3DShapes()
|
||||||
{
|
{
|
||||||
for( PCB_TRACK* track : m_board->Tracks() )
|
for( PCB_TRACK* track : m_board->Tracks() )
|
||||||
buildTrack3DShape( track, origin );
|
buildTrack3DShape( track, origin );
|
||||||
|
|
||||||
|
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||||
|
buildGraphic3DShape( item, origin );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_top_copper_shapes.Fracture( SHAPE_POLY_SET::PM_FAST );
|
m_top_copper_shapes.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
class PCBMODEL;
|
class PCBMODEL;
|
||||||
class BOARD;
|
class BOARD;
|
||||||
|
class BOARD_ITEM;
|
||||||
class FOOTPRINT;
|
class FOOTPRINT;
|
||||||
class PCB_TRACK;
|
class PCB_TRACK;
|
||||||
class FILENAME_RESOLVER;
|
class FILENAME_RESOLVER;
|
||||||
|
@ -90,6 +91,7 @@ private:
|
||||||
bool buildBoard3DShapes();
|
bool buildBoard3DShapes();
|
||||||
bool buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOrigin );
|
bool buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOrigin );
|
||||||
bool buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin );
|
bool buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin );
|
||||||
|
bool buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin );
|
||||||
void calculatePcbThickness();
|
void calculatePcbThickness();
|
||||||
|
|
||||||
EXPORTER_STEP_PARAMS m_params;
|
EXPORTER_STEP_PARAMS m_params;
|
||||||
|
|
|
@ -573,7 +573,8 @@ bool STEP_PCB_MODEL::CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin )
|
||||||
for( TopoDS_Shape& hole : m_cutouts )
|
for( TopoDS_Shape& hole : m_cutouts )
|
||||||
holelist.Append( hole );
|
holelist.Append( hole );
|
||||||
|
|
||||||
// Remove holes for each board (usually there is only one board)
|
// Remove holes for each item (board body or bodies, one can have more than one board)
|
||||||
|
// and copper items (copper_item_count items)
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for( TopoDS_Shape& board: m_board_outlines )
|
for( TopoDS_Shape& board: m_board_outlines )
|
||||||
{
|
{
|
||||||
|
@ -659,7 +660,7 @@ bool STEP_PCB_MODEL::CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin )
|
||||||
|
|
||||||
// color the PCB
|
// color the PCB
|
||||||
TopExp_Explorer topex;
|
TopExp_Explorer topex;
|
||||||
topex.Init( m_assy->GetShape( pcb_label ), TopAbs_COMPOUND /*TopAbs_SOLID*/ );
|
topex.Init( m_assy->GetShape( pcb_label ), TopAbs_SOLID );
|
||||||
|
|
||||||
while( topex.More() )
|
while( topex.More() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue