Commit ffcc251c authored by sumpfralle's avatar sumpfralle

moved toolpath class to a separate module -> preparation for more...

moved toolpath class to a separate module -> preparation for more meta-information (as on the wishlist)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@324 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 3af412f6
...@@ -9,11 +9,12 @@ import pycam.Gui.common as GuiCommon ...@@ -9,11 +9,12 @@ import pycam.Gui.common as GuiCommon
import pycam.Cutters import pycam.Cutters
import pycam.PathGenerators import pycam.PathGenerators
import pycam.PathProcessors import pycam.PathProcessors
import pycam.Toolpath
import pycam.Geometry.utils as utils import pycam.Geometry.utils as utils
from pycam.Gui.OpenGLTools import ModelViewWindowGL
import pycam.Physics.ode_physics
# this requires ODE - we import it later, if necessary # this requires ODE - we import it later, if necessary
#import pycam.Simulation.ODEBlocks #import pycam.Simulation.ODEBlocks
import pycam.Gui.OpenGLTools as ogl_tools
import pycam.Physics.ode_physics
import gtk import gtk
import ConfigParser import ConfigParser
import math import math
...@@ -150,7 +151,7 @@ class ProjectGui: ...@@ -150,7 +151,7 @@ class ProjectGui:
self.about_window.connect("delete-event", self.toggle_about_window, False) self.about_window.connect("delete-event", self.toggle_about_window, False)
# set defaults # set defaults
self.model = None self.model = None
self.toolpath = GuiCommon.ToolPathList() self.toolpath = pycam.Toolpath.ToolPathList()
self._physics_cache = None self._physics_cache = None
self.cutter = None self.cutter = None
self.process_list = [] self.process_list = []
...@@ -650,7 +651,7 @@ class ProjectGui: ...@@ -650,7 +651,7 @@ class ProjectGui:
elif new_state: elif new_state:
if self.view3d is None: if self.view3d is None:
# do the gl initialization # do the gl initialization
self.view3d = ogl_tools.ModelViewWindowGL(self.gui, self.settings, self.view3d = ModelViewWindowGL(self.gui, self.settings,
notify_destroy=self.toggle_3d_view, notify_destroy=self.toggle_3d_view,
accel_group=self._accel_group) accel_group=self._accel_group)
if self.model and self.view3d.enabled: if self.model and self.view3d.enabled:
......
# Tkinter is used for "EmergencyDialog" below - but we will try to import it carefully # Tkinter is used for "EmergencyDialog" below - but we will try to import it carefully
#import Tkinter #import Tkinter
import random
import sys import sys
import os import os
...@@ -173,41 +172,3 @@ class EmergencyDialog: ...@@ -173,41 +172,3 @@ class EmergencyDialog:
def finish(self, *args): def finish(self, *args):
self.root.quit() self.root.quit()
class ToolPathList(list):
def add_toolpath(self, toolpath, name, cutter, *args):
self.append(ToolPathInfo(toolpath, name, cutter, *args))
class ToolPathInfo:
def __init__(self, toolpath, name, cutter, drill_id, speed, feedrate,
material_allowance, safety_height, unit, start_x, start_y, start_z, bounding_box):
self.toolpath = toolpath
self.name = name
self.visible = True
self.drill_id = drill_id
self.drill = cutter
self.drill_size = cutter.radius
self.speed = speed
self.feedrate = feedrate
self.material_allowance = material_allowance
self.safety_height = safety_height
self.unit = unit
self.start_x = start_x
self.start_y = start_y
self.start_z = start_z
self.bounding_box = bounding_box
self.color = None
# generate random color
self.set_color()
def get_path(self):
return self.toolpath
def set_color(self, color=None):
if color is None:
self.color = (random.random(), random.random(), random.random())
else:
self.color = color
import random
class ToolPathList(list):
def add_toolpath(self, toolpath, name, cutter, *args):
self.append(ToolPath(toolpath, name, cutter, *args))
class ToolPath:
def __init__(self, toolpath, name, cutter, drill_id, speed, feedrate,
material_allowance, safety_height, unit, start_x, start_y, start_z, bounding_box):
self.toolpath = toolpath
self.name = name
self.visible = True
self.drill_id = drill_id
self.drill = cutter
self.drill_size = cutter.radius
self.speed = speed
self.feedrate = feedrate
self.material_allowance = material_allowance
self.safety_height = safety_height
self.unit = unit
self.start_x = start_x
self.start_y = start_y
self.start_z = start_z
self.bounding_box = bounding_box
self.color = None
# generate random color
self.set_color()
def get_path(self):
return self.toolpath
def set_color(self, color=None):
if color is None:
self.color = (random.random(), random.random(), random.random())
else:
self.color = color
Markdown is supported
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