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

View File

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