Hi Community,
I was testing my KiVar plugin against the current 8.99 Nightly and was hoping to quickly fix any changes that appeared in the SWIG wrapper. But one thing is still causing me headaches:
As KiCad 8.99 now uses empty fields for inheriting paste margin ratios (instead of using a value of 0 as in v8), the used data type changed to std::optional<double>
, which is also returned by the SWIG wrapper:
Using GetLocalSolderPasteMarginRatio()
on a footprint returns a
<Swig Object of type 'std::optional< double > *' at ...>
I still have no clue if it is possible to dereference the contained double
value (and also has_value()
).
For GetLocalSolderPasteMargin()
(not ...MarginRatio()
!) I was at least able to handle the returned std::optional<int>
using pcbnew.UNITS_PROVIDER(...).StringFromOptionalValue(...)
. But I cannot find a matching function that takes care of std::optional<double>
instead of std::optional<int>
.
Is anyone around who knows if it is possible to get the double
value that is contained in the std::optional
? Or would that require modifying KiCad SWIG interface stuff? If so, I’d be grateful for any hints.
I’m well aware that the pcbnew SWIG is going to be obsolete, but it would be nice if the latest changes would not break existing plugins beyond repair for the time being.
Thanks for your help!
Mark