Beispiel #1
0
class ShipWorkbench(Workbench):
    """ @brief Workbench of Ship design module. Here toolbars & icons are append. """
    from shipUtils import Paths, Translator
    import ShipGui

    Icon = Paths.iconsPath() + "/Ico.png"
    MenuText = str(Translator.translate("Ship design"))
    ToolTip = str(Translator.translate("Ship design"))

    def Initialize(self):
        # ToolBar
        list = [
            "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw",
            "Ship_AreasCurve", "Ship_Hydrostatics"
        ]
        self.appendToolbar("Ship design", list)
        list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
        self.appendToolbar("Loading", list)

        # Menu
        list = [
            "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw",
            "Ship_AreasCurve", "Ship_Hydrostatics"
        ]
        self.appendMenu("Ship design", list)
        list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
        self.appendToolbar("Loading", list)
Beispiel #2
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/HydrostaticsIco.png"
     MenuText = str(Translator.translate('GZ curve'))
     ToolTip = str(
         Translator.translate('Transversal stability GZ curve computation'))
     return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
Beispiel #3
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/SimCreateIco.png"
     MenuText = str(Translator.translate('Create a new simulation'))
     ToolTip = str(
         Translator.translate(
             'Create a new simulation in order to process later'))
     return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
Beispiel #4
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/Weight.png"
     MenuText = str(Translator.translate('Set ship weights'))
     ToolTip = str(
         Translator.translate(
             'Set ship weights, tanks must be added later'))
     return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
Beispiel #5
0
 def setupUi(self):
     mw = self.getMainWindow()
     form = mw.findChild(QtGui.QWidget, "TaskPanel")
     form.ship = form.findChild(QtGui.QComboBox, "Ship")
     form.mainLogo = form.findChild(QtGui.QLabel, "MainLogo")
     iconPath = Paths.iconsPath() + "/Ico.xpm"
     form.mainLogo.setPixmap(QtGui.QPixmap(iconPath))
     self.form = form
     self.retranslateUi()
Beispiel #6
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/LoadIco.png"
     MenuText = str(Translator.translate('Load an example ship geometry'))
     ToolTip = str(
         Translator.translate(
             'Load an example ship geometry able to be converted into a ship.'
         ))
     return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
Beispiel #7
0
class ShipWorkbench(Workbench):
    """ @brief Workbench of Ship design module. Here toolbars & icons are append. """
    from shipUtils import Paths, Translator
    import ShipGui

    Icon = Paths.iconsPath() + "/Ico.png"
    MenuText = str(Translator.translate("Ship design"))
    ToolTip = str(Translator.translate("Ship design"))

    def Initialize(self):
        from shipUtils import Translator
        # ToolBar
        list = [
            "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw",
            "Ship_AreasCurve", "Ship_Hydrostatics"
        ]
        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)
        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",
                "Ship_TrackSim"
            ]
            self.appendToolbar("Simulation", list)

        # Menu
        list = [
            "Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw",
            "Ship_AreasCurve", "Ship_Hydrostatics"
        ]
        self.appendMenu("Ship design", list)
        list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
        self.appendMenu("Weights", list)
        if hasOpenCL and hasNumpy:
            list = [
                "Ship_CreateSim", "Ship_RunSim", "Ship_StopSim",
                "Ship_TrackSim"
            ]
            self.appendMenu("Simulation", list)
Beispiel #8
0
 def setupUi(self):
     mw = self.getMainWindow()
     form = mw.findChild(QtGui.QWidget, "TaskPanel")
     form.ship = form.findChild(QtGui.QComboBox, "Ship")
     form.mainLogo = form.findChild(QtGui.QLabel, "MainLogo")
     iconPath = Paths.iconsPath() + "/Ico.xpm"
     form.mainLogo.setPixmap(QtGui.QPixmap(iconPath))
     self.form = form
     self.retranslateUi()
Beispiel #9
0
 def accept(self):
     path = Paths.modulePath() + "/Examples/"
     if (self.form.ship.currentIndex() == 0):  # s60 from Iowa University
         App.open(path + "s60.fcstd")
     elif (self.form.ship.currentIndex() == 1):  # Barehull 5415
         App.open(path + "barehull5415.fcstd")
     elif (self.form.ship.currentIndex() == 2):  # s60 (Katamaran)
         App.open(path + "s60_katamaran.fcstd")
     return True
Beispiel #10
0
 def accept(self):
     path = Paths.modulePath() + "/Examples/"
     if(self.form.ship.currentIndex() == 0):     # s60 from Iowa University
         App.open(path + "s60.fcstd")
     elif(self.form.ship.currentIndex() == 1):   # Barehull 5415
         App.open(path + "barehull5415.fcstd")
     elif(self.form.ship.currentIndex() == 2):   # s60 (Katamaran)
         App.open(path + "s60_katamaran.fcstd")
     return True
Beispiel #11
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/shipOutlineDraw/TaskPanel.ui"
     self.ship = None
     self.skip = False
     self.LSections = []
     self.BSections = []
     self.TSections = []
     self.obj = None
     self.preview = Preview.Preview()
Beispiel #12
0
 def accept(self):
     path = Paths.modulePath() + "/Examples/"
     if(self.form.ship.currentIndex() == 0):     # s60 from Iowa University
         App.open(path + "s60.fcstd")
     elif(self.form.ship.currentIndex() == 1):   # Wigley canonical ship
         App.open(path + "wigley.fcstd")
     elif(self.form.ship.currentIndex() == 2):   # s60 (Katamaran)
         App.open(path + "s60_katamaran.fcstd")
     elif(self.form.ship.currentIndex() == 2):   # Wigley (Katamaran)
         App.open(path + "wigley_katamaran.fcstd")
     return True
Beispiel #13
0
 def accept(self):
     path = Paths.modulePath() + "/Examples/"
     if (self.form.ship.currentIndex() == 0):  # s60 from Iowa University
         App.open(path + "s60.fcstd")
     elif (self.form.ship.currentIndex() == 1):  # Wigley canonical ship
         App.open(path + "wigley.fcstd")
     elif (self.form.ship.currentIndex() == 2):  # s60 (Katamaran)
         App.open(path + "s60_katamaran.fcstd")
     elif (self.form.ship.currentIndex() == 2):  # Wigley (Katamaran)
         App.open(path + "wigley_katamaran.fcstd")
     return True
	def accept(self):
                path = Paths.modulePath() + "/Resources/VENDING/"
                if(self.form.ship.currentIndex() == 0):	 # box2
                        App.open(path + "box2.fcstd")
                elif(self.form.ship.currentIndex() == 1):   # CircleFan
                        App.open(path + "CircleFan.fcstd")
                elif(self.form.ship.currentIndex() == 2):   # Part 1
                        App.open(path + "Part1.fcstd")
                elif(self.form.ship.currentIndex() == 2):   # Part 4
                        App.open(path + "Part4.fcstd")
		return True
Beispiel #15
0
 def accept(self):
     path = Paths.modulePath() + "/Resources/VENDING/"
     if (self.form.ship.currentIndex() == 0):  # box2
         App.open(path + "box2.fcstd")
     elif (self.form.ship.currentIndex() == 1):  # CircleFan
         App.open(path + "CircleFan.fcstd")
     elif (self.form.ship.currentIndex() == 2):  # Part 1
         App.open(path + "Part1.fcstd")
     elif (self.form.ship.currentIndex() == 2):  # Part 4
         App.open(path + "Part4.fcstd")
     return True
 def accept(self):
     """Load the selected hull example."""
     path = Paths.modulePath() + "/resources/examples/"
     mw = self.getMainWindow()
     form = mw.findChild(QtGui.QWidget, "TaskPanel")
     form.ship = self.widget(QtGui.QComboBox, "Ship")
     if(form.ship.currentIndex() == 0):     # s60 from Iowa University
         App.open(path + "s60.fcstd")
     elif(form.ship.currentIndex() == 1):   # Wigley canonical ship
         App.open(path + "wigley.fcstd")
     elif(form.ship.currentIndex() == 2):   # s60 (Katamaran)
         App.open(path + "s60_katamaran.fcstd")
     elif(form.ship.currentIndex() == 2):   # Wigley (Katamaran)
         App.open(path + "wigley_katamaran.fcstd")
     return True
Beispiel #17
0
	def setupUi(self):
		mw = self.getMainWindow()
		form = mw.findChild(QtGui.QWidget, "TaskPanel")
		form.length = form.findChild(QtGui.QDoubleSpinBox, "Length")
		form.beam = form.findChild(QtGui.QDoubleSpinBox, "Beam")
		form.draft = form.findChild(QtGui.QDoubleSpinBox, "Draft")
		form.mainLogo = form.findChild(QtGui.QLabel, "MainLogo")
		iconPath = Paths.iconsPath() + "/Ico.xpm"
		form.mainLogo.setPixmap(QtGui.QPixmap(iconPath))
		self.form = form
		# Initial values
		if self.initValues():
			return True
		self.retranslateUi()
		self.preview.update(self.L, self.B, self.T)
		# Connect Signals and Slots
		QtCore.QObject.connect(form.length, QtCore.SIGNAL("valueChanged(double)"), self.onData)
		QtCore.QObject.connect(form.beam, QtCore.SIGNAL("valueChanged(double)"), self.onData)
		QtCore.QObject.connect(form.draft, QtCore.SIGNAL("valueChanged(double)"), self.onData)
Beispiel #18
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/Ico.png"
     MenuText = str(Translator.translate('Create a new ship'))
     ToolTip  = str(Translator.translate('Create a new ship in order to work with them'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #19
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/LoadIco.png"
     MenuText = str(Translator.translate('Load an example ship geometry'))
     ToolTip  = str(Translator.translate('Load an example ship geometry able to be converted into a ship.'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #20
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/tankWeights/TaskPanel.ui"
     self.ship = None
     self.preview = Preview.Preview()
Beispiel #21
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/simCreate/TaskPanel.ui"
def path():
    """ Gets the OpenCL kernels path
    @return OpenCL kernels path
    """
    path = Paths.modulePath() + "/resources/opencl"
    return path
Beispiel #23
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/HydrostaticsIco.png"
     MenuText = str(Translator.translate('Hydrostatics'))
     ToolTip  = str(Translator.translate('Plot ship hydrostatics'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #24
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/SimPostIco.png"
     MenuText = str(Translator.translate('Track simulation'))
     ToolTip  = str(Translator.translate('Track simulation'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #25
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/SimCreateIco.png"
     MenuText = str(Translator.translate('Create a new simulation'))
     ToolTip  = str(Translator.translate('Create a new simulation in order to process later'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #26
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/HydrostaticsIco.png"
     MenuText = str(Translator.translate('GZ curve'))
     ToolTip  = str(Translator.translate('Transversal stability GZ curve computation'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #27
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/SimPostIco.png"
     MenuText = str(Translator.translate('Track simulation'))
     ToolTip = str(Translator.translate('Track simulation'))
     return {'Pixmap': IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}
Beispiel #28
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/tankCreateTank/TaskPanel.ui"
 def __init__(self):
     """Constructor"""
     self.ui = Paths.modulePath() + "/shipCreateWeight/TaskPanel.ui"
Beispiel #30
0
 def __init__(self):
     self.ui  = Paths.modulePath() + "/simPost/TaskPanel.ui"
Beispiel #31
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/OutlineDrawIco.png"
     MenuText = str(Translator.translate('Outline draw'))
     ToolTip  = str(Translator.translate('Plot ship outline draw'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #32
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/AreaCurveIco.png"
     MenuText = str(Translator.translate('Areas curve'))
     ToolTip  = str(Translator.translate('Plot transversal areas curve'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #33
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/Weight.png"
     MenuText = str(Translator.translate('Set ship weights'))
     ToolTip  = str(Translator.translate('Set ship weights, tanks must be added later'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip} 
Beispiel #34
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/shipHydrostatics/TaskPanel.ui"
     self.ship = None
Beispiel #35
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/shipGZ/TaskPanel.ui"
Beispiel #36
0
 def __init__(self):
     """Constructor"""
     self.ui = Paths.modulePath() + "/shipCreateShip/TaskPanel.ui"
     self.preview = Preview.Preview()
Beispiel #37
0
    def initValues(self):
        """ Get selected geometry.
		@return False if sucessfully values initialized.
		"""
        # Get selected objects
        selObjs = FreeCADGui.Selection.getSelection()
        if not selObjs:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "Ship instance must be selected (no object selected)",
                None,
                QtGui.QApplication.UnicodeUTF8,
            )
            App.Console.PrintError(msg)
            return True
        for i in range(0, len(selObjs)):
            obj = selObjs[i]
            # Test if is a ship instance
            props = obj.PropertiesList
            try:
                props.index("IsShip")
            except ValueError:
                continue
            if obj.IsShip:
                # Test if another ship already selected
                if self.ship:
                    msg = QtGui.QApplication.translate(
                        "ship_console",
                        "More than one ship selected (extra ships will be neglected)",
                        None,
                        QtGui.QApplication.UnicodeUTF8,
                    )
                    App.Console.PrintWarning(msg + "\n")
                    break
                self.ship = obj
                # Test if any valid ship was selected
        if not self.ship:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "Ship instance must be selected (no valid ship found at selected objects)",
                None,
                QtGui.QApplication.UnicodeUTF8,
            )
            App.Console.PrintError(msg + "\n")
            return True
        props = self.ship.PropertiesList
        try:
            props.index("WeightNames")
        except:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "Ship weights has not been set. You need to set weights before use this tool",
                None,
                QtGui.QApplication.UnicodeUTF8,
            )
            App.Console.PrintError(msg + "\n")
            return True
            # Setup available tanks list
        objs = App.ActiveDocument.Objects
        iconPath = Paths.iconsPath() + "/Tank.xpm"
        icon = QtGui.QIcon(QtGui.QPixmap(iconPath))
        for obj in objs:
            # Try to get valid tank property
            props = obj.PropertiesList
            try:
                props.index("IsShipTank")
            except ValueError:
                continue
            if not obj.IsShipTank:
                continue
                # Add tank to list
            name = obj.Name
            label = obj.Label
            tag = label + " (" + name + ")"
            self.tanks[tag] = name
            # self.tanks.append([name, tag])
            item = QtGui.QListWidgetItem(tag)
            item.setIcon(icon)
            self.form.tanks.addItem(item)
        return False
Beispiel #38
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/shipAreasCurve/TaskPanel.ui"
     self.preview = Preview.Preview()
     self.ship = None
Beispiel #39
0
 def __init__(self):
     self.ui = Paths.modulePath() + "/tankGZ/TaskPanel.ui"
     self.ship = None
     self.tanks = {}
	def __init__(self):
		self.ui  = Paths.modulePath() + "/simRun/TaskPanel.ui"
		self.sim = False
Beispiel #41
0
 def GetResources(self):
     from shipUtils import Paths, Translator
     IconPath = Paths.iconsPath() + "/Tank.png"
     MenuText = str(Translator.translate('Create a new tank'))
     ToolTip  = str(Translator.translate('Create a new ship tank'))
     return {'Pixmap' : IconPath, 'MenuText': MenuText, 'ToolTip': ToolTip}