diff --git a/pcbnew/api/api_pcb_utils.cpp b/pcbnew/api/api_pcb_utils.cpp index 6d632aa5a5..4c44ca9c77 100644 --- a/pcbnew/api/api_pcb_utils.cpp +++ b/pcbnew/api/api_pcb_utils.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,16 @@ std::unique_ptr CreateItemForType( KICAD_T aType, BOARD_ITEM_CONTAIN return std::make_unique( footprint ); } + case PCB_FIELD_T: + { + FOOTPRINT* footprint = dynamic_cast( aContainer ); + + if( !footprint ) + return nullptr; + + return std::make_unique( footprint, FIELD_T::USER ); + } + case PCB_FOOTPRINT_T: { BOARD* board = dynamic_cast( aContainer ); diff --git a/qa/data/pcbnew/api_kitchen_sink.kicad_pcb b/qa/data/pcbnew/api_kitchen_sink.kicad_pcb index 0f21e68999..b54c41610b 100644 --- a/qa/data/pcbnew/api_kitchen_sink.kicad_pcb +++ b/qa/data/pcbnew/api_kitchen_sink.kicad_pcb @@ -536,6 +536,19 @@ ) ) ) + (property "CustomField" "CustomValue" + (at 0 0 0) + (unlocked yes) + (layer "F.Fab") + (hide yes) + (uuid "212d694f-e13b-46df-9a52-6773137fcf6d") + (effects + (font + (size 1 1) + (thickness 0.15) + ) + ) + ) (attr through_hole) (fp_line (start -5.08 3.81)