Use default stackup if stackup is not defined in STEP/BREP/XAO export.

This commit is contained in:
Alex Shvartzkop 2024-04-26 15:25:45 +03:00
parent 01ce6111ff
commit b3bc352c57
4 changed files with 17 additions and 17 deletions

View File

@ -494,22 +494,10 @@ HANDLER_RESULT<BoardStackupResponse> API_HANDLER_PCB::handleGetStackup( GetBoard
if( !documentValidation )
return tl::unexpected( documentValidation.error() );
const BOARD* board = frame()->GetBoard();
BoardStackupResponse response;
BoardStackupResponse response;
google::protobuf::Any any;
const BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
if( frame()->GetBoard()->GetDesignSettings().m_HasStackup )
{
const BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
stackup.Serialize( any );
}
else
{
BOARD_STACKUP stackup;
stackup.BuildDefaultStackupList( &bds, board->GetCopperLayerCount() );
stackup.Serialize( any );
}
frame()->GetBoard()->GetStackupOrDefault().Serialize( any );
any.UnpackTo( response.mutable_stackup() );

View File

@ -2174,6 +2174,17 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetC
}
BOARD_STACKUP BOARD::GetStackupOrDefault() const
{
if( GetDesignSettings().m_HasStackup )
return GetDesignSettings().GetStackupDescriptor();
BOARD_STACKUP stackup;
stackup.BuildDefaultStackupList( &GetDesignSettings(), GetCopperLayerCount() );
return stackup;
}
std::tuple<int, double, double> BOARD::GetTrackLength( const PCB_TRACK& aTrack ) const
{
int count = 0;

View File

@ -26,6 +26,7 @@
#define CLASS_BOARD_H_
#include <board_item_container.h>
#include <board_stackup_manager/board_stackup.h>
#include <common.h> // Needed for stl hash extensions
#include <convert_shape_list_to_polygon.h> // for OUTLINE_ERROR_HANDLER
#include <hash.h>
@ -660,6 +661,8 @@ public:
*/
BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
BOARD_STACKUP GetStackupOrDefault() const;
// Tented vias are vias covered by solder mask. So because the solder mask is a negative
// layer, tented vias are NOT plotted on solder mask layers
bool GetTentVias() const { return !m_plotOptions.GetPlotViaOnMaskLayer(); }

View File

@ -448,9 +448,7 @@ bool EXPORTER_STEP::buildBoard3DShapes()
m_pcbModel->SetBoardColor( m_solderMaskColor.r, m_solderMaskColor.g, m_solderMaskColor.b );
m_pcbModel->SetCopperColor( m_copperColor.r, m_copperColor.g, m_copperColor.b );
wxCHECK( m_board->GetDesignSettings().m_HasStackup, false );
m_pcbModel->SetStackup( m_board->GetDesignSettings().GetStackupDescriptor() );
m_pcbModel->SetStackup( m_board->GetStackupOrDefault() );
m_pcbModel->SetEnabledLayers( layersToExport );
m_pcbModel->SetFuseShapes( m_params.m_fuseShapes );
m_pcbModel->SetNetFilter( m_params.m_netFilter );