Merge pull request #16 from Bouni/fix-#15

Add support for KiCAD 6.99 (VECTOR2I / wxPoint + GetOrientation().AsDegrees())
This commit is contained in:
easyw
2023-03-02 18:25:20 +01:00
committed by GitHub
2 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,17 @@ import datetime
import wx
from pcbnew import *
# Make snap2grid compatible with KiCAD 6.99
if "6.99" in GetBuildVersion():
wxPoint = VECTOR2I
def getOrientation(fp):
o = fp.GetOrientation()
if "6.99" in GetBuildVersion():
return o.AsDegrees()
return o / 10
use_grid_origin = True
gridReference = 0.1 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm
@ -209,7 +220,7 @@ def snap2grid(gridSizeMM,use_grid):
Value = str(module.GetValue())
Value=(Value[:17] + '..') if len(Value) > 19 else Value
Value="{0:<20}".format(Value)
Rotation='{0:.1f}'.format((module.GetOrientation()/10))
Rotation='{0:.1f}'.format(getOrientation(module))
Rotation="{0:>6}".format(Rotation)+' '
if module.GetLayer() == 0:
Layer=" top"

View File

@ -13,6 +13,18 @@ import datetime
import wx
from pcbnew import *
# Make snap2grid compatible with KiCAD 6.99
if "6.99" in GetBuildVersion():
wxPoint = VECTOR2I
def getOrientation(fp):
o = fp.GetOrientation()
if "6.99" in GetBuildVersion():
return o.AsDegrees()
return o / 10
use_grid_origin = True
gridReference = 0.127 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm
@ -70,7 +82,7 @@ def Snap2Grid(gridSizeMM,use_grid_origin):
Value = str(module.GetValue())
Value=(Value[:17] + '..') if len(Value) > 19 else Value
Value="{0:<20}".format(Value)
Rotation='{0:.1f}'.format((module.GetOrientation()/10))
Rotation='{0:.1f}'.format(getOrientation(module))
Rotation="{0:>6}".format(Rotation)+' '
if module.GetLayer() == 0:
Layer=" top"