fix triangular grid

This commit is contained in:
leyghisbb 2020-08-30 11:39:36 +02:00
parent dd878db72f
commit 3cedfeafd9
2 changed files with 7 additions and 8 deletions

View File

@ -14,7 +14,7 @@
<param name="dm" type="float" min="1" max="1000" precision="2" gui-text="Major grid division Spacing">100.00</param> <param name="dm" type="float" min="1" max="1000" precision="2" gui-text="Major grid division Spacing">100.00</param>
<param name="y_divs" type="int" min="1" max="1000" gui-text="Major vertical divisions">3</param> <param name="y_divs" type="int" min="1" max="1000" gui-text="Major vertical divisions">3</param>
<param name="x_divs" type="int" min="1" max="1000" gui-text="Major horizontal divisions">3</param> <param name="x_divs" type="int" min="1" max="1000" gui-text="Major horizontal divisions">3</param>
<param name="grid_angle" type="float" min="0" max="180" gui-text="Grid angle [deg]">30</param> <param name="grid_angle" type="float" min="0.1" max="89.9" gui-text="Grid angle [deg]">30.0</param>
<param name="subdivs" type="int" min="1" max="1000" gui-text="Subdivisions per Major grid division">2</param> <param name="subdivs" type="int" min="1" max="1000" gui-text="Subdivisions per Major grid division">2</param>
<param name="subsubdivs" type="int" min="1" max="1000" gui-text="Subsubdivs. per grid subdivision">5</param> <param name="subsubdivs" type="int" min="1" max="1000" gui-text="Subsubdivs. per grid subdivision">5</param>
</page> </page>

View File

@ -128,14 +128,13 @@ class Grid_Triangular(inkex.Effect):
x_end = end_points[1][0] x_end = end_points[1][0]
y_end = end_points[1][1] y_end = end_points[1][1]
if (x_start >= 0 and x_start <= self.xmax and if (x_end >= 0 and x_end <= self.xmax and
y_start >= 0 and y_start <= self.ymax and y_end >= 0 and y_end <= self.ymax and
x_end >= 0 and x_end <= self.xmax and (y_start != y_end and x_start != x_end)):
y_end >= 0 and y_end <= self.ymax):
draw_SVG_line(x_start, y_start, draw_SVG_line(x_start, y_start,
x_end, y_end, x_end, y_end,
thickness, colorString(color), label, groupName) thickness, colorString(color), label, groupName)
def effect(self): def effect(self):
#find the pixel dimensions of the overall grid #find the pixel dimensions of the overall grid
@ -236,13 +235,13 @@ class Grid_Triangular(inkex.Effect):
for j in range (0, sd): #subdivs for j in range (0, sd): #subdivs
if j>0:#not for the first loop (this loop is for the subsubdivs before the first subdiv) if j>0:#not for the first loop (this loop is for the subsubdivs before the first subdiv)
self.drawAngledGridLine(0, dy*(i+j/float(sd)), self.drawAngledGridLine(0, dy*(i+j/float(sd)),
self.options.grid_angle, self.options.grid_angle,
self.options.subdiv_th, self.options.subdiv_th,
self.options.subdiv_color, self.options.subdiv_color,
'MinorYDivP'+str(i), 'MinorYDivP'+str(i),
minglp) minglp)
self.drawAngledGridLine(0, dy*(i+j/float(sd)), self.drawAngledGridLine(0, dy*(i+j/float(sd)),
-self.options.grid_angle, -self.options.grid_angle,
self.options.subdiv_th, self.options.subdiv_th,
self.options.subdiv_color, self.options.subdiv_color,