Fixing action plugin (error to rotate a track)

I am trying to make the replicate plugin Fix footprint positing for v6.99 by hildogjr · Pull Request #13 · MitjaNemec/ReplicateLayout · GitHub work on v6.99 Nightly. Ii could fix some issues related with the new, not documented API, but I still having a issue:

  File "/home/lab/.local/share/kicad/6.99/3rdparty/plugins/com_github_MitjaNemec_ReplicateLayout/replicate_layout.py", line 880, in replicate_tracks
    new_track.Rotate(dst_anchor_fp_position, delta_orientation)
  File "/usr/lib/kicad-nightly/lib/python3/dist-packages/pcbnew.py", line 15736, in Rotate
    return _pcbnew.PCB_TRACK_Rotate(self, aRotCentre, aAngle)
TypeError: in method 'PCB_TRACK_Rotate', argument 3 of type 'EDA_ANGLE const &'

The arguments that I am passing to new_track.Rotate(dst_anchor_fp_position, delta_orientation) are “<class ‘pcbnew.VECTOR2I’>(102120000, 125129999) - <class ‘float’>0.0”.

If I understood, delta_orientation must be a EDA_ANGLE type, which I can from pcbnew import EDA_ANGLE. But this EDA_ANGLE can not be initialized be ale double argument as angle. What am I missing?

To reproduce this, it is possible to simple try to rotate a track:

import pcbnew
board = pcbnew.GetBoard()
tracks = board.GetTracks()
t = tracks[0]
from pcbnew import VECTOR2I, EDA_ANGLE
t.Rotate(VECTOR2I(0, 0), 0.0)  # or t.Rotate(VECTOR2I(0, 0), EDA_ANGLE(0))

EDA_ANGLE(angle, DEGREES_T)

See libs/kimath/include/geometry/eda_angle.h · master · KiCad / KiCad Source Code / kicad · GitLab

Thanks @quick but it is not possible from python import EDA_ANGLE_T (Impossible import EDA_ANGLE_T on Python (#11623) · Issues · KiCad / KiCad Source Code / kicad · GitLab) although be possible to hard code the 0, 1, 2 as object parameter initialization.

Enums are not classes, access their values directly like pcbnew.DEGREES_T or if you have from pcbnew import * then just DEGREES_T

1 Like