Adjust dimension units when placing footprints on board.
Fixes https://gitlab.com/kicad/code/kicad/issues/13339
This commit is contained in:
parent
fc346ea794
commit
20f2232d4e
|
@ -245,6 +245,28 @@ void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint )
|
||||||
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
|
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
|
||||||
// it might be stored in another orientation if the lib is an archive built from a board)
|
// it might be stored in another orientation if the lib is an archive built from a board)
|
||||||
aFootprint->SetOrientation( ANGLE_0 );
|
aFootprint->SetOrientation( ANGLE_0 );
|
||||||
|
|
||||||
|
EDA_UNITS units = GetUserUnits();
|
||||||
|
|
||||||
|
INSPECTOR_FUNC inspector =
|
||||||
|
[units]( EDA_ITEM* aItem, void* aTestData )
|
||||||
|
{
|
||||||
|
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( aItem );
|
||||||
|
|
||||||
|
if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
|
||||||
|
{
|
||||||
|
dimension->SetUnits( units );
|
||||||
|
dimension->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return INSPECT_RESULT::CONTINUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
aFootprint->Visit( inspector, nullptr, { PCB_FP_DIM_ALIGNED_T,
|
||||||
|
PCB_FP_DIM_LEADER_T,
|
||||||
|
PCB_FP_DIM_ORTHOGONAL_T,
|
||||||
|
PCB_FP_DIM_CENTER_T,
|
||||||
|
PCB_FP_DIM_RADIAL_T } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1113,7 +1113,10 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
|
||||||
{
|
{
|
||||||
// Dimensions need to have their units updated if they are automatic
|
// Dimensions need to have their units updated if they are automatic
|
||||||
if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
|
if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
|
||||||
|
{
|
||||||
dimension->SetUnits( frame()->GetUserUnits() );
|
dimension->SetUnits( frame()->GetUserUnits() );
|
||||||
|
dimension->Update();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for( BOARD_ITEM* item : aItems )
|
for( BOARD_ITEM* item : aItems )
|
||||||
|
|
Loading…
Reference in New Issue