diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 2f1e8f1dd0..390b96365b 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -133,6 +133,7 @@ enum KICAD_T PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_ARC_T, PCB_SHAPE_LOCATE_POLY_T, + PCB_SHAPE_LOCATE_BEZIER_T, // Schematic draw Items. The order of these items effects the sort order. // It is currently ordered to mimic the old Eeschema locate behavior where diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 33ecd53b58..caab8db19d 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -77,6 +77,8 @@ bool PCB_SHAPE::IsType( const std::vector& aScanTypes ) const sametype = m_shape == SHAPE_T::SEGMENT; else if( scanType == PCB_SHAPE_LOCATE_POLY_T ) sametype = m_shape == SHAPE_T::POLY; + else if( scanType == PCB_SHAPE_LOCATE_BEZIER_T ) + sametype = m_shape == SHAPE_T::BEZIER; if( sametype ) return true; diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index 3b10a85bc0..cb48db99be 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -151,7 +151,8 @@ bool CONVERT_TOOL::Init() m_menu->SetTitle( _( "Create from Selection" ) ); auto graphicLines = S_C::OnlyTypes( { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_RECT_T, - PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_ARC_T } ) + PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_ARC_T, + PCB_SHAPE_LOCATE_BEZIER_T } ) && P_S_C::SameLayer(); auto graphicToTrack = S_C::OnlyTypes( { PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_LOCATE_ARC_T } ); @@ -452,6 +453,36 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::dequeIsType( { PCB_SHAPE_LOCATE_BEZIER_T } ) ) + { + PCB_SHAPE* graphic = static_cast( aItem ); + + if( aAnchor == graphic->GetStart() ) + { + for( auto it = graphic->GetBezierPoints().begin(); + it != graphic->GetBezierPoints().end(); + ++it ) + { + if( aDirection ) + outline.Append( *it ); + else + outline.Insert( 0, *it ); + } + + } + else + { + for( auto it = graphic->GetBezierPoints().rbegin(); + it != graphic->GetBezierPoints().rend(); + ++it ) + { + if( aDirection ) + outline.Append( *it ); + else + outline.Insert( 0, *it ); + } + } + } else { std::optional nextSeg = getStartEndPoints( aItem, &width ); @@ -921,6 +952,7 @@ std::optional CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth case SHAPE_T::SEGMENT: case SHAPE_T::ARC: case SHAPE_T::POLY: + case SHAPE_T::BEZIER: if( shape->GetStart() == shape->GetEnd() ) return std::nullopt;