Commit ffddb747 authored by sumpfralle's avatar sumpfralle

added commandline options for disabling ODE


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@221 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ed5393db
...@@ -2,6 +2,7 @@ Version 0.2.2 - UNRELEASED ...@@ -2,6 +2,7 @@ Version 0.2.2 - UNRELEASED
* fixed broken commandline parameter "--template" * fixed broken commandline parameter "--template"
* added workaround for ODE collision detection, that is broken under specific circumstances * added workaround for ODE collision detection, that is broken under specific circumstances
* fixed "division by zero" error in non-ODE mode * fixed "division by zero" error in non-ODE mode
* allow to disable ODE via commandline option
Version 0.2.1 - 2010-03-09 Version 0.2.1 - 2010-03-09
* fixed code that depended on GTK 2.16 (instead of 2.12) * fixed code that depended on GTK 2.16 (instead of 2.12)
......
#!/usr/bin/python #!/usr/bin/python
from pycam.Gui.common import override_ode_availability
from optparse import OptionParser from optparse import OptionParser
import sys import sys
...@@ -24,6 +25,8 @@ if __name__ == "__main__": ...@@ -24,6 +25,8 @@ if __name__ == "__main__":
parser.add_option("", "--template", dest="config_template", parser.add_option("", "--template", dest="config_template",
default=None, action="store", type="string", default=None, action="store", type="string",
help="enable a specific processing settings template - e.g. 'Rough', 'Semi-finish' or 'Finish' (requires the GTK interface)") help="enable a specific processing settings template - e.g. 'Rough', 'Semi-finish' or 'Finish' (requires the GTK interface)")
parser.add_option("", "--disable-ode", dest="ode_disabled",
default=False, action="store_true", help="disable experimental ODE collision detection")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) > 0: if len(args) > 0:
...@@ -64,11 +67,14 @@ if __name__ == "__main__": ...@@ -64,11 +67,14 @@ if __name__ == "__main__":
if gui_class is None: if gui_class is None:
print >> sys.stderr, "Neither the GTK nor the Tk interface is available. Please install the corresponding packages!" print >> sys.stderr, "Neither the GTK nor the Tk interface is available. Please install the corresponding packages!"
sys.exit(1) sys.exit(1)
if options.ode_disabled:
override_ode_availability(False)
if outputfile:
gui = gui_class(no_dialog=True)
else: else:
if outputfile: gui = gui_class()
gui = gui_class(no_dialog=True)
else:
gui = gui_class()
if not inputfile: if not inputfile:
from pycam.Importers.TestModel import TestModel from pycam.Importers.TestModel import TestModel
......
...@@ -19,6 +19,9 @@ MODEL_TRANSFORMATIONS = { ...@@ -19,6 +19,9 @@ MODEL_TRANSFORMATIONS = {
"y_swap_z": ((1, 0, 0, 0), (0, 0, 1, 0), (0, 1, 0, 0)), "y_swap_z": ((1, 0, 0, 0), (0, 0, 1, 0), (0, 1, 0, 0)),
} }
_ode_override_state = None
def keep_gl_mode(func): def keep_gl_mode(func):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
prev_mode = GL.glGetIntegerv(GL.GL_MATRIX_MODE) prev_mode = GL.glGetIntegerv(GL.GL_MATRIX_MODE)
...@@ -198,11 +201,19 @@ def generate_physics(settings, cutter, physics=None): ...@@ -198,11 +201,19 @@ def generate_physics(settings, cutter, physics=None):
return physics return physics
def is_ode_available(): def is_ode_available():
try: global _ode_override_state
import ode if not _ode_override_state is None:
return True return _ode_override_state
except ImportError: else:
return False try:
import ode
return True
except ImportError:
return False
def override_ode_availability(state):
global _ode_override_state
_ode_override_state = state
class ToolPathList(list): class ToolPathList(list):
......
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