Skip to content

Commit

Permalink
#6 OpenRocket import
Browse files Browse the repository at this point in the history
  • Loading branch information
davesrocketshop committed Dec 24, 2022
1 parent e10ecef commit bbb4d4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Ui/Commands/CmdBodyTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def makeBodyTube(name='BodyTube'):
ViewProviderBodyTube(obj.ViewObject)

addToStage(obj)
FreeCADGui.Selection.clearSelection()
FreeCADGui.Selection.addSelection(obj)
return obj

class CmdBodyTube(Command):
Expand Down
5 changes: 0 additions & 5 deletions Ui/Commands/CmdRocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ def makeRocket(name='Rocket', makeSustainer=True):

if makeSustainer:
sustainer = makeStage()
# sustainer.Label = 'Sustainer'
# obj.Proxy.addChild(sustainer)
# FreeCADGui.ActiveDocument.ActiveView.setActiveObject('stage', sustainer)
# FreeCADGui.Selection.clearSelection()
# FreeCADGui.Selection.addSelection(sustainer)
else:
FreeCADGui.Selection.clearSelection()
FreeCADGui.Selection.addSelection(obj)
Expand Down
28 changes: 13 additions & 15 deletions Ui/Commands/Command.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ class Command:
def part_feature_selected(self):
if FreeCADGui.ActiveDocument is None:
return False
# sel = FreeCADGui.Selection.getSelection()
# if len(sel) == 1 and (sel[0].isDerivedFrom("Part::Feature") or sel[0].isDerivedFrom("App::GeometryFeature")):
# return True
# else:
# return False
return True
sel = FreeCADGui.Selection.getSelection()
if len(sel) == 1 and (sel[0].isDerivedFrom("Part::Feature") or sel[0].isDerivedFrom("App::GeometryFeature")):
return True
else:
return False

def part_fin_selected(self):
if FreeCADGui.ActiveDocument is not None:
Expand All @@ -48,15 +47,14 @@ def part_fin_selected(self):

def part_eligible_feature(self, feature):
if FreeCADGui.ActiveDocument is not None:
# sel = FreeCADGui.Selection.getSelection()
# if len(sel) == 1 and (sel[0].isDerivedFrom("Part::FeaturePython") or sel[0].isDerivedFrom("App::GeometryFeature")):
# if isinstance(feature, list):
# for f in feature:
# if sel[0].Proxy.eligibleChild(f):
# return True
# elif sel[0].Proxy.eligibleChild(feature):
# return True
return True
sel = FreeCADGui.Selection.getSelection()
if len(sel) == 1 and (sel[0].isDerivedFrom("Part::FeaturePython") or sel[0].isDerivedFrom("App::GeometryPython")):
if isinstance(feature, list):
for f in feature:
if sel[0].Proxy.eligibleChild(f):
return True
elif sel[0].Proxy.eligibleChild(feature):
return True
return False

def no_rocket_builder(self):
Expand Down

0 comments on commit bbb4d4a

Please sign in to comment.