better way to check kicad compatibility for snap2grid

This commit is contained in:
U-CAD\userC
2023-03-02 18:31:10 +01:00
parent d0d29196b4
commit 94ae19a5f1
2 changed files with 14 additions and 9 deletions

View File

@ -11,7 +11,7 @@
### plugins errors
#import pcbnew;pcbnew.GetWizardsBackTrace()
__version__ = '1.2.2'
__version__ = '1.2.3'
import sys, os
import pcbnew
import datetime
@ -19,14 +19,17 @@ import wx
from pcbnew import *
# Make snap2grid compatible with KiCAD 6.99
if "6.99" in GetBuildVersion():
if hasattr(pcbnew, 'EDA_RECT'): # kv5,kv6
pass
else: # kv7
wxPoint = VECTOR2I
def getOrientation(fp):
o = fp.GetOrientation()
if "6.99" in GetBuildVersion():
return o.AsDegrees()
if hasattr(pcbnew, 'EDA_RECT'): # kv5,kv6
return o / 10
else: # kv7
return o.AsDegrees()
use_grid_origin = True

View File

@ -15,15 +15,17 @@ from pcbnew import *
# Make snap2grid compatible with KiCAD 6.99
if "6.99" in GetBuildVersion():
if hasattr(pcbnew, 'EDA_RECT'): # kv5,kv6
pass
else: # kv7
wxPoint = VECTOR2I
def getOrientation(fp):
o = fp.GetOrientation()
if "6.99" in GetBuildVersion():
return o.AsDegrees()
if hasattr(pcbnew, 'EDA_RECT'): # kv5,kv6
return o / 10
else: # kv7
return o.AsDegrees()
use_grid_origin = True
gridReference = 0.127 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm