Regenrated the branch (rebase failed)

This commit is contained in:
J.L. Cercos-Pita 2014-12-12 12:08:35 +01:00 committed by Yorik van Havre
parent 94187a6872
commit fc7c75ba84
34 changed files with 5115 additions and 247 deletions

View File

@ -3,6 +3,8 @@ SET(ShipMain_SRCS
ShipGui.py ShipGui.py
Instance.py Instance.py
Ship_rc.py Ship_rc.py
TankInstance.py
WeightInstance.py
) )
SOURCE_GROUP("" FILES ${ShipMain_SRCS}) SOURCE_GROUP("" FILES ${ShipMain_SRCS})
@ -55,21 +57,44 @@ SET(ShipHydrostatics_SRCS
) )
SOURCE_GROUP("shiphydrostatics" FILES ${ShipHydrostatics_SRCS}) SOURCE_GROUP("shiphydrostatics" FILES ${ShipHydrostatics_SRCS})
SET(ShipCreateWeight_SRCS
shipCreateWeight/__init__.py
shipCreateWeight/TaskPanel.py
shipCreateWeight/TaskPanel.ui
)
SOURCE_GROUP("shipcreateweight" FILES ${ShipCreateWeight_SRCS})
SET(ShipCreateTank_SRCS
shipCreateTank/__init__.py
shipCreateTank/TaskPanel.py
shipCreateTank/TaskPanel.ui
)
SOURCE_GROUP("shipcreatetank" FILES ${ShipCreateTank_SRCS})
SET(ShipCapacityCurve_SRCS
shipCapacityCurve/__init__.py
shipCapacityCurve/PlotAux.py
shipCapacityCurve/TaskPanel.py
shipCapacityCurve/TaskPanel.ui
)
SOURCE_GROUP("shipcapacitycurve" FILES ${ShipCapacityCurve_SRCS})
SET(ShipUtils_SRCS SET(ShipUtils_SRCS
shipUtils/__init__.py shipUtils/__init__.py
shipUtils/Locale.py
shipUtils/Math.py shipUtils/Math.py
shipUtils/Paths.py shipUtils/Paths.py
shipUtils/Units.py shipUtils/Units.py
) )
SOURCE_GROUP("shiputils" FILES ${ShipUtils_SRCS}) SOURCE_GROUP("shiputils" FILES ${ShipUtils_SRCS})
SET(all_files ${ShipMain_SRCS} ${ShipExamples_SRCS} ${ShipLoadExample_SRCS} ${ShipCreateShip_SRCS} ${ShipOutlineDraw_SRCS} ${ShipAreasCurve_SRCS} ${ShipHydrostatics_SRCS} ${ShipUtils_SRCS}) SET(all_files ${ShipMain_SRCS} ${ShipExamples_SRCS} ${ShipLoadExample_SRCS} ${ShipCreateShip_SRCS} ${ShipOutlineDraw_SRCS} ${ShipAreasCurve_SRCS} ${ShipHydrostatics_SRCS} ${ShipCreateWeight_SRCS} ${ShipCreateTank_SRCS} ${ShipCapacityCurve_SRCS} ${ShipUtils_SRCS})
ADD_CUSTOM_TARGET(Ship ALL ADD_CUSTOM_TARGET(Ship ALL
SOURCES ${all_files} SOURCES ${all_files}
) )
fc_copy_sources(Ship "${CMAKE_BINARY_DIR}/Mod/Ship" ${all_files}) fc_copy_sources(Mod/Ship "${CMAKE_BINARY_DIR}/Mod/Ship" ${all_files})
INSTALL( INSTALL(
FILES FILES
@ -107,6 +132,24 @@ INSTALL(
DESTINATION DESTINATION
Mod/Ship/shipHydrostatics Mod/Ship/shipHydrostatics
) )
INSTALL(
FILES
${ShipCreateWeight_SRCS}
DESTINATION
Mod/Ship/shipCreateWeight
)
INSTALL(
FILES
${ShipCreateTank_SRCS}
DESTINATION
Mod/Ship/shipCreateTank
)
INSTALL(
FILES
${ShipCapacityCurve_SRCS}
DESTINATION
Mod/Ship/shipCapacityCurve
)
INSTALL( INSTALL(
FILES FILES
${ShipUtils_SRCS} ${ShipUtils_SRCS}

View File

@ -50,12 +50,14 @@ class ShipWorkbench(Workbench):
"Ship_OutlineDraw", "Ship_OutlineDraw",
"Ship_AreasCurve", "Ship_AreasCurve",
"Ship_Hydrostatics"] "Ship_Hydrostatics"]
weightslist = ["Ship_Weight",
"Ship_Tank",
"Ship_Capacity"]
""" """
weightslist = ["Ship_Weights", weightslist = ["Ship_Weights",
"Ship_CreateTank", "Ship_CreateTank",
"Ship_GZ"] "Ship_GZ"]
""" """
weightslist = []
self.appendToolbar( self.appendToolbar(
str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")), str(QtCore.QT_TRANSLATE_NOOP("Ship", "Ship design")),
shiplist) shiplist)

View File

@ -91,6 +91,25 @@ class Ship:
"ExternalFaces", "ExternalFaces",
"Ship", "Ship",
tooltip) tooltip)
tooltip = str(QtGui.QApplication.translate(
"Ship",
"Set of weight instances",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList",
"Weights",
"Ship",
tooltip).Weights = []
tooltip = str(QtGui.QApplication.translate(
"Ship",
"Set of tank instances",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList",
"Tanks",
"Ship",
tooltip).Tanks = []
obj.Proxy = self obj.Proxy = self
def onChanged(self, fp, prop): def onChanged(self, fp, prop):
@ -185,80 +204,46 @@ class ViewProviderShip:
""" """
return None return None
def claimChildren(self):
objs = []
# Locate the owner ship object
doc_objs = FreeCAD.ActiveDocument.Objects
obj = None
for doc_obj in doc_objs:
try:
v_provider = doc_obj.ViewObject.Proxy
if v_provider == self:
obj = doc_obj
except:
continue
if obj is None:
FreeCAD.Console.PrintError("Orphan view provider found...\n")
FreeCAD.Console.PrintError(self)
FreeCAD.Console.PrintError('\n')
return objs
# Claim the weights
bad_linked = 0
for i, w in enumerate(obj.Weights):
try:
w_obj = FreeCAD.ActiveDocument.getObject(w)
objs.append(w_obj)
except:
del obj.Weights[i - bad_linked]
bad_linked += 1
# Claim the tanks
bad_linked = 0
for i, t in enumerate(obj.Tanks):
try:
t_obj = FreeCAD.ActiveDocument.getObject(t)
objs.append(t_obj)
except:
del obj.Tanks[i - bad_linked]
bad_linked += 1
return objs
def getIcon(self): def getIcon(self):
"""Returns the icon for this kind of objects.""" """Returns the icon for this kind of objects."""
return ":/icons/Ship_Instance.svg" return ":/icons/Ship_Instance.svg"
def weights(obj):
"""Returns the ship weights list. If weights has not been set this tool
will generate the default ones.
Keyword arguments:
obj -- Ship inmstance object.
"""
# Test if is a ship instance
props = obj.PropertiesList
try:
props.index("IsShip")
except ValueError:
return None
if not obj.IsShip:
return None
# Test if properties already exist
try:
props.index("WeightNames")
except ValueError:
tooltip = str(QtGui.QApplication.translate(
"Ship",
"Ship Weights names",
None,
QtGui.QApplication.UnicodeUTF8))
lighweight = str(QtGui.QApplication.translate(
"Ship",
"Lightweight",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyStringList",
"WeightNames",
"Ship",
tooltip).WeightNames = [lighweight]
try:
props.index("WeightMass")
except ValueError:
# Compute a mass aproximation
from shipHydrostatics import Tools
disp = Tools.displacement(obj, obj.Draft)
tooltip = str(QtGui.QApplication.translate(
"Ship",
"Ship Weights masses [tons]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloatList",
"WeightMass",
"Ship",
tooltip).WeightMass = [1000.0 * disp[0]]
try:
props.index("WeightPos")
except ValueError:
# Compute a CoG aproximation
from shipHydrostatics import Tools
disp = Tools.displacement(obj, obj.Draft)
tooltip = str(QtGui.QApplication.translate(
"Ship",
"Ship Weights centers of gravity",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyVectorList",
"WeightPos",
"Ship",
tooltip).WeightPos = [Vector(disp[1].x,
0.0,
obj.Draft)]
# Setup the weights list
weights = []
for i in range(len(obj.WeightNames)):
weights.append([obj.WeightNames[i],
obj.WeightMass[i],
obj.WeightPos[i]])
return weights

62
src/Mod/Ship/Makefile.am Normal file
View File

@ -0,0 +1,62 @@
# Change data dir from default ($(prefix)/share) to actual dir
datadir = $(prefix)/Mod/Ship
data_DATA = \
InitGui.py \
ShipGui.py \
Instance.py \
Ship_rc.py \
TankInstance.py \
WeightInstance.py
nobase_data_DATA = \
resources/examples/s60.fcstd \
resources/examples/s60_katamaran.fcstd \
resources/examples/wigley.fcstd \
resources/examples/wigley_katamaran.fcstd \
shipLoadExample/__init__.py \
shipLoadExample/TaskPanel.py \
shipLoadExample/TaskPanel.ui \
shipCreateShip/__init__.py \
shipCreateShip/Preview.py \
shipCreateShip/TaskPanel.py \
shipCreateShip/TaskPanel.ui \
shipOutlineDraw/__init__.py \
shipOutlineDraw/Preview.py \
shipOutlineDraw/TaskPanel.py \
shipOutlineDraw/TaskPanel.ui \
shipAreasCurve/__init__.py \
shipAreasCurve/PlotAux.py \
shipAreasCurve/Preview.py \
shipAreasCurve/TaskPanel.py \
shipAreasCurve/TaskPanel.ui \
shipHydrostatics/__init__.py \
shipHydrostatics/PlotAux.py \
shipHydrostatics/TaskPanel.py \
shipHydrostatics/TaskPanel.ui \
shipHydrostatics/Tools.py \
shipCreateWeight/__init__.py \
shipCreateWeight/TaskPanel.py \
shipCreateWeight/TaskPanel.ui \
shipCreateTank/__init__.py \
shipCreateTank/TaskPanel.py \
shipCreateTank/TaskPanel.ui \
shipCapacityCurve/__init__.py \
shipCapacityCurve/PlotAux.py \
shipCapacityCurve/TaskPanel.py \
shipCapacityCurve/TaskPanel.ui \
shipUtils/__init__.py \
shipUtils/Locale.py \
shipUtils/Math.py \
shipUtils/Paths.py \
shipUtils/Units.py
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
$(data_DATA) \
$(nobase_data_DATA) \
CMakeLists.txt \
README \
ship.dox

View File

@ -119,8 +119,62 @@ class Hydrostatics:
'ToolTip': ToolTip} 'ToolTip': ToolTip}
class CreateWeight:
def Activated(self):
import shipCreateWeight
shipCreateWeight.load()
def GetResources(self):
MenuText = QtCore.QT_TRANSLATE_NOOP(
'ship_weight',
'Create a new ship weight')
ToolTip = QtCore.QT_TRANSLATE_NOOP(
'ship_weight',
'Create a new ship weight')
return {'Pixmap': 'Ship_Weight',
'MenuText': MenuText,
'ToolTip': ToolTip}
class CreateTank:
def Activated(self):
import shipCreateTank
shipCreateTank.load()
def GetResources(self):
MenuText = QtCore.QT_TRANSLATE_NOOP(
'ship_tank',
'Create a new tank')
ToolTip = QtCore.QT_TRANSLATE_NOOP(
'ship_tank',
'Create a new tank')
return {'Pixmap': 'Ship_Tank',
'MenuText': MenuText,
'ToolTip': ToolTip}
class TankCapacity:
def Activated(self):
import shipCapacityCurve
shipCapacityCurve.load()
def GetResources(self):
MenuText = QtCore.QT_TRANSLATE_NOOP(
'ship_capacity',
'Tank capacity curve')
ToolTip = QtCore.QT_TRANSLATE_NOOP(
'ship_capacity',
'Plot the tank capacity curve (level-volume curve)')
return {'Pixmap': 'Ship_CapacityCurve',
'MenuText': MenuText,
'ToolTip': ToolTip}
FreeCADGui.addCommand('Ship_LoadExample', LoadExample()) FreeCADGui.addCommand('Ship_LoadExample', LoadExample())
FreeCADGui.addCommand('Ship_CreateShip', CreateShip()) FreeCADGui.addCommand('Ship_CreateShip', CreateShip())
FreeCADGui.addCommand('Ship_OutlineDraw', OutlineDraw()) FreeCADGui.addCommand('Ship_OutlineDraw', OutlineDraw())
FreeCADGui.addCommand('Ship_AreasCurve', AreasCurve()) FreeCADGui.addCommand('Ship_AreasCurve', AreasCurve())
FreeCADGui.addCommand('Ship_Hydrostatics', Hydrostatics()) FreeCADGui.addCommand('Ship_Hydrostatics', Hydrostatics())
FreeCADGui.addCommand('Ship_Weight', CreateWeight())
FreeCADGui.addCommand('Ship_Tank', CreateTank())
FreeCADGui.addCommand('Ship_Capacity', TankCapacity())

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,225 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import time
from math import *
from PySide import QtGui, QtCore
from pivy.coin import *
from pivy import coin
import FreeCAD
import FreeCADGui
from FreeCAD import Base, Vector
import Part
import Units
from shipUtils import Paths, Math
class Tank:
def __init__(self, obj, shapes, ship):
""" Transform a generic object to a ship instance.
Keyword arguments:
obj -- Part::FeaturePython created object which should be transformed
in a weight instance.
shapes -- Set of solid shapes which will compound the tank.
ship -- Ship where the tank is allocated.
"""
# Add an unique property to identify the Weight instances
tooltip = str(QtGui.QApplication.translate(
"ship_tank",
"True if it is a valid tank instance, False otherwise",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyBool",
"IsTank",
"Tank",
tooltip).IsTank = True
# Add the volume property (The volume of fluid will be set by each
# loading condition)
tooltip = str(QtGui.QApplication.translate(
"ship_tank",
"Volume of fluid [m^3]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"Vol",
"Tank",
tooltip).Vol = 0.0
# Add the density property (The volume of fluid will be set by each
# loading condition)
tooltip = str(QtGui.QApplication.translate(
"ship_tank",
"Density [kg / m^3]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"Dens",
"Tank",
tooltip).Dens = 0.0
# Set the subshapes
obj.Shape = Part.makeCompound(shapes)
obj.Proxy = self
def onChanged(self, fp, prop):
"""Detects the ship data changes.
Keyword arguments:
fp -- Part::FeaturePython object affected.
prop -- Modified property name.
"""
if prop == "Vol":
pass
def execute(self, fp):
"""Detects the entity recomputations.
Keyword arguments:
fp -- Part::FeaturePython object affected.
"""
pass
def setFillingLevel(self, fp, level):
"""Compute the mass of the object, already taking into account the
type of subentities.
Keyword arguments:
fp -- Part::FeaturePython object affected.
level -- Percentage of filling level (from 0 to 100).
"""
shape = fp.Shape
solids = shape.Solids
# Get the cutting box
bbox = shape.BoundBox
z_min = bbox.ZMin
z_max = bbox.ZMax
dx = bbox.XMax - bbox.XMin
dy = bbox.YMax - bbox.YMin
dz = level / 100.0 * (z_max - z_min)
z = z_min + dz
try:
box = Part.makeBox(3.0 * dx,
3.0 * dy,
(z_max - z_min) + dz,
Vector(bbox.XMin - dx,
bbox.YMin - dy,
bbox.ZMin - (z_max - z_min)))
except:
fp.Vol = 0.0
return Units.parseQuantity('0 m^3')
# Start computing the common part of each solid component with the
# cutting box, adding the volume
vol = 0.0
for s in solids:
try:
fluid = s.common(box)
v = fluid.Volume
except:
v = 0.0
vol += v
# Get the volume quantity and store it with the right units
vol = Units.Quantity(vol, Units.Volume)
fp.Vol = vol.getValueAs("m^3").Value
return vol
class ViewProviderTank:
def __init__(self, obj):
"""Add this view provider to the selected object.
Keyword arguments:
obj -- Object which must be modified.
"""
obj.Proxy = self
def attach(self, obj):
"""Setup the scene sub-graph of the view provider, this method is
mandatory.
"""
return
def updateData(self, fp, prop):
"""If a property of the handled feature has changed we have the chance
to handle this here.
Keyword arguments:
fp -- Part::FeaturePython object affected.
prop -- Modified property name.
"""
return
def getDisplayModes(self, obj):
"""Return a list of display modes.
Keyword arguments:
obj -- Object associated with the view provider.
"""
modes = []
return modes
def getDefaultDisplayMode(self):
"""Return the name of the default display mode. It must be defined in
getDisplayModes."""
return "Shaded"
def setDisplayMode(self, mode):
"""Map the display mode defined in attach with those defined in
getDisplayModes. Since they have the same names nothing needs to be
done. This method is optinal.
Keyword arguments:
mode -- Mode to be activated.
"""
return mode
def onChanged(self, vp, prop):
"""Detects the ship view provider data changes.
Keyword arguments:
vp -- View provider object affected.
prop -- Modified property name.
"""
pass
def __getstate__(self):
"""When saving the document this object gets stored using Python's
cPickle module. Since we have some un-pickable here (the Coin stuff)
we must define this method to return a tuple of all pickable objects
or None.
"""
return None
def __setstate__(self, state):
"""When restoring the pickled object from document we have the chance
to set some internals here. Since no data were pickled nothing needs
to be done here.
"""
return None
def getIcon(self):
"""Returns the icon for this kind of objects."""
return ":/icons/Ship_Tank.svg"

View File

@ -0,0 +1,353 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import time
from math import *
from PySide import QtGui, QtCore
from pivy.coin import *
from pivy import coin
import FreeCAD
import FreeCADGui
from FreeCAD import Base, Vector
import Part
import Units
from shipUtils import Paths, Math
class Weight:
def __init__(self, obj, shapes, ship):
""" Transform a generic object to a ship instance.
Keyword arguments:
obj -- Part::FeaturePython created object which should be transformed
in a weight instance.
shapes -- Set of shapes which will compound the weight element.
ship -- Ship where the weight is allocated.
"""
# Add an unique property to identify the Weight instances
tooltip = str(QtGui.QApplication.translate(
"ship_weight",
"True if it is a valid weight instance, False otherwise",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyBool",
"IsWeight",
"Weight",
tooltip).IsWeight = True
# Add the mass property for puntual weights
tooltip = str(QtGui.QApplication.translate(
"ship_weight",
"Mass [kg]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"Mass",
"Weight",
tooltip).Mass = 0.0
# Add the density property for linear elements
tooltip = str(QtGui.QApplication.translate(
"ship_weight",
"Linear density [kg / m]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"LineDens",
"Weight",
tooltip).LineDens = 0.0
# Add the area density property for surface elements
tooltip = str(QtGui.QApplication.translate(
"ship_weight",
"Area density [kg / m^3]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"AreaDens",
"Weight",
tooltip).AreaDens = 0.0
# Add the density property for volumetric elements
tooltip = str(QtGui.QApplication.translate(
"ship_weight",
"Density [kg / m^3]",
None,
QtGui.QApplication.UnicodeUTF8))
obj.addProperty("App::PropertyFloat",
"Dens",
"Weight",
tooltip).Dens = 0.0
# Set the subshapes
obj.Shape = Part.makeCompound(shapes)
obj.Proxy = self
def onChanged(self, fp, prop):
"""Detects the ship data changes.
Keyword arguments:
fp -- Part::FeaturePython object affected.
prop -- Modified property name.
"""
if prop == "Mass":
pass
def execute(self, fp):
"""Detects the entity recomputations.
Keyword arguments:
fp -- Part::FeaturePython object affected.
"""
pass
def _getPuntualMass(self, fp, shape):
"""Compute the mass of a puntual element.
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Vertex shape object.
"""
return Units.parseQuantity('{0} kg'.format(fp.Mass))
def _getLinearMass(self, fp, shape):
"""Compute the mass of a linear element.
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Edge shape object.
"""
rho = Units.parseQuantity('{0} kg/m'.format(fp.LineDens))
l = Units.Quantity(shape.Length, Units.Length)
return rho * l
def _getAreaMass(self, fp, shape):
"""Compute the mass of an area element.
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Face shape object.
"""
rho = Units.parseQuantity('{0} kg/m^2'.format(fp.AreaDens))
a = Units.Quantity(shape.Area, Units.Area)
return rho * a
def _getVolumetricMass(self, fp, shape):
"""Compute the mass of a volumetric element.
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Solid shape object.
"""
rho = Units.parseQuantity('{0} kg/m^3'.format(fp.Dens))
v = Units.Quantity(shape.Volume, Units.Volume)
return rho * v
def getMass(self, fp):
"""Compute the mass of the object, already taking into account the
type of subentities.
Keyword arguments:
fp -- Part::FeaturePython object affected.
"""
m = Units.parseQuantity('0 kg')
for s in fp.Shape.Solids:
m = m + self._getVolumetricMass(fp, s)
for f in fp.Shape.Faces:
m = m + self._getAreaMass(fp, f)
for e in fp.Shape.Edges:
m = m + self._getLinearMass(fp, e)
for v in fp.Shape.Vertexes:
m = m + self._getPuntualMass(fp, v)
return m
def _getPuntualMoment(self, fp, shape):
"""Compute the moment of a puntual element (respect to 0, 0, 0).
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Vertex shape object.
"""
m = self._getPuntualMass(fp, shape)
x = Units.Quantity(shape.X, Units.Length)
y = Units.Quantity(shape.Y, Units.Length)
z = Units.Quantity(shape.Z, Units.Length)
return (m * x, m * y, m * z)
def _getLinearMoment(self, fp, shape):
"""Compute the mass of a linear element (respect to 0, 0, 0).
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Edge shape object.
"""
m = self._getLinearMass(fp, shape)
cog = shape.CenterOfMass
x = Units.Quantity(cog.x, Units.Length)
y = Units.Quantity(cog.y, Units.Length)
z = Units.Quantity(cog.z, Units.Length)
return (m * x, m * y, m * z)
def _getAreaMoment(self, fp, shape):
"""Compute the mass of an area element (respect to 0, 0, 0).
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Face shape object.
"""
m = self._getAreaMass(fp, shape)
cog = shape.CenterOfMass
x = Units.Quantity(cog.x, Units.Length)
y = Units.Quantity(cog.y, Units.Length)
z = Units.Quantity(cog.z, Units.Length)
return (m * x, m * y, m * z)
def _getVolumetricMoment(self, fp, shape):
"""Compute the mass of a volumetric element (respect to 0, 0, 0).
Keyword arguments:
fp -- Part::FeaturePython object affected.
shape -- Solid shape object.
"""
m = self._getVolumetricMass(fp, shape)
cog = shape.CenterOfMass
x = Units.Quantity(cog.x, Units.Length)
y = Units.Quantity(cog.y, Units.Length)
z = Units.Quantity(cog.z, Units.Length)
return (m * x, m * y, m * z)
def getMoment(self, fp):
"""Compute the mass of the object, already taking into account the
type of subentities.
Keyword arguments:
fp -- Part::FeaturePython object affected.
"""
m = [Units.parseQuantity('0 kg*m'),
Units.parseQuantity('0 kg*m'),
Units.parseQuantity('0 kg*m')]
for s in fp.Shape.Solids:
mom = self._getVolumetricMoment(fp, s)
for i in range(len(m)):
m[i] = m[i] + mom[i]
for f in fp.Shape.Faces:
mom = self._getAreaMoment(fp, f)
for i in range(len(m)):
m[i] = m[i] + mom[i]
for e in fp.Shape.Edges:
mom = self._getLinearMoment(fp, e)
for i in range(len(m)):
m[i] = m[i] + mom[i]
for v in fp.Shape.Vertexes:
mom = self._getPuntualMoment(fp, v)
for i in range(len(m)):
m[i] = m[i] + mom[i]
return m
def getCenterOfMass(self, fp):
"""Compute the mass of the object, already taking into account the
type of subentities.
Keyword arguments:
fp -- Part::FeaturePython object affected.
"""
mass = self.getMass(fp)
moment = self.getMoment(fp)
cog = []
for i in range(len(moment)):
cog.append(moment[i] / mass)
return cog
class ViewProviderWeight:
def __init__(self, obj):
"""Add this view provider to the selected object.
Keyword arguments:
obj -- Object which must be modified.
"""
obj.Proxy = self
def attach(self, obj):
"""Setup the scene sub-graph of the view provider, this method is
mandatory.
"""
return
def updateData(self, fp, prop):
"""If a property of the handled feature has changed we have the chance
to handle this here.
Keyword arguments:
fp -- Part::FeaturePython object affected.
prop -- Modified property name.
"""
return
def getDisplayModes(self, obj):
"""Return a list of display modes.
Keyword arguments:
obj -- Object associated with the view provider.
"""
modes = []
return modes
def getDefaultDisplayMode(self):
"""Return the name of the default display mode. It must be defined in
getDisplayModes."""
return "Shaded"
def setDisplayMode(self, mode):
"""Map the display mode defined in attach with those defined in
getDisplayModes. Since they have the same names nothing needs to be
done. This method is optinal.
Keyword arguments:
mode -- Mode to be activated.
"""
return mode
def onChanged(self, vp, prop):
"""Detects the ship view provider data changes.
Keyword arguments:
vp -- View provider object affected.
prop -- Modified property name.
"""
pass
def __getstate__(self):
"""When saving the document this object gets stored using Python's
cPickle module. Since we have some un-pickable here (the Coin stuff)
we must define this method to return a tuple of all pickable objects
or None.
"""
return None
def __setstate__(self, state):
"""When restoring the pickled object from document we have the chance
to set some internals here. Since no data were pickled nothing needs
to be done here.
"""
return None
def getIcon(self):
"""Returns the icon for this kind of objects."""
return ":/icons/Ship_Weight.svg"

View File

@ -1,12 +1,16 @@
<RCC> <RCC>
<qresource> <qresource>
<file>icons/Ship_AreaCurve.svg</file> <file>icons/Ship_AreaCurve.svg</file>
<file>icons/Ship_CapacityCurve.svg</file>
<file>icons/Ship_Instance.svg</file> <file>icons/Ship_Instance.svg</file>
<file>icons/Ship_GZ.svg</file>
<file>icons/Ship_Hydrostatics.svg</file> <file>icons/Ship_Hydrostatics.svg</file>
<file>icons/Ship_Load.svg</file> <file>icons/Ship_Load.svg</file>
<file>icons/Ship_Logo.svg</file> <file>icons/Ship_Logo.svg</file>
<file>icons/Ship_Module.svg</file> <file>icons/Ship_Module.svg</file>
<file>icons/Ship_OutlineDraw.svg</file> <file>icons/Ship_OutlineDraw.svg</file>
<file>icons/Ship_Tank.svg</file>
<file>icons/Ship_Weight.svg</file>
<file>translations/Ship.qm</file> <file>translations/Ship.qm</file>
<file>translations/Ship_af.qm</file> <file>translations/Ship_af.qm</file>
<file>translations/Ship_cs.qm</file> <file>translations/Ship_cs.qm</file>

View File

@ -0,0 +1,757 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Ship_CapacityCurve.svg">
<defs
id="defs2987">
<linearGradient
id="linearGradient4113">
<stop
id="stop4115"
offset="0"
style="stop-color:#6f6f6f;stop-opacity:0.50196081;" />
<stop
id="stop4117"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4081">
<stop
id="stop4083"
offset="0"
style="stop-color:#808080;stop-opacity:0.50196081;" />
<stop
id="stop4085"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4049">
<stop
id="stop4051"
offset="0"
style="stop-color:#c1c1c1;stop-opacity:0.50196081;" />
<stop
id="stop4053"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4015">
<stop
style="stop-color:#585858;stop-opacity:0.50196081;"
offset="0"
id="stop4017" />
<stop
style="stop-color:#ffffff;stop-opacity:0.50196081;"
offset="1"
id="stop4019" />
</linearGradient>
<linearGradient
id="linearGradient3968">
<stop
id="stop3970"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#828282;stop-opacity:1;"
offset="0.54039383"
id="stop3976" />
<stop
style="stop-color:#606060;stop-opacity:1;"
offset="0.77134961"
id="stop3974" />
<stop
id="stop3972"
offset="1"
style="stop-color:#000000;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3911">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3913" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3915" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3903">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3905" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3907" />
</linearGradient>
<linearGradient
id="linearGradient4722">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4724" />
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="1"
id="stop4726" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3873"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lend"
style="overflow:visible;">
<path
id="path3867"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<linearGradient
id="linearGradient3937">
<stop
style="stop-color:#be7328;stop-opacity:1;"
offset="0"
id="stop3939" />
<stop
style="stop-color:#dc962d;stop-opacity:1;"
offset="1"
id="stop3941" />
</linearGradient>
<linearGradient
id="linearGradient3929">
<stop
id="stop3931"
offset="0"
style="stop-color:#c88c3c;stop-opacity:1;" />
<stop
id="stop3933"
offset="1"
style="stop-color:#ffff96;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3893">
<stop
style="stop-color:#505050;stop-opacity:1;"
offset="0"
id="stop3895" />
<stop
style="stop-color:#aaaaaa;stop-opacity:1;"
offset="1"
id="stop3897" />
</linearGradient>
<linearGradient
id="linearGradient3873">
<stop
style="stop-color:#f0be6e;stop-opacity:1;"
offset="0"
id="stop3875" />
<stop
style="stop-color:#c88228;stop-opacity:1;"
offset="1"
id="stop3877" />
</linearGradient>
<linearGradient
id="linearGradient3863">
<stop
id="stop3865"
offset="0"
style="stop-color:#6e4b18;stop-opacity:1;" />
<stop
id="stop3867"
offset="1"
style="stop-color:#c88228;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3979">
<stop
id="stop3981"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3983"
offset="1"
style="stop-color:#ff9600;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3971">
<stop
id="stop3973"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3975"
offset="1"
style="stop-color:#be7300;stop-opacity:1;" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Send"
style="overflow:visible;">
<path
id="path4031"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.2) rotate(180) translate(6,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Send"
style="overflow:visible;">
<path
id="path4049"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) rotate(180) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Sstart"
style="overflow:visible">
<path
id="path4046"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path4040"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) translate(0,0)" />
</marker>
<linearGradient
id="linearGradient3900">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3902" />
<stop
style="stop-color:#a0a0a0;stop-opacity:1;"
offset="1"
id="stop3904" />
</linearGradient>
<linearGradient
id="linearGradient3882">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3884" />
<stop
style="stop-color:#960000;stop-opacity:1;"
offset="1"
id="stop3886" />
</linearGradient>
<linearGradient
id="linearGradient3860">
<stop
style="stop-color:#1e76e3;stop-opacity:1;"
offset="0"
id="stop3862" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3860-6"
id="linearGradient3866-5"
x1="31.125395"
y1="61.410763"
x2="30.113636"
y2="12.160761"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3860-6">
<stop
style="stop-color:#5a9ff5;stop-opacity:1;"
offset="0"
id="stop3862-4" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864-4" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3873"
id="linearGradient3871"
gradientUnits="userSpaceOnUse"
x1="38.907837"
y1="51.470051"
x2="45.302406"
y2="54.091148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3863"
id="linearGradient3891"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3893"
id="linearGradient3899"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3882"
id="radialGradient3903"
cx="53.748837"
cy="4.9173141"
fx="53.748837"
fy="4.9173141"
r="3.2874005"
gradientTransform="matrix(2.3303929,-1.4921636,1.0936999,1.7080907,-77.643882,78.644487)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3927"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3943"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3949"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3951"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend-3"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3873-0"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4722"
id="radialGradient4730"
cx="22.399223"
cy="27.920977"
fx="22.399223"
fy="27.920977"
r="25.5625"
gradientTransform="matrix(0.61346721,-0.22517965,0.21191717,0.57733561,2.1543769,16.986575)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3909"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3917"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3928"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3930"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3935"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3938"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3968"
id="radialGradient3952"
cx="30.228815"
cy="20.070992"
fx="30.228815"
fy="20.070992"
r="3.4475341"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2238696,-8.502217e-5,8.5302128e-5,1.2278995,-6.7690238,-4.5715991)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4021"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4047"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4079"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4111"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4143"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4180"
gradientUnits="userSpaceOnUse"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4182"
gradientUnits="userSpaceOnUse"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4184"
gradientUnits="userSpaceOnUse"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4186"
gradientUnits="userSpaceOnUse"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4188"
gradientUnits="userSpaceOnUse"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4219"
gradientUnits="userSpaceOnUse"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4221"
gradientUnits="userSpaceOnUse"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4223"
gradientUnits="userSpaceOnUse"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4225"
gradientUnits="userSpaceOnUse"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4227"
gradientUnits="userSpaceOnUse"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437" />
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend-9"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3873-03"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="marker3057"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3059"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
inkscape:cx="1.0735984"
inkscape:cy="23.39195"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1364"
inkscape:window-height="718"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g4210"
transform="translate(3.1819805,-1.5909902)">
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path3104-9-2"
d="M 31.625,23.78125 0.5,32.0625 l 0,12.34375 7.75,6.125 26.1875,12.96875 18.75,-5.03125 4.625,-9.5625 0,-12.125 z"
style="fill:#6ba1ff;fill-opacity:1;stroke:none" />
<g
id="g4163">
<path
style="fill:url(#linearGradient4219);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 26.6875,57.40901 0,-26.81526 6.5,-8.875 18.93725,-5.0625 5.68775,5.65625 0,26.59651 -4.625,9.55974 -18.75,5.03125 z"
id="path3104"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:url(#linearGradient4221);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 33.1875,21.71875 7,8.75 25.9375,3.65625 l 26.187251,13 z"
id="path3104-9-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient4223);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 33.1875,21.71875 7,8.7499997 0.5,17.625 l 0,0 26.1875,12.96875 z"
id="path3104-9-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
style="fill:url(#linearGradient4225);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 0.5,17.625 26.1875,12.96875 0,26.81526 -26.1875,-13 z"
id="path3104-9-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient4227);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 26.6875,57.40901 0.5,44.40901 8.25,50.53125 34.4375,63.5 z"
id="path3104-9-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
<path
style="fill:none;stroke:#ff0000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 2.6516504,61.525126 c 36.9463286,0 31.6430276,-56.0382116 55.8614356,-56.0382116"
id="path3131"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
d="m 2.5302756,63.080267 0,-58.3749999"
id="path3066"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
d="m 1.2802756,61.830267 58.3750004,0"
id="path3066-6"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,713 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Ship_Tank.svg">
<defs
id="defs2987">
<linearGradient
id="linearGradient4113">
<stop
id="stop4115"
offset="0"
style="stop-color:#6f6f6f;stop-opacity:0.50196081;" />
<stop
id="stop4117"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4081">
<stop
id="stop4083"
offset="0"
style="stop-color:#808080;stop-opacity:0.50196081;" />
<stop
id="stop4085"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4049">
<stop
id="stop4051"
offset="0"
style="stop-color:#c1c1c1;stop-opacity:0.50196081;" />
<stop
id="stop4053"
offset="1"
style="stop-color:#ffffff;stop-opacity:0.50196081;" />
</linearGradient>
<linearGradient
id="linearGradient4015">
<stop
style="stop-color:#585858;stop-opacity:0.50196081;"
offset="0"
id="stop4017" />
<stop
style="stop-color:#ffffff;stop-opacity:0.50196081;"
offset="1"
id="stop4019" />
</linearGradient>
<linearGradient
id="linearGradient3968">
<stop
id="stop3970"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#828282;stop-opacity:1;"
offset="0.54039383"
id="stop3976" />
<stop
style="stop-color:#606060;stop-opacity:1;"
offset="0.77134961"
id="stop3974" />
<stop
id="stop3972"
offset="1"
style="stop-color:#000000;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3911">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3913" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3915" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3903">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3905" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3907" />
</linearGradient>
<linearGradient
id="linearGradient4722">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4724" />
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="1"
id="stop4726" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3873"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lend"
style="overflow:visible;">
<path
id="path3867"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<linearGradient
id="linearGradient3937">
<stop
style="stop-color:#be7328;stop-opacity:1;"
offset="0"
id="stop3939" />
<stop
style="stop-color:#dc962d;stop-opacity:1;"
offset="1"
id="stop3941" />
</linearGradient>
<linearGradient
id="linearGradient3929">
<stop
id="stop3931"
offset="0"
style="stop-color:#c88c3c;stop-opacity:1;" />
<stop
id="stop3933"
offset="1"
style="stop-color:#ffff96;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3893">
<stop
style="stop-color:#505050;stop-opacity:1;"
offset="0"
id="stop3895" />
<stop
style="stop-color:#aaaaaa;stop-opacity:1;"
offset="1"
id="stop3897" />
</linearGradient>
<linearGradient
id="linearGradient3873">
<stop
style="stop-color:#f0be6e;stop-opacity:1;"
offset="0"
id="stop3875" />
<stop
style="stop-color:#c88228;stop-opacity:1;"
offset="1"
id="stop3877" />
</linearGradient>
<linearGradient
id="linearGradient3863">
<stop
id="stop3865"
offset="0"
style="stop-color:#6e4b18;stop-opacity:1;" />
<stop
id="stop3867"
offset="1"
style="stop-color:#c88228;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3979">
<stop
id="stop3981"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3983"
offset="1"
style="stop-color:#ff9600;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3971">
<stop
id="stop3973"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3975"
offset="1"
style="stop-color:#be7300;stop-opacity:1;" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Send"
style="overflow:visible;">
<path
id="path4031"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.2) rotate(180) translate(6,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Send"
style="overflow:visible;">
<path
id="path4049"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) rotate(180) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Sstart"
style="overflow:visible">
<path
id="path4046"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path4040"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) translate(0,0)" />
</marker>
<linearGradient
id="linearGradient3900">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3902" />
<stop
style="stop-color:#a0a0a0;stop-opacity:1;"
offset="1"
id="stop3904" />
</linearGradient>
<linearGradient
id="linearGradient3882">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3884" />
<stop
style="stop-color:#960000;stop-opacity:1;"
offset="1"
id="stop3886" />
</linearGradient>
<linearGradient
id="linearGradient3860">
<stop
style="stop-color:#1e76e3;stop-opacity:1;"
offset="0"
id="stop3862" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3860-6"
id="linearGradient3866-5"
x1="31.125395"
y1="61.410763"
x2="30.113636"
y2="12.160761"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3860-6">
<stop
style="stop-color:#5a9ff5;stop-opacity:1;"
offset="0"
id="stop3862-4" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864-4" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3873"
id="linearGradient3871"
gradientUnits="userSpaceOnUse"
x1="38.907837"
y1="51.470051"
x2="45.302406"
y2="54.091148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3863"
id="linearGradient3891"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3893"
id="linearGradient3899"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3882"
id="radialGradient3903"
cx="53.748837"
cy="4.9173141"
fx="53.748837"
fy="4.9173141"
r="3.2874005"
gradientTransform="matrix(2.3303929,-1.4921636,1.0936999,1.7080907,-77.643882,78.644487)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3927"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3943"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3949"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3951"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend-3"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3873-0"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4722"
id="radialGradient4730"
cx="22.399223"
cy="27.920977"
fx="22.399223"
fy="27.920977"
r="25.5625"
gradientTransform="matrix(0.61346721,-0.22517965,0.21191717,0.57733561,2.1543769,16.986575)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3909"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3917"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3928"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3930"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3935"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3938"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3968"
id="radialGradient3952"
cx="30.228815"
cy="20.070992"
fx="30.228815"
fy="20.070992"
r="3.4475341"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2238696,-8.502217e-5,8.5302128e-5,1.2278995,-6.7690238,-4.5715991)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4021"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4047"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4079"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4111"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4143"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4180"
gradientUnits="userSpaceOnUse"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4182"
gradientUnits="userSpaceOnUse"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4184"
gradientUnits="userSpaceOnUse"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4186"
gradientUnits="userSpaceOnUse"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4188"
gradientUnits="userSpaceOnUse"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4219"
gradientUnits="userSpaceOnUse"
x1="53.411106"
y1="58.639683"
x2="32.679878"
y2="21.516573" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4221"
gradientUnits="userSpaceOnUse"
x1="20.465359"
y1="-8.8792562"
x2="33.356091"
y2="21.526335" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4223"
gradientUnits="userSpaceOnUse"
x1="3.5355339"
y1="17.904108"
x2="33.157169"
y2="22.146749" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4225"
gradientUnits="userSpaceOnUse"
x1="11.667262"
y1="37.693783"
x2="32.844353"
y2="22.137434" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4015"
id="linearGradient4227"
gradientUnits="userSpaceOnUse"
x1="19.445436"
y1="39.81237"
x2="32.639404"
y2="21.60437" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
inkscape:cx="24.081219"
inkscape:cy="26.677376"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1364"
inkscape:window-height="718"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g4210"
transform="translate(3.1819805,-1.5909902)">
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path3104-9-2"
d="M 31.625,23.78125 0.5,32.0625 l 0,12.34375 7.75,6.125 26.1875,12.96875 18.75,-5.03125 4.625,-9.5625 0,-12.125 z"
style="fill:#6ba1ff;fill-opacity:1;stroke:none" />
<g
id="g4163">
<path
style="fill:url(#linearGradient4219);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 26.6875,57.40901 0,-26.81526 6.5,-8.875 18.93725,-5.0625 5.68775,5.65625 0,26.59651 -4.625,9.55974 -18.75,5.03125 z"
id="path3104"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:url(#linearGradient4221);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 33.1875,21.71875 7,8.75 25.9375,3.65625 l 26.187251,13 z"
id="path3104-9-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient4223);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 33.1875,21.71875 7,8.7499997 0.5,17.625 l 0,0 26.1875,12.96875 z"
id="path3104-9-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
style="fill:url(#linearGradient4225);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 0.5,17.625 26.1875,12.96875 0,26.81526 -26.1875,-13 z"
id="path3104-9-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient4227);fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 26.6875,57.40901 0.5,44.40901 8.25,50.53125 34.4375,63.5 z"
id="path3104-9-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,521 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Ship_Weight.svg">
<defs
id="defs2987">
<linearGradient
id="linearGradient3968">
<stop
id="stop3970"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#828282;stop-opacity:1;"
offset="0.54039383"
id="stop3976" />
<stop
style="stop-color:#606060;stop-opacity:1;"
offset="0.77134961"
id="stop3974" />
<stop
id="stop3972"
offset="1"
style="stop-color:#000000;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3911">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3913" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3915" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3903">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3905" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3907" />
</linearGradient>
<linearGradient
id="linearGradient4722">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4724" />
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="1"
id="stop4726" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3873"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lend"
style="overflow:visible;">
<path
id="path3867"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<linearGradient
id="linearGradient3937">
<stop
style="stop-color:#be7328;stop-opacity:1;"
offset="0"
id="stop3939" />
<stop
style="stop-color:#dc962d;stop-opacity:1;"
offset="1"
id="stop3941" />
</linearGradient>
<linearGradient
id="linearGradient3929">
<stop
id="stop3931"
offset="0"
style="stop-color:#c88c3c;stop-opacity:1;" />
<stop
id="stop3933"
offset="1"
style="stop-color:#ffff96;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3893">
<stop
style="stop-color:#505050;stop-opacity:1;"
offset="0"
id="stop3895" />
<stop
style="stop-color:#aaaaaa;stop-opacity:1;"
offset="1"
id="stop3897" />
</linearGradient>
<linearGradient
id="linearGradient3873">
<stop
style="stop-color:#f0be6e;stop-opacity:1;"
offset="0"
id="stop3875" />
<stop
style="stop-color:#c88228;stop-opacity:1;"
offset="1"
id="stop3877" />
</linearGradient>
<linearGradient
id="linearGradient3863">
<stop
id="stop3865"
offset="0"
style="stop-color:#6e4b18;stop-opacity:1;" />
<stop
id="stop3867"
offset="1"
style="stop-color:#c88228;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3979">
<stop
id="stop3981"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3983"
offset="1"
style="stop-color:#ff9600;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3971">
<stop
id="stop3973"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop3975"
offset="1"
style="stop-color:#be7300;stop-opacity:1;" />
</linearGradient>
<marker
inkscape:stockid="Arrow1Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Send"
style="overflow:visible;">
<path
id="path4031"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
transform="scale(0.2) rotate(180) translate(6,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Send"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Send"
style="overflow:visible;">
<path
id="path4049"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) rotate(180) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Sstart"
style="overflow:visible">
<path
id="path4046"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.3) translate(-2.3,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path4040"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) translate(0,0)" />
</marker>
<linearGradient
id="linearGradient3900">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3902" />
<stop
style="stop-color:#a0a0a0;stop-opacity:1;"
offset="1"
id="stop3904" />
</linearGradient>
<linearGradient
id="linearGradient3882">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3884" />
<stop
style="stop-color:#960000;stop-opacity:1;"
offset="1"
id="stop3886" />
</linearGradient>
<linearGradient
id="linearGradient3860">
<stop
style="stop-color:#1e76e3;stop-opacity:1;"
offset="0"
id="stop3862" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3860-6"
id="linearGradient3866-5"
x1="31.125395"
y1="61.410763"
x2="30.113636"
y2="12.160761"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3860-6">
<stop
style="stop-color:#5a9ff5;stop-opacity:1;"
offset="0"
id="stop3862-4" />
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3864-4" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3873"
id="linearGradient3871"
gradientUnits="userSpaceOnUse"
x1="38.907837"
y1="51.470051"
x2="45.302406"
y2="54.091148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3863"
id="linearGradient3891"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3893"
id="linearGradient3899"
gradientUnits="userSpaceOnUse"
x1="51.657837"
y1="34.470051"
x2="45.427406"
y2="32.216148" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3882"
id="radialGradient3903"
cx="53.748837"
cy="4.9173141"
fx="53.748837"
fy="4.9173141"
r="3.2874005"
gradientTransform="matrix(2.3303929,-1.4921636,1.0936999,1.7080907,-77.643882,78.644487)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3927"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3943"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="radialGradient3949"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.7636523,-0.71644256,0.733044,2.8276918,-61.887066,-71.992203)"
cx="15.125"
cy="48.035076"
fx="15.125"
fy="48.035076"
r="18.875" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3937"
id="radialGradient3951"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.40097726,-0.37931652,0.11734116,0.12404187,14.422507,4.6205505)"
cx="-14.308363"
cy="14.910047"
fx="-14.308363"
fy="14.910047"
r="18.875" />
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow1Mend-3"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path3873-0"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(-0.4,0,0,-0.4,-4,0)" />
</marker>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4722"
id="radialGradient4730"
cx="22.399223"
cy="27.920977"
fx="22.399223"
fy="27.920977"
r="25.5625"
gradientTransform="matrix(0.61346721,-0.22517965,0.21191717,0.57733561,2.1543769,16.986575)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3909"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3917"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3928"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3930"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3911"
id="linearGradient3935"
gradientUnits="userSpaceOnUse"
x1="39.647182"
y1="67.479065"
x2="39.647182"
y2="15.294641" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3903"
id="linearGradient3938"
gradientUnits="userSpaceOnUse"
x1="33.267635"
y1="23.615986"
x2="33.267635"
y2="63.06311" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3968"
id="radialGradient3952"
cx="30.228815"
cy="20.070992"
fx="30.228815"
fy="20.070992"
r="3.4475341"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2238696,-8.502217e-5,8.5302128e-5,1.2278995,-6.7690238,-4.5715991)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
inkscape:cx="20.331522"
inkscape:cy="42.580446"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1364"
inkscape:window-height="718"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="fill:none;stroke:url(#radialGradient3952);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3940"
sodipodi:cx="30.228815"
sodipodi:cy="20.070992"
sodipodi:rx="3.2703688"
sodipodi:ry="3.2703688"
d="m 33.499184,20.070992 a 3.2703688,3.2703688 0 1 1 -6.540738,0 3.2703688,3.2703688 0 1 1 6.540738,0 z"
transform="matrix(1.2561254,0,0,1.2561254,-5.1034967,-6.625066)" />
<g
id="g3978">
<path
sodipodi:nodetypes="sccscsccscs"
inkscape:connector-curvature="0"
id="path3066"
d="m 20.25,23.455583 c -2.875,0 -3.082092,0.515104 -4.625,3.1875 L 7.5,45.125 C 6.2093353,48.234896 5.1249999,51 9.75,51 L 33,51 56.09375,51 c 4.625001,0 3.700055,-2.632521 2.25,-5.8125 l -8.125,-18.481917 c -1.542908,-2.672396 -1.75,-3.25 -4.625,-3.25 l -12.59375,0 z"
style="fill:url(#linearGradient3935);fill-opacity:1;stroke:url(#linearGradient3938);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<text
sodipodi:linespacing="125%"
id="text3919"
y="42.5"
x="20.625"
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
xml:space="preserve"><tspan
y="42.5"
x="20.625"
id="tspan3921"
sodipodi:role="line">kg.</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -116,11 +116,8 @@ class Plot(object):
@param ship Active ship instance. @param ship Active ship instance.
""" """
# Create the spreadsheet # Create the spreadsheet
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Spreadsheet") obj = Spreadsheet.makeSpreadsheet()
s = Spreadsheet.Spreadsheet(obj) s = obj.Proxy
if FreeCAD.GuiUp:
Spreadsheet.ViewProviderSpreadsheet(obj.ViewObject)
FreeCAD.ActiveDocument.recompute()
obj.Label = 'Areas curve' obj.Label = 'Areas curve'
# Print the header # Print the header

View File

@ -31,6 +31,7 @@ import PlotAux
import Instance import Instance
from shipUtils import Paths from shipUtils import Paths
import shipUtils.Units as USys import shipUtils.Units as USys
import shipUtils.Locale as Locale
from shipHydrostatics import Tools as Hydrostatics from shipHydrostatics import Tools as Hydrostatics
@ -180,23 +181,23 @@ class TaskPanel:
form = mw.findChild(QtGui.QWidget, "TaskPanel") form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.draft = self.widget(QtGui.QLineEdit, "Draft") form.draft = self.widget(QtGui.QLineEdit, "Draft")
form.trim = self.widget(QtGui.QLineEdit, "Trim") form.trim = self.widget(QtGui.QLineEdit, "Trim")
form.draft.setText(length_format.format( form.draft.setText(Locale.toString(length_format.format(
self.ship.Draft.getValueAs(USys.getLengthUnits()).Value)) self.ship.Draft.getValueAs(USys.getLengthUnits()).Value)))
form.trim.setText(angle_format.format(0.0)) form.trim.setText(Locale.toString(angle_format.format(0.0)))
# Try to use saved values # Try to use saved values
props = self.ship.PropertiesList props = self.ship.PropertiesList
try: try:
props.index("AreaCurveDraft") props.index("AreaCurveDraft")
form.draft.setText(length_format.format( form.draft.setText(Locale.toString(length_format.format(
self.ship.AreaCurveDraft.getValueAs( self.ship.AreaCurveDraft.getValueAs(
USys.getLengthUnits()).Value)) USys.getLengthUnits()).Value)))
except: except:
pass pass
try: try:
props.index("AreaCurveTrim") props.index("AreaCurveTrim")
form.trim.setText(angle_format.format( form.trim.setText(Locale.toString(angle_format.format(
self.ship.AreaCurveTrim.getValueAs( self.ship.AreaCurveTrim.getValueAs(
USys.getAngleUnits()).Value)) USys.getAngleUnits()).Value)))
except ValueError: except ValueError:
pass pass
# Update GUI # Update GUI
@ -234,8 +235,8 @@ class TaskPanel:
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
val = min(val_max, max(val_min, val)) val = min(val_max, max(val_min, val))
qty = Units.Quantity('{} m'.format(val)) qty = Units.Quantity('{} m'.format(val))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
return val return val
def clampAngle(self, widget, val_min, val_max, val): def clampAngle(self, widget, val_min, val_max, val):
@ -244,8 +245,8 @@ class TaskPanel:
input_format = USys.getAngleFormat() input_format = USys.getAngleFormat()
val = min(val_max, max(val_min, val)) val = min(val_max, max(val_min, val))
qty = Units.Quantity('{} deg'.format(val)) qty = Units.Quantity('{} deg'.format(val))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
return val return val
def onData(self, value): def onData(self, value):
@ -267,16 +268,16 @@ class TaskPanel:
draft = self.ship.Draft.getValueAs(USys.getLengthUnits()).Value draft = self.ship.Draft.getValueAs(USys.getLengthUnits()).Value
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
qty = Units.Quantity('{} m'.format(draft)) qty = Units.Quantity('{} m'.format(draft))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
try: try:
trim = Units.Quantity(form.trim.text()).getValueAs('deg').Value trim = Units.Quantity(form.trim.text()).getValueAs('deg').Value
except: except:
trim = 0.0 trim = 0.0
input_format = USys.getAngleFormat() input_format = USys.getAngleFormat()
qty = Units.Quantity('{} deg'.format(trim)) qty = Units.Quantity('{} deg'.format(trim))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
bbox = self.ship.Shape.BoundBox bbox = self.ship.Shape.BoundBox
draft_min = bbox.ZMin / Units.Metre.Value draft_min = bbox.ZMin / Units.Metre.Value

View File

@ -0,0 +1,127 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import os
from PySide import QtGui, QtCore
import FreeCAD
import FreeCADGui
from FreeCAD import Base
import Spreadsheet
class Plot(object):
def __init__(self, l, z, v, tank):
""" Constructor. performs the plot and shows it.
@param l Percentages of filling level.
@param z Level z coordinates.
@param v Volume of fluid.
@param tank Active tank instance.
"""
self.plot(l, z, v, tank)
self.spreadSheet(l, z, v, tank)
def plot(self, l, z, v, tank):
""" Perform the areas curve plot.
@param l Percentages of filling level.
@param z Level z coordinates.
@param v Volume of fluid.
@param tank Active tank instance.
@return True if error happens.
"""
try:
import Plot
plt = Plot.figure('Capacity curve')
except ImportError:
msg = QtGui.QApplication.translate(
"ship_console",
"Plot module is disabled, so I cannot perform the plot",
None,
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintWarning(msg + '\n')
return True
# Plot the volume as a function of the level percentage
vols = Plot.plot(l, v, 'Capacity')
vols.line.set_linestyle('-')
vols.line.set_linewidth(2.0)
vols.line.set_color((0.0, 0.0, 0.0))
Plot.xlabel(r'Percentage of filling level')
Plot.ylabel(r'$V \; [\mathrm{m}^3]$')
plt.axes.xaxis.label.set_fontsize(20)
plt.axes.yaxis.label.set_fontsize(20)
Plot.grid(True)
# Now duplicate the axes
ax = Plot.addNewAxes()
# Y axis can be placed at right
ax.yaxis.tick_right()
ax.spines['right'].set_color((0.0, 0.0, 0.0))
ax.spines['left'].set_color('none')
ax.yaxis.set_ticks_position('right')
ax.yaxis.set_label_position('right')
# And X axis can be placed at top
ax.xaxis.tick_top()
ax.spines['top'].set_color((0.0, 0.0, 0.0))
ax.spines['bottom'].set_color('none')
ax.xaxis.set_ticks_position('top')
ax.xaxis.set_label_position('top')
# Plot the volume as a function of the level z coordinate
vols = Plot.plot(z, v, 'Capacity')
vols.line.set_linestyle('-')
vols.line.set_linewidth(2.0)
vols.line.set_color((0.0, 0.0, 0.0))
Plot.xlabel(r'$z \; [\mathrm{m}]$')
Plot.ylabel(r'$V \; [\mathrm{m}^3]$')
ax.xaxis.label.set_fontsize(20)
ax.yaxis.label.set_fontsize(20)
Plot.grid(True)
# End
plt.update()
return False
def spreadSheet(self, l, z, v, tank):
""" Write the output data file.
@param l Percentages of filling level.
@param z Level z coordinates.
@param v Volume of fluid.
@param tank Active tank instance.
"""
# Create the spreadsheet
obj = Spreadsheet.makeSpreadsheet()
s = obj.Proxy
obj.Label = 'Capacity curve'
# Print the header
s.a1 = "Percentage of filling level"
s.b1 = "Level [m]"
s.c1 = "Volume [m^3]"
# Print the data
for i in range(len(l)):
s.__setattr__("a{}".format(i + 2), l[i])
s.__setattr__("b{}".format(i + 2), z[i])
s.__setattr__("c{}".format(i + 2), v[i])
# Open the spreadsheet
FreeCADGui.ActiveDocument.setEdit(obj.Name, 0)

View File

@ -0,0 +1,186 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import math
import FreeCAD as App
import FreeCADGui as Gui
import Units
from PySide import QtGui, QtCore
import PlotAux
import TankInstance as Instance
from shipUtils import Paths
import shipUtils.Units as USys
class TaskPanel:
def __init__(self):
self.ui = Paths.modulePath() + "/shipCapacityCurve/TaskPanel.ui"
self.tank = None
def accept(self):
if self.tank is None:
return False
# Plot data
l, z, v = self.compute()
PlotAux.Plot(l, z, v, self.tank)
return True
def reject(self):
return True
def clicked(self, index):
pass
def open(self):
pass
def needsFullSpace(self):
return True
def isAllowedAlterSelection(self):
return False
def isAllowedAlterView(self):
return True
def isAllowedAlterDocument(self):
return False
def helpRequested(self):
pass
def setupUi(self):
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.points = self.widget(QtGui.QSpinBox, "Points")
self.form = form
if self.initValues():
return True
self.retranslateUi()
def getMainWindow(self):
toplevel = QtGui.qApp.topLevelWidgets()
for i in toplevel:
if i.metaObject().className() == "Gui::MainWindow":
return i
raise Exception("No main window found")
def widget(self, class_id, name):
"""Return the selected widget.
Keyword arguments:
class_id -- Class identifier
name -- Name of the widget
"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
return form.findChild(class_id, name)
def initValues(self):
""" Set initial values for fields
"""
selObjs = Gui.Selection.getSelection()
if not selObjs:
msg = QtGui.QApplication.translate(
"ship_console",
"A tank instance must be selected before using this tool (no"
" objects selected)",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
for i in range(0, len(selObjs)):
obj = selObjs[i]
props = obj.PropertiesList
try:
props.index("IsTank")
except ValueError:
continue
if obj.IsTank:
if self.tank:
msg = QtGui.QApplication.translate(
"ship_console",
"More than one tank have been selected (the extra"
" tanks will be ignored)",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintWarning(msg + '\n')
break
self.tank = obj
if not self.tank:
msg = QtGui.QApplication.translate(
"ship_console",
"A tank instance must be selected before using this tool (no"
" valid tank found at the selected objects)",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
return False
def retranslateUi(self):
""" Set user interface locale strings. """
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.setWindowTitle(QtGui.QApplication.translate(
"ship_capacity",
"Plot the tank capacity curve",
None,
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "PointsLabel").setText(
QtGui.QApplication.translate(
"ship_capacity",
"Number of points",
None,
QtGui.QApplication.UnicodeUTF8))
def compute(self):
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.points = self.widget(QtGui.QSpinBox, "Points")
bbox = self.tank.Shape.BoundBox
dz = Units.Quantity(bbox.ZMax - bbox.ZMin, Units.Length)
n = form.points.value()
dlevel = 100.0 / (n - 1)
l = [0.0]
v = [0.0]
z = [0.0]
for i in range(1, n):
level = i * dlevel
vol = self.tank.Proxy.setFillingLevel(self.tank, level)
l.append(level)
z.append(level / 100.0 * dz.getValueAs("m").Value)
v.append(vol.getValueAs("m^3").Value)
return (l, z, v)
def createTask():
panel = TaskPanel()
Gui.Control.showDialog(panel)
if panel.setupUi():
Gui.Control.closeDialog(panel)
return None
return panel

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskPanel</class>
<widget class="QWidget" name="TaskPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<height>128</height>
</rect>
</property>
<property name="windowTitle">
<string>Capacity curve</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="PointsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Number of points</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="Points">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>51</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,29 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import TaskPanel
def load():
""" Loads the tool """
TaskPanel.createTask()

View File

@ -29,6 +29,7 @@ import Preview
import Instance import Instance
from shipUtils import Paths from shipUtils import Paths
import shipUtils.Units as USys import shipUtils.Units as USys
import shipUtils.Locale as Locale
class TaskPanel: class TaskPanel:
def __init__(self): def __init__(self):
@ -203,16 +204,16 @@ class TaskPanel:
form.draft = self.widget(QtGui.QLineEdit, "Draft") form.draft = self.widget(QtGui.QLineEdit, "Draft")
qty = Units.Quantity(self.bounds[0], Units.Length) qty = Units.Quantity(self.bounds[0], Units.Length)
form.length.setText(input_format.format( form.length.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
self.L = self.bounds[0] / Units.Metre.Value self.L = self.bounds[0] / Units.Metre.Value
qty = Units.Quantity(self.bounds[1], Units.Length) qty = Units.Quantity(self.bounds[1], Units.Length)
form.breadth.setText(input_format.format( form.breadth.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
self.B = self.bounds[1] / Units.Metre.Value self.B = self.bounds[1] / Units.Metre.Value
qty = Units.Quantity(self.bounds[2], Units.Length) qty = Units.Quantity(self.bounds[2], Units.Length)
form.draft.setText(input_format.format( form.draft.setText(Locale.toString(input_format.format(
0.5 * qty.getValueAs(USys.getLengthUnits()).Value)) 0.5 * qty.getValueAs(USys.getLengthUnits()).Value)))
self.T = 0.5 * self.bounds[2] / Units.Metre.Value self.T = 0.5 * self.bounds[2] / Units.Metre.Value
return False return False
@ -248,8 +249,8 @@ class TaskPanel:
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
val = min(val_max, max(val_min, val)) val = min(val_max, max(val_min, val))
qty = Units.Quantity('{} m'.format(val)) qty = Units.Quantity('{} m'.format(val))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
return val return val
def onData(self, value): def onData(self, value):

View File

@ -0,0 +1,190 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import FreeCAD as App
import FreeCADGui as Gui
import Units
from PySide import QtGui, QtCore
import TankInstance as Instance
from shipUtils import Paths
import shipUtils.Units as USys
class TaskPanel:
def __init__(self):
"""Constructor"""
self.ui = Paths.modulePath() + "/shipCreateTank/TaskPanel.ui"
def accept(self):
"""Create the ship instance"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
# Create the object
ship = self.ships[form.ship.currentIndex()]
obj = App.ActiveDocument.addObject("Part::FeaturePython", "Tank")
tank = Instance.Tank(obj, self.solids, ship)
Instance.ViewProviderTank(obj.ViewObject)
# Set it as a child of the ship
tanks = ship.Tanks[:]
tanks.append(obj.Name)
ship.Tanks = tanks
App.ActiveDocument.recompute()
return True
def reject(self):
"""Cancel the job"""
return True
def clicked(self, index):
pass
def open(self):
pass
def needsFullSpace(self):
return True
def isAllowedAlterSelection(self):
return False
def isAllowedAlterView(self):
return True
def isAllowedAlterDocument(self):
return False
def helpRequested(self):
pass
def setupUi(self):
"""Create and configurate the user interface"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
self.form = form
if self.initValues():
return True
self.retranslateUi()
def getMainWindow(self):
toplevel = QtGui.qApp.topLevelWidgets()
for i in toplevel:
if i.metaObject().className() == "Gui::MainWindow":
return i
raise Exception("No main window found")
def widget(self, class_id, name):
"""Return the selected widget.
Keyword arguments:
class_id -- Class identifier
name -- Name of the widget
"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
return form.findChild(class_id, name)
def initValues(self):
"""Setup the initial values"""
# Ensure that there are at least one valid object to generate the
# tank
selObjs = Gui.Selection.getSelection()
self.solids = []
if not selObjs:
msg = QtGui.QApplication.translate(
"ship_tank",
"Tanks objects can only be created on top of its geometry"
" (no objects selected)",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
for obj in selObjs:
try:
self.solids.extend(obj.Shape.Solids)
except:
continue
if not len(self.solids):
msg = QtGui.QApplication.translate(
"ship_tank",
"No solids found in the selected objects",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
# Ensure as well that exist at least one valid ship to create the
# entity inside it
self.ships = []
for obj in App.ActiveDocument.Objects:
try:
if obj.IsShip:
self.ships.append(obj)
except:
continue
if not len(self.ships):
msg = QtGui.QApplication.translate(
"ship_tank",
"There are not ship objects to create weights into them",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
# Fill the ships combo box
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
icon = QtGui.QIcon(QtGui.QPixmap(":/icons/Ship_Instance.svg"))
form.ship.clear()
for ship in self.ships:
form.ship.addItem(icon, ship.Label)
form.ship.setCurrentIndex(0)
return False
def retranslateUi(self):
"""Set the user interface locale strings."""
self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_tank",
"Create a new tank",
None,
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "ShipLabel").setText(
QtGui.QApplication.translate(
"ship_tank",
"Ship",
None,
QtGui.QApplication.UnicodeUTF8))
def createTask():
panel = TaskPanel()
Gui.Control.showDialog(panel)
if panel.setupUi():
Gui.Control.closeDialog(panel)
return None
return panel

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskPanel</class>
<widget class="QWidget" name="TaskPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<height>78</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Create new tank</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="ShipLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Ship</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="Ship">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,29 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import TaskPanel
def load():
"""Loads the tool in the task panel"""
TaskPanel.createTask()

View File

@ -0,0 +1,287 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import FreeCAD as App
import FreeCADGui as Gui
import Units
from PySide import QtGui, QtCore
import WeightInstance as Instance
from shipUtils import Paths
import shipUtils.Units as USys
class TaskPanel:
def __init__(self):
"""Constructor"""
self.ui = Paths.modulePath() + "/shipCreateWeight/TaskPanel.ui"
def accept(self):
"""Create the ship instance"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
form.weight = self.widget(QtGui.QLineEdit, "Weight")
# Create the object
ship = self.ships[form.ship.currentIndex()]
obj = App.ActiveDocument.addObject("Part::FeaturePython", "Weight")
weight = Instance.Weight(obj, self.shapes, ship)
Instance.ViewProviderWeight(obj.ViewObject)
# Set the mass/density
m_unit = USys.getMassUnits()
l_unit = USys.getLengthUnits()
qty = Units.parseQuantity(form.weight.text())
if self.elem_type == 1:
w_unit = m_unit
obj.Mass = qty.getValueAs(w_unit).Value
elif self.elem_type == 2:
w_unit = m_unit + '/' + l_unit
obj.LineDens = qty.getValueAs(w_unit).Value
elif self.elem_type == 3:
w_unit = m_unit + '/' + l_unit + '^2'
obj.AreaDens = qty.getValueAs(w_unit).Value
elif self.elem_type == 4:
w_unit = m_unit + '/' + l_unit + '^3'
obj.Dens = qty.getValueAs(w_unit).Value
# Set it as a child of the ship
weights = ship.Weights[:]
weights.append(obj.Name)
ship.Weights = weights
App.ActiveDocument.recompute()
return True
def reject(self):
"""Cancel the job"""
return True
def clicked(self, index):
pass
def open(self):
pass
def needsFullSpace(self):
return True
def isAllowedAlterSelection(self):
return False
def isAllowedAlterView(self):
return True
def isAllowedAlterDocument(self):
return False
def helpRequested(self):
pass
def setupUi(self):
"""Create and configurate the user interface"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
form.weight = self.widget(QtGui.QLineEdit, "Weight")
self.form = form
if self.initValues():
return True
self.retranslateUi()
def getMainWindow(self):
toplevel = QtGui.qApp.topLevelWidgets()
for i in toplevel:
if i.metaObject().className() == "Gui::MainWindow":
return i
raise Exception("No main window found")
def widget(self, class_id, name):
"""Return the selected widget.
Keyword arguments:
class_id -- Class identifier
name -- Name of the widget
"""
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
return form.findChild(class_id, name)
def initValues(self):
"""Setup the initial values"""
# Ensure that there are at least one valid object to generate the
# weight
selObjs = Gui.Selection.getSelection()
self.shapes = []
if not selObjs:
msg = QtGui.QApplication.translate(
"ship_weight",
"Weight objects can only be created on top of its geometry"
" (no objects selected)",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
for obj in selObjs:
try:
self.shapes.append(obj.Shape)
except:
continue
if not len(self.shapes):
msg = QtGui.QApplication.translate(
"ship_weight",
"No geometrical shapes found in the selected objects",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
# Get the element type
# 0 = unknow, 1 = vertex, 2 = line, 3 = face, 4 = solids
self.elem_type = 0
for shape in self.shapes:
# Doing it in this way we are protected under strange entities,
# and we are prepared to add higher level type of entities in the
# future, just in case...
try:
if len(shape.Solids):
self.elem_type = max(4, self.elem_type)
except:
pass
try:
if len(shape.Faces):
self.elem_type = max(3, self.elem_type)
except:
pass
try:
if len(shape.Edges):
self.elem_type = max(2, self.elem_type)
except:
pass
try:
if len(shape.Vertexes):
self.elem_type = max(1, self.elem_type)
except:
pass
# Could it happens???
if self.elem_type == 0:
msg = QtGui.QApplication.translate(
"ship_weight",
"Unknow object shapes selected",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
# Ensure as well that exist at least one valid ship to create the
# entity inside it
self.ships = []
for obj in App.ActiveDocument.Objects:
try:
if obj.IsShip:
self.ships.append(obj)
except:
continue
if not len(self.ships):
msg = QtGui.QApplication.translate(
"ship_weight",
"There are not ship objects to create weights into them",
None,
QtGui.QApplication.UnicodeUTF8)
App.Console.PrintError(msg + '\n')
return True
# Fill the ships combo box
mw = self.getMainWindow()
form = mw.findChild(QtGui.QWidget, "TaskPanel")
form.ship = self.widget(QtGui.QComboBox, "Ship")
form.weight = self.widget(QtGui.QLineEdit, "Weight")
icon = QtGui.QIcon(QtGui.QPixmap(":/icons/Ship_Instance.svg"))
form.ship.clear()
for ship in self.ships:
form.ship.addItem(icon, ship.Label)
form.ship.setCurrentIndex(0)
# Initialize the 0 mass/density string field
m_unit = USys.getMassUnits()
l_unit = USys.getLengthUnits()
if self.elem_type == 1:
w_unit = m_unit
elif self.elem_type == 2:
w_unit = m_unit + '/' + l_unit
elif self.elem_type == 3:
w_unit = m_unit + '/' + l_unit + '^2'
elif self.elem_type == 4:
w_unit = m_unit + '/' + l_unit + '^3'
form.weight.setText('0 ' + w_unit)
return False
def retranslateUi(self):
"""Set the user interface locale strings."""
self.form.setWindowTitle(QtGui.QApplication.translate(
"ship_weight",
"Create a new weight",
None,
QtGui.QApplication.UnicodeUTF8))
self.widget(QtGui.QLabel, "ShipLabel").setText(
QtGui.QApplication.translate(
"ship_weight",
"Ship",
None,
QtGui.QApplication.UnicodeUTF8))
if self.elem_type == 1:
self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate(
"ship_weight",
"Mass",
None,
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 2:
self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate(
"ship_weight",
"Linear density",
None,
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 3:
self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate(
"ship_weight",
"Area density",
None,
QtGui.QApplication.UnicodeUTF8))
elif self.elem_type == 4:
self.widget(QtGui.QLabel, "WeightLabel").setText(
QtGui.QApplication.translate(
"ship_weight",
"Density",
None,
QtGui.QApplication.UnicodeUTF8))
def createTask():
panel = TaskPanel()
Gui.Control.showDialog(panel)
if panel.setupUi():
Gui.Control.closeDialog(panel)
return None
return panel

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskPanel</class>
<widget class="QWidget" name="TaskPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>260</width>
<height>78</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Create new weight</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="WeightLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Weight</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::InputField" name="Weight">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="ShipLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Ship</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="Ship">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header location="global">Gui/Inputfield.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,29 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import TaskPanel
def load():
"""Loads the tool in the task panel"""
TaskPanel.createTask()

View File

@ -304,14 +304,10 @@ class Plot(object):
@return True if error happens. @return True if error happens.
""" """
# Create the spreadsheet # Create the spreadsheet
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Spreadsheet") obj = Spreadsheet.makeSpreadsheet()
s = Spreadsheet.Spreadsheet(obj) s = obj.Proxy
if FreeCAD.GuiUp:
Spreadsheet.ViewProviderSpreadsheet(obj.ViewObject)
FreeCAD.ActiveDocument.recompute()
obj.Label = 'Hydrostatics' obj.Label = 'Hydrostatics'
# Print the header # Print the header
s.a1 = "displacement [ton]" s.a1 = "displacement [ton]"
s.b1 = "draft [m]" s.b1 = "draft [m]"

View File

@ -33,6 +33,7 @@ import PlotAux
import Instance import Instance
from shipUtils import Paths from shipUtils import Paths
import shipUtils.Units as USys import shipUtils.Units as USys
import shipUtils.Locale as Locale
import Tools import Tools
@ -239,28 +240,28 @@ class TaskPanel:
try: try:
props.index("HydrostaticsTrim") props.index("HydrostaticsTrim")
form.trim.setText(angle_format.format( form.trim.setText(Locale.toString(angle_format.format(
self.ship.HydrostaticsTrim.getValueAs( self.ship.HydrostaticsTrim.getValueAs(
USys.getLengthUnits()).Value)) USys.getLengthUnits()).Value)))
except ValueError: except ValueError:
form.trim.setText(angle_format.format(0.0)) form.trim.setText(Locale.toString(angle_format.format(0.0)))
try: try:
props.index("HydrostaticsMinDraft") props.index("HydrostaticsMinDraft")
form.minDraft.setText(length_format.format( form.minDraft.setText(Locale.toString(length_format.format(
self.ship.HydrostaticsMinDraft.getValueAs( self.ship.HydrostaticsMinDraft.getValueAs(
USys.getLengthUnits()).Value)) USys.getLengthUnits()).Value)))
except ValueError: except ValueError:
form.minDraft.setText(length_format.format( form.minDraft.setText(Locale.toString(length_format.format(
0.9 * self.ship.Draft.getValueAs('m').Value)) 0.9 * self.ship.Draft.getValueAs('m').Value)))
try: try:
props.index("HydrostaticsMaxDraft") props.index("HydrostaticsMaxDraft")
form.maxDraft.setText(length_format.format( form.maxDraft.setText(Locale.toString(length_format.format(
self.ship.HydrostaticsMaxDraft.getValueAs( self.ship.HydrostaticsMaxDraft.getValueAs(
USys.getLengthUnits()).Value)) USys.getLengthUnits()).Value)))
except ValueError: except ValueError:
form.maxDraft.setText(length_format.format( form.maxDraft.setText(Locale.toString(length_format.format(
1.1 * self.ship.Draft.getValueAs('m').Value)) 1.1 * self.ship.Draft.getValueAs('m').Value)))
try: try:
props.index("HydrostaticsNDraft") props.index("HydrostaticsNDraft")
@ -311,8 +312,8 @@ class TaskPanel:
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
val = min(val_max, max(val_min, val)) val = min(val_max, max(val_min, val))
qty = Units.Quantity('{} m'.format(val)) qty = Units.Quantity('{} m'.format(val))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
return val return val
def clampAngle(self, widget, val_min, val_max, val): def clampAngle(self, widget, val_min, val_max, val):
@ -321,8 +322,8 @@ class TaskPanel:
input_format = USys.getAngleFormat() input_format = USys.getAngleFormat()
val = min(val_max, max(val_min, val)) val = min(val_max, max(val_min, val))
qty = Units.Quantity('{} deg'.format(val)) qty = Units.Quantity('{} deg'.format(val))
widget.setText(input_format.format( widget.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
return val return val
def onData(self, value): def onData(self, value):
@ -344,8 +345,8 @@ class TaskPanel:
trim = 0.0 trim = 0.0
input_format = USys.getAngleFormat() input_format = USys.getAngleFormat()
qty = Units.Quantity('{} deg'.format(trim)) qty = Units.Quantity('{} deg'.format(trim))
form.trim.setText(input_format.format( form.trim.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
try: try:
min_draft = Units.Quantity( min_draft = Units.Quantity(
form.minDraft.text()).getValueAs('m').Value form.minDraft.text()).getValueAs('m').Value
@ -353,8 +354,8 @@ class TaskPanel:
min_draft = 0.9 * self.ship.Draft.getValueAs('m').Value min_draft = 0.9 * self.ship.Draft.getValueAs('m').Value
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
qty = Units.Quantity('{} m'.format(min_draft)) qty = Units.Quantity('{} m'.format(min_draft))
form.minDraft.setText(input_format.format( form.minDraft.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
try: try:
max_draft = Units.Quantity( max_draft = Units.Quantity(
form.minDraft.text()).getValueAs('m').Value form.minDraft.text()).getValueAs('m').Value
@ -362,8 +363,8 @@ class TaskPanel:
max_draft = 0.9 * self.ship.Draft.getValueAs('m').Value max_draft = 0.9 * self.ship.Draft.getValueAs('m').Value
input_format = USys.getLengthFormat() input_format = USys.getLengthFormat()
qty = Units.Quantity('{} m'.format(max_draft)) qty = Units.Quantity('{} m'.format(max_draft))
form.maxDraft.setText(input_format.format( form.maxDraft.setText(Locale.toString(input_format.format(
qty.getValueAs(USys.getLengthUnits()).Value)) qty.getValueAs(USys.getLengthUnits()).Value)))
# Clamp the values to the bounds # Clamp the values to the bounds
bbox = self.ship.Shape.BoundBox bbox = self.ship.Shape.BoundBox

View File

@ -30,6 +30,7 @@ from PySide import QtGui, QtCore
import Preview import Preview
import Instance import Instance
from shipUtils import Paths from shipUtils import Paths
import shipUtils.Locale as Locale
class TaskPanel: class TaskPanel:
@ -365,7 +366,7 @@ class TaskPanel:
number = 0.0 number = 0.0
string = '{} m'.format(number) string = '{} m'.format(number)
item.setText(string) item.setText(Locale.toString(string))
# Regenerate the list # Regenerate the list
del SectionList[:] del SectionList[:]
for i in range(0, nRow): for i in range(0, nRow):

View File

@ -0,0 +1,31 @@
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
from PySide import QtCore
def toString(valueStr):
"""Natural extension of QtCore.QLocale.toString method, in this case
conveniently transforming a value string"""
dec_sep = QtCore.QLocale.system().decimalPoint()
return valueStr.replace(".", dec_sep)

View File

@ -1,57 +1,57 @@
#*************************************************************************** #***************************************************************************
#* * #* *
#* Copyright (c) 2011, 2012 * #* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> * #* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* * #* *
#* This program is free software; you can redistribute it and/or modify * #* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) * #* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of * #* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. * #* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. * #* for detail see the LICENCE text file. *
#* * #* *
#* This program is distributed in the hope that it will be useful, * #* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. * #* GNU Library General Public License for more details. *
#* * #* *
#* You should have received a copy of the GNU Library General Public * #* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software * #* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA * #* USA *
#* * #* *
#*************************************************************************** #***************************************************************************
def isAprox(a,b,tol=0.000001): def isAprox(a,b,tol=0.000001):
"""returns if a value is into (b-tol,b+tol) """returns if a value is into (b-tol,b+tol)
@param a Value to compare. @param a Value to compare.
@param b Center of valid interval @param b Center of valid interval
@param tol Radius of valid interval @param tol Radius of valid interval
@return True if a is into (b-tol,b+tol), False otherwise @return True if a is into (b-tol,b+tol), False otherwise
""" """
if (a < b+abs(tol)) and (a > b-abs(tol)): if (a < b+abs(tol)) and (a > b-abs(tol)):
return True return True
return False return False
def isSamePoint(a,b,tol=0.000001): def isSamePoint(a,b,tol=0.000001):
"""returns if two points are the same with a provided tolerance """returns if two points are the same with a provided tolerance
@param a Point to compare. @param a Point to compare.
@param b Reference point. @param b Reference point.
@param tol Radius of valid interval @param tol Radius of valid interval
@return True if twice point are the same, False otherwise @return True if twice point are the same, False otherwise
@note FreeCAD::Base::Vector types must be provided @note FreeCAD::Base::Vector types must be provided
""" """
if isAprox(a.x,b.x,tol) and isAprox(a.y,b.y,tol) and isAprox(a.z,b.z,tol): if isAprox(a.x,b.x,tol) and isAprox(a.y,b.y,tol) and isAprox(a.z,b.z,tol):
return True return True
return False return False
def isSameVertex(a,b,tol=0.0001): def isSameVertex(a,b,tol=0.0001):
"""returns if two points are the same with a provided tolerance """returns if two points are the same with a provided tolerance
@param a Point to compare. @param a Point to compare.
@param b Reference point. @param b Reference point.
@param tol Radius of valid interval @param tol Radius of valid interval
@return True if twice point are the same, False otherwise @return True if twice point are the same, False otherwise
@note FreeCAD::Part::Vertex types must be provided @note FreeCAD::Part::Vertex types must be provided
""" """
if isAprox(a.X,b.X,tol) and isAprox(a.Y,b.Y,tol) and isAprox(a.Z,b.Z,tol): if isAprox(a.X,b.X,tol) and isAprox(a.Y,b.Y,tol) and isAprox(a.Z,b.Z,tol):
return True return True
return False return False

View File

@ -1,55 +1,55 @@
#*************************************************************************** #***************************************************************************
#* * #* *
#* Copyright (c) 2011, 2012 * #* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> * #* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* * #* *
#* This program is free software; you can redistribute it and/or modify * #* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) * #* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of * #* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. * #* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. * #* for detail see the LICENCE text file. *
#* * #* *
#* This program is distributed in the hope that it will be useful, * #* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. * #* GNU Library General Public License for more details. *
#* * #* *
#* You should have received a copy of the GNU Library General Public * #* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software * #* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA * #* USA *
#* * #* *
#*************************************************************************** #***************************************************************************
import FreeCAD, FreeCADGui, os import FreeCAD, FreeCADGui, os
def modulePath(): def modulePath():
"""returns the current Ship design module path """returns the current Ship design module path
@return Module path""" @return Module path"""
path1 = FreeCAD.ConfigGet("AppHomePath") + "Mod/Ship" path1 = FreeCAD.ConfigGet("AppHomePath") + "Mod/Ship"
path2 = FreeCAD.ConfigGet("UserAppData") + "Mod/Ship" path2 = FreeCAD.ConfigGet("UserAppData") + "Mod/Ship"
if os.path.exists(path2): if os.path.exists(path2):
return path2 return path2
else: else:
return path1 return path1
def iconsPath(): def iconsPath():
"""returns the current Ship design module icons path """returns the current Ship design module icons path
@return Icons path""" @return Icons path"""
path = modulePath() + "/Resources/icons" path = modulePath() + "/Resources/icons"
return path return path
def getPathFromFile(fileName): def getPathFromFile(fileName):
""" Gets the directory path from a file name """ Gets the directory path from a file name
@param fileName Name of the file @param fileName Name of the file
@return Directory path. @return Directory path.
""" """
if not fileName: if not fileName:
return '' return ''
i = 1 i = 1
try: try:
while 1: while 1:
i = fileName.index("/", i+1) i = fileName.index("/", i+1)
except ValueError: except ValueError:
pass pass
return fileName[0:i+1] return fileName[0:i+1]

View File

@ -1,24 +1,24 @@
#*************************************************************************** #***************************************************************************
#* * #* *
#* Copyright (c) 2011, 2012 * #* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> * #* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* * #* *
#* This program is free software; you can redistribute it and/or modify * #* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) * #* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of * #* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. * #* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. * #* for detail see the LICENCE text file. *
#* * #* *
#* This program is distributed in the hope that it will be useful, * #* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. * #* GNU Library General Public License for more details. *
#* * #* *
#* You should have received a copy of the GNU Library General Public * #* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software * #* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA * #* USA *
#* * #* *
#*************************************************************************** #***************************************************************************
import FreeCAD import FreeCAD

View File

@ -39,11 +39,6 @@
<File Id="ShipExampleWigleyKatamaran" Name="wigley_katamaran.fcstd" /> <File Id="ShipExampleWigleyKatamaran" Name="wigley_katamaran.fcstd" />
</Component> </Component>
</Directory> </Directory>
<Directory Id="ModShipIcons" Name="icons" FileSource="../../Mod/Ship/resources/icons" >
<Component Id="CompModShipIcons" Guid="ebdaaf8f-b975-4097-9ef8-4ed51ce24adf" Win64='$(var.Win_64)' KeyPath="yes">
<File Id="ShipIcons01" Name="Ico.xpm" />
</Component>
</Directory>
</Directory> </Directory>
<Directory Id="ModshipAreasCurve" Name="shipAreasCurve" FileSource="../../Mod/Ship/shipAreasCurve" > <Directory Id="ModshipAreasCurve" Name="shipAreasCurve" FileSource="../../Mod/Ship/shipAreasCurve" >
<Component Id="CompModshipAreasCurve" Guid="49b32e4c-d861-4968-9c5c-8191ce6fa6c4" Win64='$(var.Win_64)' KeyPath="yes"> <Component Id="CompModshipAreasCurve" Guid="49b32e4c-d861-4968-9c5c-8191ce6fa6c4" Win64='$(var.Win_64)' KeyPath="yes">