more about step exporter (export more copper graphic objects).

This commit is contained in:
jean-pierre charras 2023-03-06 16:35:54 +01:00
parent c54c254f96
commit 636e63f0c5
3 changed files with 35 additions and 4 deletions

View File

@ -28,6 +28,7 @@
#include <board_design_settings.h>
#include <footprint.h>
#include <pcb_track.h>
#include <pcb_shape.h>
#include <pad.h>
#include <fp_lib_table.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 )
return false;
SHAPE_POLY_SET copper_shapes;
int maxError = m_board->GetDesignSettings().m_MaxError;
if( pcblayer == F_Cu )
@ -288,7 +288,32 @@ bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin )
else
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;
}
@ -345,6 +370,9 @@ bool EXPORTER_STEP::buildBoard3DShapes()
{
for( PCB_TRACK* track : m_board->Tracks() )
buildTrack3DShape( track, origin );
for( BOARD_ITEM* item : m_board->Drawings() )
buildGraphic3DShape( item, origin );
}
m_top_copper_shapes.Fracture( SHAPE_POLY_SET::PM_FAST );

View File

@ -36,6 +36,7 @@
class PCBMODEL;
class BOARD;
class BOARD_ITEM;
class FOOTPRINT;
class PCB_TRACK;
class FILENAME_RESOLVER;
@ -90,6 +91,7 @@ private:
bool buildBoard3DShapes();
bool buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOrigin );
bool buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin );
bool buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin );
void calculatePcbThickness();
EXPORTER_STEP_PARAMS m_params;

View File

@ -573,7 +573,8 @@ bool STEP_PCB_MODEL::CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin )
for( TopoDS_Shape& hole : m_cutouts )
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;
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
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() )
{