Beispiel #1
0
                        if r == 0:
                            f.write(l.raw + "\n")
                        else:
                            f.write(
                                rewrite_gline(co, l, math.cos(r), math.sin(r))
                                + "\n")
                # Find the current real position
                for i in range(len(model.gcode) - 1, -1, -1):
                    gline = model.gcode.lines[i]
                    if gline.is_move:
                        last_real_position = (-trans[0] + gline.current_x,
                                              -trans[1] + gline.current_y,
                                              -trans[2] + gline.current_z)
                        break
        logging.info(_("Exported merged G-Codes to %s") % name)


GcodePlater = make_plater(GcodePlaterPanel)

if __name__ == '__main__':
    app = wx.App(False)
    main = GcodePlater(filenames=sys.argv[1:])
    for fn in main.filenames:
        main.load_file(fn)
    main.filenames = None
    main.autoplate()
    main.export_to("gcodeplate___test.gcode")
    raise SystemExit
    main.Show()
    app.MainLoop()
Beispiel #2
0
                   "-x", str(int(self.build_dimensions[0])),
                   "-y", str(int(self.build_dimensions[1]))] + files
        p = subprocess.Popen(command, stdout = subprocess.PIPE)

        pos_regexp = re.compile("File: (.*) minx: ([0-9]+), miny: ([0-9]+), minrot: ([0-9]+)")
        for line in p.stdout:
            line = line.rstrip()
            if "Generating plate" in line:
                plateid = int(line.split()[-1])
                if plateid > 0:
                    logging.error(_("Plate full, please remove some objects"))
                    break
            if "File:" in line:
                bits = pos_regexp.match(line).groups()
                filename = bits[0]
                x = float(bits[1])
                y = float(bits[2])
                rot = -float(bits[3])
                for name, model in models.items():
                    # FIXME: not sure this is going to work superwell with utf8
                    if model.filename == filename:
                        model.offsets[0] = x + self.build_dimensions[3]
                        model.offsets[1] = y + self.build_dimensions[4]
                        model.rot = rot
                        del models[name]
                        break
        if p.wait() != 0:
            raise RuntimeError(_("simarrange failed"))

StlPlater = make_plater(StlPlaterPanel)
Beispiel #3
0
        m.bitmap.SetMask(wx.Mask(m.bitmap, wx.Colour(0, 0, 0, 255)))


class StlPlaterPanel(PlaterPanel1):

    load_wildcard = _(
        "STL files (*.stl;*.STL)|*.stl;*.STL|OpenSCAD files (*.scad)|*.scad")
    save_wildcard = _("STL files (*.stl;*.STL)|*.stl;*.STL")

    def prepare_ui(self,
                   filenames=[],
                   callback=None,
                   parent=None,
                   build_dimensions=None,
                   circular_platform=False,
                   simarrange_path=None,
                   antialias_samples=0):
        super(StlPlaterPanel, self).prepare_ui(filenames, callback, parent,
                                               build_dimensions)
        self.cutting = False
        self.cutting_axis = None
        self.cutting_dist = None

        viewer = showstl(self, (580, 580), (0, 0))

        self.simarrange_path = simarrange_path
        #self.set_viewer(viewer)


StlPlater = make_plater(StlPlaterPanel)
Beispiel #4
0
                f.write("G1 X%.5f Y%.5f" % (-co[0], -co[1]))
                for l in model.gcode:
                    if l.command != "G28" and (l.command != "G92" or extrusion_only(l)):
                        if r == 0:
                            f.write(l.raw + "\n")
                        else:
                            f.write(rewrite_gline(co, l, math.cos(r), math.sin(r)) + "\n")
                # Find the current real position
                for i in range(len(model.gcode) - 1, -1, -1):
                    gline = model.gcode.lines[i]
                    if gline.is_move:
                        last_real_position = (- trans[0] + gline.current_x,
                                              - trans[1] + gline.current_y,
                                              - trans[2] + gline.current_z)
                        break
        logging.info(_("Exported merged G-Codes to %s") % name)

GcodePlater = make_plater(GcodePlaterPanel)

if __name__ == '__main__':
    app = wx.App(False)
    main = GcodePlater(filenames = sys.argv[1:])
    for fn in main.filenames:
        main.load_file(fn)
    main.filenames = None
    main.autoplate()
    main.export_to("gcodeplate___test.gcode")
    raise SystemExit
    main.Show()
    app.MainLoop()