step exporter: fix missing initialization of a member (m_pcbName)
in EXPORTER_STEP rename m_pcbName to m_pcbBaseName, to avoid using the same name used also in STEP_PCB_MODEL.
This commit is contained in:
parent
edf6828cf1
commit
0c26014eaa
|
@ -118,12 +118,16 @@ EXPORTER_STEP::EXPORTER_STEP( BOARD* aBoard, const EXPORTER_STEP_PARAMS& aParams
|
|||
m_hasGridOrigin( false ),
|
||||
m_board( aBoard ),
|
||||
m_pcbModel( nullptr ),
|
||||
m_pcbName(),
|
||||
m_boardThickness( DEFAULT_BOARD_THICKNESS_MM )
|
||||
{
|
||||
m_solderMaskColor = COLOR4D( 0.08, 0.20, 0.14, 0.83 );
|
||||
m_copperColor = COLOR4D( 0.7, 0.61, 0.0, 1.0 );
|
||||
|
||||
// Init m_pcbName to the board short filename (no path, no ext)
|
||||
// m_pcbName is used later to identify items in step file
|
||||
wxFileName fn( aBoard->GetFileName() );
|
||||
m_pcbBaseName = fn.GetName();
|
||||
|
||||
m_resolver = std::make_unique<FILENAME_RESOLVER>();
|
||||
m_resolver->Set3DConfigDir( wxT( "" ) );
|
||||
// needed to add the project to the search stack
|
||||
|
@ -342,7 +346,7 @@ bool EXPORTER_STEP::buildBoard3DShapes()
|
|||
else
|
||||
origin = m_params.m_origin;
|
||||
|
||||
m_pcbModel = std::make_unique<STEP_PCB_MODEL>( m_pcbName );
|
||||
m_pcbModel = std::make_unique<STEP_PCB_MODEL>( m_pcbBaseName );
|
||||
|
||||
// TODO: Handle when top & bottom soldermask colours are different...
|
||||
m_pcbModel->SetBoardColor( m_solderMaskColor.r, m_solderMaskColor.g, m_solderMaskColor.b );
|
||||
|
|
|
@ -105,7 +105,10 @@ private:
|
|||
bool m_hasGridOrigin;
|
||||
BOARD* m_board;
|
||||
std::unique_ptr<STEP_PCB_MODEL> m_pcbModel;
|
||||
wxString m_pcbName;
|
||||
|
||||
/// the name of the project (board short filename (no path, no ext)
|
||||
/// used to identify items in step file
|
||||
wxString m_pcbBaseName;
|
||||
|
||||
double m_boardThickness;
|
||||
|
||||
|
|
|
@ -584,11 +584,10 @@ bool STEP_PCB_MODEL::CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin )
|
|||
ReportMessage( wxString::Format( wxT( "added %d/%d shapes\n" ),
|
||||
cnt, (int)m_board_outlines.size() ) );
|
||||
|
||||
BRepAlgoAPI_Cut Cut;
|
||||
TopTools_ListOfShape mainbrd;
|
||||
|
||||
mainbrd.Append( board );
|
||||
|
||||
BRepAlgoAPI_Cut Cut;
|
||||
Cut.SetArguments( mainbrd );
|
||||
|
||||
Cut.SetTools( holelist );
|
||||
|
@ -640,19 +639,21 @@ bool STEP_PCB_MODEL::CreatePCB( SHAPE_POLY_SET& aOutline, VECTOR2D aOrigin )
|
|||
{
|
||||
wxString pcbName;
|
||||
|
||||
// Note, we include the pcb/project name as a prefix
|
||||
// because several STEP importing CAD software like SolidWorks
|
||||
// will deduplicate anything imported by it's STEP name
|
||||
|
||||
if( copper_objects_cnt < copper_item_count )
|
||||
{
|
||||
pcbName = wxString::Format( wxT( "Copper_Item%d" ), copper_objects_cnt+1 );
|
||||
pcbName = wxString::Format( wxT( "%s_Copper_Item%d" ),
|
||||
m_pcbName, copper_objects_cnt+1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Note, we include the pcb/project name as a prefix
|
||||
// because several STEP importing CAD software like SolidWorks
|
||||
// will deduplicate anything imported by it's STEP name
|
||||
if( m_pcb_labels.size() == 1 )
|
||||
pcbName = wxString::Format( wxT( "%s PCB" ), m_pcbName );
|
||||
pcbName = wxString::Format( wxT( "%s_PCB" ), m_pcbName );
|
||||
else
|
||||
pcbName = wxString::Format( wxT( "%s PCB%d" ), m_pcbName, pcbIdx++ );
|
||||
pcbName = wxString::Format( wxT( "%s_PCB%d" ), m_pcbName, pcbIdx++ );
|
||||
}
|
||||
|
||||
std::string pcbNameStdString( pcbName.ToUTF8() );
|
||||
|
|
Loading…
Reference in New Issue