forked from davesrocketshop/Rocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRocketGui.py
158 lines (131 loc) · 7.22 KB
/
RocketGui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# ***************************************************************************
# * Copyright (c) 2021-2024 David Carter <[email protected]> *
# * *
# * 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 *
# * *
# ***************************************************************************
__author__ = "David Carter"
__url__ = "https://www.davesrocketshop.com"
import FreeCAD
import FreeCADGui
from DraftTools import translate
from Ui.Commands.Command import Command
from Ui.Commands.CmdRocket import CmdRocket, CmdToggleRocket
from Ui.Commands.CmdStage import CmdStage, CmdToggleStage
from Ui.Commands.CmdParallelStage import CmdParallelStage, CmdToggleParallelStage
from Ui.Commands.CmdNoseCone import CmdNoseCone
from Ui.Commands.CmdTransition import CmdTransition
from Ui.Commands.CmdCenteringRing import CmdCenteringRing
from Ui.Commands.CmdBodyTube import CmdBodyTube, CmdCoupler, CmdInnerTube, CmdEngineBlock
from Ui.Commands.CmdPod import CmdPod
from Ui.Commands.CmdBulkhead import CmdBulkhead
from Ui.Commands.CmdLaunchGuides import CmdLaunchLug, CmdRailButton, CmdRailGuide, CmdStandOff
from Ui.Commands.CmdFin import CmdFin
from Ui.Commands.CmdFinCan import CmdFinCan
from Ui.Commands.CmdParachute import CmdParachute
from Ui.Commands.CmdEditTree import CmdMoveUp, CmdMoveDown
# Calculators
from Ui.Commands.CmdCalcBlackPowder import CmdCalcBlackPowder
from Ui.Commands.CmdCalcParachute import CmdCalcParachute
from Ui.Commands.CmdCalcThrustToWeight import CmdCalcThrustToWeight
from Ui.Commands.CmdCalcVentHoles import CmdCalcVentHoles
# Rocket specific sketcher
from Ui.Commands.CmdSketcher import CmdNewSketch
# Template generators
from Ui.Commands.CmdParachuteGore import CmdParachuteGore
# Analysis
from Ui.Commands.CmdFlutterAnalysis import CmdFinFlutter
from Ui.Commands.CmdFemAnalysis import CmdFemAnalysis
from Ui.Commands.CmdMaterialEditor import CmdMaterialEditor
from Ui.Commands.CmdMaterialMapping import CmdMaterialMapping
from Rocket.Constants import FEATURE_BODY_TUBE
from Rocket.Constants import FEATURE_LAUNCH_LUG, FEATURE_RAIL_BUTTON, FEATURE_RAIL_GUIDE, FEATURE_OFFSET
FreeCADGui.addCommand('Rocket_Rocket', CmdRocket())
FreeCADGui.addCommand('Rocket_ToggleRocket', CmdToggleRocket())
FreeCADGui.addCommand('Rocket_Stage', CmdStage())
FreeCADGui.addCommand('Rocket_ToggleStage', CmdToggleStage())
FreeCADGui.addCommand('Rocket_ParallelStage', CmdParallelStage())
FreeCADGui.addCommand('Rocket_ToggleParallelStage', CmdToggleParallelStage())
FreeCADGui.addCommand('Rocket_NoseCone', CmdNoseCone())
FreeCADGui.addCommand('Rocket_Transition', CmdTransition())
FreeCADGui.addCommand('Rocket_CenteringRing', CmdCenteringRing())
FreeCADGui.addCommand('Rocket_Bulkhead', CmdBulkhead())
FreeCADGui.addCommand('Rocket_Fin', CmdFin())
FreeCADGui.addCommand('Rocket_FinCan', CmdFinCan())
FreeCADGui.addCommand('Rocket_BodyTube', CmdBodyTube())
FreeCADGui.addCommand('Rocket_Coupler', CmdCoupler())
FreeCADGui.addCommand('Rocket_InnerTube', CmdInnerTube())
FreeCADGui.addCommand('Rocket_EngineBlock', CmdEngineBlock())
FreeCADGui.addCommand('Rocket_Pod', CmdPod())
FreeCADGui.addCommand('Rocket_LaunchLug', CmdLaunchLug())
FreeCADGui.addCommand('Rocket_RailButton', CmdRailButton())
FreeCADGui.addCommand('Rocket_RailGuide', CmdRailGuide())
FreeCADGui.addCommand('Rocket_Standoff', CmdStandOff())
FreeCADGui.addCommand('Rocket_Parachute', CmdParachute())
FreeCADGui.addCommand('Rocket_CalcBlackPowder', CmdCalcBlackPowder())
FreeCADGui.addCommand('Rocket_CalcParachute', CmdCalcParachute())
FreeCADGui.addCommand('Rocket_CalcThrustToWeight', CmdCalcThrustToWeight())
FreeCADGui.addCommand('Rocket_CalcVentHoles', CmdCalcVentHoles())
FreeCADGui.addCommand('Rocket_MoveUp', CmdMoveUp())
FreeCADGui.addCommand('Rocket_MoveDown', CmdMoveDown())
FreeCADGui.addCommand('Rocket_NewSketch', CmdNewSketch())
FreeCADGui.addCommand('Rocket_ParachuteGore', CmdParachuteGore())
FreeCADGui.addCommand('Rocket_FinFlutter', CmdFinFlutter())
FreeCADGui.addCommand('Rocket_FemAnalysis', CmdFemAnalysis())
FreeCADGui.addCommand('Rocket_MaterialEditor', CmdMaterialEditor())
FreeCADGui.addCommand('Rocket_MaterialMapping', CmdMaterialMapping())
class _CalculatorGroupCommand:
def GetCommands(self):
return tuple(['Rocket_CalcBlackPowder', 'Rocket_CalcParachute', 'Rocket_CalcThrustToWeight', 'Rocket_CalcVentHoles'])
def GetResources(self):
return {
'MenuText': translate('Rocket', 'Calculators'),
'ToolTip': translate('Rocket', 'Calculators'),
'Pixmap': FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/icons/Rocket_Calculator.svg"
}
def IsActive(self):
# Always available, even without active document
return True
class _TubeGroupCommand(Command):
def GetCommands(self):
return tuple(['Rocket_BodyTube', 'Rocket_Coupler', 'Rocket_InnerTube'])
def GetResources(self):
return {
'MenuText': translate('Rocket', 'Body Tubes'),
'ToolTip': translate('Rocket', 'Body Tubes'),
'Pixmap': FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/icons/Rocket_BodyTube.svg"
}
def IsActive(self):
if FreeCAD.ActiveDocument:
return self.partEligibleFeature(FEATURE_BODY_TUBE)
return False
class _GuidesGroupCommand(Command):
def GetCommands(self):
return tuple(['Rocket_LaunchLug', 'Rocket_RailButton', 'Rocket_RailGuide'])
def GetResources(self):
return {
'MenuText': translate('Rocket', 'Launch Guides'),
'ToolTip': translate('Rocket', 'Launch Guides'),
'Pixmap': FreeCAD.getUserAppDataDir() + "Mod/Rocket/Resources/icons/Rocket_LaunchLug.svg"
}
def IsActive(self):
if FreeCAD.ActiveDocument:
return self.partEligibleFeature([FEATURE_LAUNCH_LUG, FEATURE_RAIL_BUTTON, FEATURE_RAIL_GUIDE, FEATURE_OFFSET])
return False
FreeCADGui.addCommand('Rocket_Calculators', _CalculatorGroupCommand())
FreeCADGui.addCommand('Rocket_BodyTubes', _TubeGroupCommand())
FreeCADGui.addCommand('Rocket_LaunchGuides', _GuidesGroupCommand())