Imported numpy, and added as dependency
This commit is contained in:
committed by
Yorik van Havre
parent
7f7a1243e0
commit
e708a4603c
@@ -36,12 +36,22 @@ class ShipWorkbench ( Workbench ):
|
||||
self.appendToolbar("Ship design",list)
|
||||
list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
|
||||
self.appendToolbar("Weights",list)
|
||||
# Simulation stuff only if pyOpenCL & numpy are present
|
||||
hasOpenCL = True
|
||||
hasNumpy = True
|
||||
try:
|
||||
import pyopencl
|
||||
except ImportError:
|
||||
hasOpenCL = False
|
||||
msg = Translator.translate("pyOpenCL not installed, ship simulations disabled\n")
|
||||
App.Console.PrintWarning(msg)
|
||||
else:
|
||||
try:
|
||||
import numpy
|
||||
except ImportError:
|
||||
hasNumpy = False
|
||||
msg = Translator.translate("numpy not installed, ship simulations disabled\n")
|
||||
App.Console.PrintWarning(msg)
|
||||
if hasOpenCL and hasNumpy:
|
||||
list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
|
||||
self.appendToolbar("Simulation",list)
|
||||
|
||||
@@ -50,11 +60,7 @@ class ShipWorkbench ( Workbench ):
|
||||
self.appendMenu("Ship design",list)
|
||||
list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
|
||||
self.appendMenu("Weights",list)
|
||||
try:
|
||||
import pyopencl
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
if hasOpenCL and hasNumpy:
|
||||
list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
|
||||
self.appendMenu("Simulation",list)
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import threading
|
||||
|
||||
# pyOpenCL
|
||||
import pyopencl as cl
|
||||
import numpy as np
|
||||
|
||||
# FreeCAD
|
||||
import FreeCAD,FreeCADGui
|
||||
|
||||
Reference in New Issue
Block a user