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

@ -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():
if hasattr(pcbnew, 'EDA_RECT'): # kv5,kv6
return o / 10
else: # kv7
return o.AsDegrees()
return o / 10
use_grid_origin = True
gridReference = 0.127 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm