fixed autoscale
This commit is contained in:
1 parent
d212fba311
commit
10e1f91a2f
2 files changed
+35
-10
No files matched your search
@@ -28,7 +28,7 @@ value is greater than 0.1
|
||||
smoothness = 0.02
|
||||
|
||||
""" height that the z axis will use to travel between strokes """
|
||||
zTravel = 1
|
||||
zTravel = 4
|
||||
|
||||
""" height that the z axis will use to draw """
|
||||
zDraw = 0
|
||||
|
||||
+34
-9
@@ -17,7 +17,7 @@ def read(infile):
|
||||
with open(infile) as i:
|
||||
return jload(i)
|
||||
|
||||
proj_location = "/Users/alexanderharding/Dropbox/bish/project/plots/noiseField"
|
||||
proj_location = "/bish/projects/plots/noiseField"
|
||||
svg_location = join(proj_location, "svg")
|
||||
json_location = join(proj_location, "json")
|
||||
gcode_location = join(proj_location, "gcode")
|
||||
@@ -41,7 +41,7 @@ concatenated_shapes_path = join(json_location, concatenated_shapes_file)
|
||||
scaled_shapes_file = f"{file_name}_scaled.json"
|
||||
scaled_shapes_path = join(json_location, scaled_shapes_file)
|
||||
|
||||
version = 7
|
||||
version = 9
|
||||
|
||||
gcode_output_file = f"{file_name}_v{version}.gcode"
|
||||
gcode_output_path = join(gcode_location, gcode_output_file)
|
||||
@@ -59,18 +59,42 @@ print(gcode_output_path)
|
||||
|
||||
# auto_scale = False
|
||||
#
|
||||
shapes = get_shapes(svg_path) #parse svg
|
||||
dump(shapes_path, shapes) #dump parsed svg to json
|
||||
# shapes = get_shapes(svg_path) #parse svg
|
||||
# dump(shapes_path, shapes) #dump parsed svg to json
|
||||
current = read(shapes_path)
|
||||
|
||||
jshapes = read(shapes_path) #read shapes from json
|
||||
new_order = optimise_path(current) #optimise json shapes
|
||||
dump(optimised_shapes_path, new_order) #dunmp optimised shapes
|
||||
current = read(optimised_shapes_path)
|
||||
# tempCurrent = []
|
||||
# for x,i in enumerate(current):
|
||||
# if x%10 == 0:
|
||||
# tempCurrent.append(i)
|
||||
# current = tempCurrent
|
||||
#
|
||||
# new_order = optimise_path(current) #optimise json shapes
|
||||
# dump(optimised_shapes_path, new_order) #dunmp optimised shapes
|
||||
# current = read(optimised_shapes_path)
|
||||
|
||||
# jnew_order = read(optimised_shapes_path) #read optimised shapes
|
||||
#
|
||||
scaled_shapes = auto_scale(current, 287, 366)
|
||||
|
||||
#flip xy
|
||||
# for a,i in enumerate(current):
|
||||
# for b,j in enumerate(i):
|
||||
#
|
||||
# c = current[a][b]
|
||||
# c.reverse()
|
||||
# current[a][b] = c
|
||||
# print(current[a][b])
|
||||
|
||||
|
||||
scaled_shapes = auto_scale(current, 205, 268)
|
||||
|
||||
new_maxX = 0
|
||||
new_maxY = 0
|
||||
for i in scaled_shapes:
|
||||
new_maxX = max(new_maxX, max(i[0][0], i[-1][0]))
|
||||
new_maxY = max(new_maxY, max(i[0][-1], i[-1][-1]))
|
||||
print("new max!!!!!!")
|
||||
print(new_maxX, new_maxY)
|
||||
current = scaled_shapes
|
||||
|
||||
# concat_shapes = concatenate(current, 0.35)
|
||||
@@ -80,4 +104,5 @@ current = scaled_shapes
|
||||
#
|
||||
commands = shapes_2_gcode(current, test_boundries=False) #generate gcode commands
|
||||
|
||||
|
||||
write_gcode(gcode_output_path, commands) #write gcode file
|
||||
Reference in new issue
Block a user