From b52cf546f7b2e666fea5f4d3f8a948fd26fd9ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Luis=20Cerc=C3=B3s=20pita?= Date: Sat, 21 Jan 2012 17:50:49 +0100 Subject: [PATCH] Added Hydrostatics development tools --- src/Mod/Ship/CMakeLists.txt | 14 ++++++++- src/Mod/Ship/Makefile.am | 2 ++ src/Mod/Ship/shipHydrostatics/Tools.py | 36 +++++++++++++++++++++++ src/Mod/Ship/shipHydrostatics/__init__.py | 23 +++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/Mod/Ship/shipHydrostatics/Tools.py create mode 100644 src/Mod/Ship/shipHydrostatics/__init__.py diff --git a/src/Mod/Ship/CMakeLists.txt b/src/Mod/Ship/CMakeLists.txt index 783f641b0..9f86e5e4a 100644 --- a/src/Mod/Ship/CMakeLists.txt +++ b/src/Mod/Ship/CMakeLists.txt @@ -57,6 +57,12 @@ SET(ShipAreasCurve_SRCS ) SOURCE_GROUP("shipareascurve" FILES ${ShipAreasCurve_SRCS}) +SET(ShipHydrostatics_SRCS + shipHydrostatics/__init__.py + shipHydrostatics/Tools.py +) +SOURCE_GROUP("shiphydrostatics" FILES ${ShipHydrostatics_SRCS}) + SET(ShipUtils_SRCS shipUtils/__init__.py shipUtils/Math.py @@ -65,7 +71,7 @@ SET(ShipUtils_SRCS ) SOURCE_GROUP("shiputils" FILES ${ShipUtils_SRCS}) -SET(all_files ${ShipMain_SRCS} ${ShipIcons_SRCS} ${ShipCreateShip_SRCS} ${ShipOutlineDraw_SRCS} ${ShipAreasCurve_SRCS} ${ShipUtils_SRCS}) +SET(all_files ${ShipMain_SRCS} ${ShipIcons_SRCS} ${ShipCreateShip_SRCS} ${ShipOutlineDraw_SRCS} ${ShipAreasCurve_SRCS} ${ShipHydrostatics_SRCS} ${ShipUtils_SRCS}) ADD_CUSTOM_TARGET(Ship ALL SOURCES ${all_files} @@ -97,6 +103,12 @@ INSTALL( DESTINATION Mod/Ship/shipAreasCurve ) +INSTALL( + FILES + ${ShipHydrostatics_SRCS} + DESTINATION + Mod/Ship/shipHydrostatics +) INSTALL( FILES ${ShipUtils_SRCS} diff --git a/src/Mod/Ship/Makefile.am b/src/Mod/Ship/Makefile.am index 4cba953c0..bb1821b81 100644 --- a/src/Mod/Ship/Makefile.am +++ b/src/Mod/Ship/Makefile.am @@ -43,6 +43,8 @@ nobase_data_DATA = \ shipAreasCurve/Preview.py \ shipAreasCurve/TaskPanel.py \ shipAreasCurve/TaskPanel.ui \ + shipHydrostatics/__init__.ui \ + shipHydrostatics/Tools.ui \ shipUtils/__init__.py \ shipUtils/Math.py \ shipUtils/Paths.py \ diff --git a/src/Mod/Ship/shipHydrostatics/Tools.py b/src/Mod/Ship/shipHydrostatics/Tools.py new file mode 100644 index 000000000..282ccb71a --- /dev/null +++ b/src/Mod/Ship/shipHydrostatics/Tools.py @@ -0,0 +1,36 @@ +#*************************************************************************** +#* * +#* Copyright (c) 2011, 2012 * +#* Jose Luis Cercos Pita * +#* * +#* 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 +# FreeCAD modules +import FreeCAD as App +import FreeCADGui as Gui + +def Displacement(ship, draft, trim): + """ Calculate ship displacement. + @param ship Selected ship instance + @param traft Draft. + @param trim Trim in degrees. + @return Ship displacement, also X bouyance center coordinate is provided. + """ + return [0.0, 0.0] diff --git a/src/Mod/Ship/shipHydrostatics/__init__.py b/src/Mod/Ship/shipHydrostatics/__init__.py new file mode 100644 index 000000000..55ed9aee5 --- /dev/null +++ b/src/Mod/Ship/shipHydrostatics/__init__.py @@ -0,0 +1,23 @@ +#*************************************************************************** +#* * +#* Copyright (c) 2011, 2012 * +#* Jose Luis Cercos Pita * +#* * +#* 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 * +#* * +#*************************************************************************** +