Python swig interface has outdated export of VECTOR3D
Description
Current Behavior
The pcbnew swig interface does not allow editing of a footprints 3D model parameters (FP_3DMODEL.m_Offset, FP_3DMODEL.m_Rotation and FP_3DMODEL.m_Scale). This is because the VECTOR3D typedef from math/vector3.h isn't included in the swig file. Example console snippet below in Steps to reproduce.
Expected Behavior
pcbnew.FP_3DMODEL.m_Offset, pcbnew.FP_3DMODEL.m_Rotation and pcbnew.FP_3DMODEL.m_Scale should be editable and assignable in python through use of an interfaced class equivalent to VECTOR3D. Similar but not necessarily the same as an example below.
>>> import pcbnew
>>> model_settings = pcbnew.FP_3DMODEL()
>>> model_settings.m_Offset
<Swig Object of type 'VECTOR3D *' at 0x7f43df5b9c80>
>>> model_settings.m_Offset.x = 10
>>> model_settings.m_Offset.x = pcbnew.VECTOR3D(10, 0, 0)
More details were discussed on a KiCad forum topic here. I believe the issue boils down to math/vector3.h needing to be included in the footprints.i swig interface file to replace an outdated reference made on this line.
Steps to reproduce
- Install KiCad v7.0.0
- Open a python terminal with pcbnew.py in PYTHONPATH
- Run the commands shown below.
>>> import pcbnew
>>> model_settings = pcbnew.FP_3DMODEL()
>>> model_settings.m_Offset
<Swig Object of type 'VECTOR3D *' at 0x7f43df5b9c80>
>>> model_settings.m_Offset.x = 10
swig/python detected a memory leak of type 'VECTOR3D *', no destructor found.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'SwigPyObject' object has no attribute 'x'
>>> model_settings.m_Offset.x = pcbnew.VECTOR3D(10, 0, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pcbnew' has no attribute 'VECTOR3D'
KiCad Version
Application: KiCad x86_64 on x86_64
Version: 7.0.0-da2b9df05c~171~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.2.1
FreeType 2.10.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux Mint 20.2, 64 bit, Little endian, wxGTK, cinnamon, x11
Build Info:
Date: Feb 27 2023 09:23:58
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.87.0
ngspice: 38
Compiler: GCC 9.4.0 with C++ ABI 1013
Build settings:
KICAD_SPICE=ON