Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b9e0bad
ogl: remove subfolder libtatlin
neofelis2X Oct 5, 2023
ceac2fc
ogl: make mouse cursor an actor, wip
neofelis2X Oct 5, 2023
54de589
ogl: make cutting plane an actor, wip
neofelis2X Oct 5, 2023
bcee4bb
ogl: make panel focus an actor
neofelis2X Oct 6, 2023
5b222c8
ogl: use super() for StlViewPanel
neofelis2X Oct 7, 2023
a212ed1
ogl: utilise 'glColorMaterial' for all actors
neofelis2X Oct 7, 2023
3c582de
ogl: remove redundancies in GcodeModel.load_data
neofelis2X Oct 8, 2023
e2d0557
ogl: write GLAttributes in wx4 style
neofelis2X Oct 8, 2023
3443d90
ogl: move duplicate methods to panel class
neofelis2X Oct 9, 2023
48689f8
ogl: make stl model an actor and general cleanup
neofelis2X Oct 14, 2023
289f525
ogl: inherit plater backgrnd colour from settings
neofelis2X Oct 15, 2023
a95d862
ogl: fix auto-raise behaviour
neofelis2X Oct 25, 2023
6ddc91a
ogl: add origin arrows to platform
neofelis2X Nov 4, 2023
e53e146
ogl: untangle platform from gcview
neofelis2X Nov 11, 2023
c729ce9
ogl: update actor colours dynamically
neofelis2X Nov 11, 2023
f634606
ogl: make mouse cursor a circle
neofelis2X Nov 11, 2023
572fad3
ogl: general refactoring and update light setup
neofelis2X Nov 12, 2023
f89a456
ogl: fix object translation of plater
neofelis2X Nov 12, 2023
655bca1
ogl: new camera class
neofelis2X Nov 22, 2023
9bab379
ogl: optional widget to show deltatime and fps
neofelis2X Nov 24, 2023
77f4cc8
ogl: type hints for all gl modules
neofelis2X Nov 27, 2023
6159b4a
ogl: fix deltatime and type hints for python3.7
neofelis2X Nov 27, 2023
5d6bc6b
ogl: handle camera view matrices
neofelis2X Nov 25, 2024
9c92e17
ogl: add numpy implementation of gluUnProject
neofelis2X Nov 27, 2024
c2d46a8
ogl: change camera to use vectors and lookat
neofelis2X Dec 28, 2024
4eb79b1
ogl: change panel baseclass to glcanvas, seems to work better on win …
neofelis2X Jan 29, 2025
3045815
ogl: reorganise keyboard input keys
neofelis2X Feb 4, 2025
34fdc0e
ogl: fix fit gcode models to camera feature
neofelis2X Feb 5, 2025
1034b50
ogl: rename trackball module into mathutils as it better reflects its…
neofelis2X Feb 5, 2025
5fafc0f
ogl: make sure camera accounts for platform offsets
neofelis2X Feb 6, 2025
cd63d0a
ogl: found and fixed most annoying bug in main view with mouse input
neofelis2X Feb 8, 2025
f39b742
ogl: more preparations for pyglet2
neofelis2X Feb 16, 2025
7e6efac
ogl: change numpy naming to np as it is convention
neofelis2X Feb 16, 2025
38c534a
ogl: refactor how focus is drawn
neofelis2X Feb 16, 2025
df75d8b
ogl: refactor how platform is drawn
neofelis2X Feb 19, 2025
02a519a
ogl: move and rename actor details
neofelis2X Feb 19, 2025
13d753a
ogl: refactor how cutting plane is drawn
neofelis2X Feb 19, 2025
b300509
ogl: rename frametime text element
neofelis2X Feb 19, 2025
9bc019a
ogl: various cleanup changes
neofelis2X Mar 11, 2025
5015284
ogl: add 3d geometry to testfiles folder
neofelis2X Mar 23, 2025
84088f2
ogl: adjust material and lighting
neofelis2X Mar 24, 2025
1eda217
ogl: more cleanup changes
neofelis2X Apr 1, 2025
0a52f45
ogl: add zoom to cursor to camera
neofelis2X Apr 5, 2025
147e657
ogl: even more cleanup changes
neofelis2X Apr 8, 2025
e6710f9
ogl: make typehints compatible with py3.8
neofelis2X May 26, 2025
217f9fe
ogl: restore logging message translation wrapper
neofelis2X May 26, 2025
da7ac8a
ogl: Let plater handle 2D and 3D gracefully
neofelis2X May 28, 2025
127b76e
fixup! ogl: Let plater handle 2D and 3D gracefully
neofelis2X May 29, 2025
5bd9327
ogl: cleanup how mousewheel input is handled
neofelis2X May 30, 2025
04872d6
ogl: turn off zoom distance limitation
neofelis2X May 30, 2025
1a55824
ogl: set context when loading new models
neofelis2X May 31, 2025
b4d8386
ogl: bake grid line transparency with background color
neofelis2X May 31, 2025
9f52c36
fixup! ogl: bake grid line transparency with background color
neofelis2X Jun 1, 2025
4803622
dont destroy panels immediately in case they have events pending
neofelis2X Jun 2, 2025
83af096
add short delay to reload_ui to avoid multiple consecutive calls
neofelis2X Jun 4, 2025
2e63fcd
fixup! ogl: Let plater handle 2D and 3D gracefully
neofelis2X Jun 14, 2025
4206327
ogl: clean up some comments
neofelis2X Jun 14, 2025
b6badcb
ogl: add 'fit to screen' feature to platers
neofelis2X Jun 15, 2025
bdd85e3
ogl: improve 'fit to screen' by using bouding spheres
neofelis2X Jun 15, 2025
88c0af1
update handling of plater FileDialog
neofelis2X Jun 15, 2025
f6e0b95
ogl: replace 2xPI with TAU where it makes sense
neofelis2X Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 52 additions & 31 deletions printrun/gcodeplater.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@
import re
import math
import logging
import traceback

from printrun import gcoder
from printrun.objectplater import make_plater, PlaterPanel
from printrun.gl.libtatlin import actors
import printrun.gui.viz # NOQA
from printrun import gcview

from .utils import install_locale, get_home_pos
install_locale('pronterface')
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not found (windows)

glview = '--no-gl' not in sys.argv
if glview:
try:
from printrun import gcview
from printrun.gl import actors
except ImportError:
glview = False
logging.warning(_("Could not load 3D viewer for plater:") +
"\n" + traceback.format_exc())


def extrusion_only(gline):
return gline.e is not None \
Expand Down Expand Up @@ -76,50 +82,65 @@ def rewrite_gline(centeroffset, gline, cosr, sinr):

class GcodePlaterPanel(PlaterPanel):

load_wildcard = _("GCODE files") + " (*.gcode;*.GCODE;*.g)|*.gcode;*.gco;*.g"
load_wildcard = _("G-Code Files") + \
" (*.gcode;*.GCODE;*.gco;*.g)|*.gcode;*.GCODE;*.gco;*.g"
save_wildcard = load_wildcard

def prepare_ui(self, filenames = [], callback = None,
parent = None, build_dimensions = None,
circular_platform = False,
antialias_samples = 0,
grid = (1, 10)):
grid = (1, 10),
perspective = False):
super().prepare_ui(filenames, callback, parent, build_dimensions, cutting_tool = False)
viewer = gcview.GcodeViewPanel(self, build_dimensions = self.build_dimensions,
antialias_samples = antialias_samples)
if glview:
viewer = gcview.GcodeViewPanel(self, build_dimensions = self.build_dimensions,
antialias_samples = antialias_samples,
circular = circular_platform,
grid = grid,
perspective = perspective)
else:
message = "3D visualisation failed to open.\n2D visualisation is unfortunately not yet implemented.\nClick 'OK' to exit."
answer = wx.MessageBox(message, "GCode Plater", wx.OK, self)
if answer == wx.OK:
self.DestroyLater()
return

self.set_viewer(viewer)
self.platform = actors.Platform(self.build_dimensions,
circular = circular_platform,
grid = grid)
self.platform_object = gcview.GCObject(self.platform)
self.Layout()
self.SetMinClientSize(self.topsizer.CalcMin())
self.SetTitle(_("G-Code Plate Builder"))

def get_objects(self):
return [self.platform_object] + list(self.models.values())
return list(self.models.values())
objects = property(get_objects)

def load_file(self, filename):
with open(filename, "r") as file:
gcode = gcoder.GCode(file, get_home_pos(self.build_dimensions))
model = actors.GcodeModel()
if gcode.filament_length > 0:
model.display_travels = False
generator = model.load_data(gcode)
generator_output = next(generator)
while generator_output is not None:

if glview:
model = actors.GcodeModel()
if gcode.filament_length > 0:
model.display_travels = False
generator = model.load_data(gcode)
generator_output = next(generator)
obj = gcview.GCObject(model)
obj.offsets = [self.build_dimensions[3], self.build_dimensions[4], 0]
obj.gcode = gcode
obj.dims = [gcode.xmin, gcode.xmax,
gcode.ymin, gcode.ymax,
gcode.zmin, gcode.zmax]
obj.centeroffset = [-(obj.dims[1] + obj.dims[0]) / 2,
-(obj.dims[3] + obj.dims[2]) / 2,
0]
self.add_model(filename, obj)
while generator_output is not None:
generator_output = next(generator)
obj = gcview.GCObject(model)
obj.offsets = [self.build_dimensions[3], self.build_dimensions[4], 0]
obj.gcode = gcode
obj.dims = [gcode.xmin, gcode.xmax,
gcode.ymin, gcode.ymax,
gcode.zmin, gcode.zmax]
obj.centeroffset = [-(obj.dims[1] + obj.dims[0]) / 2,
-(obj.dims[3] + obj.dims[2]) / 2,
0]
self.add_model(filename, obj)
else:
model = self.s.addfile(gcode)


wx.CallAfter(self.Refresh)

def done(self, event, cb):
Expand Down
Loading