Fix creating polygons from footprint rule areas
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10257
(cherry picked from commit e9b91b6fab
)
This commit is contained in:
parent
d7e790b6c1
commit
4be56825bb
|
@ -122,12 +122,17 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
||||||
int changeFlags = ent.m_type & CHT_FLAGS;
|
int changeFlags = ent.m_type & CHT_FLAGS;
|
||||||
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( ent.m_item );
|
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( ent.m_item );
|
||||||
|
|
||||||
|
wxASSERT( ent.m_item );
|
||||||
|
|
||||||
// Module items need to be saved in the undo buffer before modification
|
// Module items need to be saved in the undo buffer before modification
|
||||||
if( m_isFootprintEditor )
|
if( m_isFootprintEditor )
|
||||||
{
|
{
|
||||||
// Be sure that we are storing a footprint
|
// Be sure that we are storing a footprint
|
||||||
if( ent.m_item->Type() != PCB_FOOTPRINT_T )
|
if( ent.m_item->Type() != PCB_FOOTPRINT_T )
|
||||||
|
{
|
||||||
ent.m_item = ent.m_item->GetParent();
|
ent.m_item = ent.m_item->GetParent();
|
||||||
|
wxASSERT( ent.m_item );
|
||||||
|
}
|
||||||
|
|
||||||
// We have not saved the footprint yet, so let's create an entry
|
// We have not saved the footprint yet, so let's create an entry
|
||||||
if( savedModules.count( ent.m_item ) == 0 )
|
if( savedModules.count( ent.m_item ) == 0 )
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <collectors.h>
|
#include <collectors.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <convert_basic_shapes_to_polygon.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
|
#include <footprint.h>
|
||||||
#include <footprint_edit_frame.h>
|
#include <footprint_edit_frame.h>
|
||||||
#include <fp_shape.h>
|
#include <fp_shape.h>
|
||||||
#include <geometry/shape_compound.h>
|
#include <geometry/shape_compound.h>
|
||||||
|
@ -183,6 +184,10 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( FP_SHAPE* graphic = dynamic_cast<FP_SHAPE*>( selection.Front() ) )
|
if( FP_SHAPE* graphic = dynamic_cast<FP_SHAPE*>( selection.Front() ) )
|
||||||
parentFootprint = graphic->GetParentFootprint();
|
parentFootprint = graphic->GetParentFootprint();
|
||||||
|
else if( FP_ZONE* zone = dynamic_cast<FP_ZONE*>( selection.Front() ) )
|
||||||
|
parentFootprint = static_cast<FOOTPRINT*>( zone->GetParent() );
|
||||||
|
else
|
||||||
|
wxFAIL_MSG( "Unimplemented footprint parent in CONVERT_TOOL::CreatePolys" );
|
||||||
|
|
||||||
BOARD_COMMIT commit( m_frame );
|
BOARD_COMMIT commit( m_frame );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue