Commit 1a4b44f5 authored by Nicholas Gar Hei Chan's avatar Nicholas Gar Hei Chan
Browse files

Merge branch 'master' of

parents c4d8c7fb eff915f0
......@@ -44,7 +44,7 @@ class Model():
self.min_y = min_y
self.min_x = min_x
self.min_z = min_z
self.layer_heights = [layer.z_height for layer in layers]
def to_svgs(self, dir_name):
"""Saves layers as SVG images in directory
......@@ -84,7 +84,7 @@ class Layer():
def __init__(self, z_height):
z_height: float
The height of the layer
This diff is collapsed.
from mpl_toolkits import mplot3d
import os
import sys
import matplotlib.pyplot as plt
import time
import random
import numpy as np
import gcodeparser as gcp
start = time.time()
model = gcp.parse_gcode(os.path.abspath("LM_rocktopus.gcode"))
print("Execution time: {} seconds".format(time.time()-start))
layer = model.layers[10]
pts = layer.get_points()
num_samples = 10
sample_pts = list(np.random.randint(0,pts['num_pts'],num_samples))
for pt in sample_pts:
plt.plot(pts['x'][pt], pts['y'][pt], 'ro')
Uncomment this block to save each layer to an SVG image
into a folder called "layers"
#for layer_index, layer in enumerate(model.layers):
# layer.to_svg(model.max_y, model.max_x, "layers/{}.svg".format(layer_index))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment