-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0e5283
commit 4a70548
Showing
11 changed files
with
905 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# *************************************************************************** | ||
# * Copyright (c) 2021-2023 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 * | ||
# * * | ||
# *************************************************************************** | ||
"""Provides support for importing RASAero files.""" | ||
|
||
__title__ = "FreeCAD RASAero Importer" | ||
__author__ = "David Carter" | ||
__url__ = "https://www.davesrocketshop.com" | ||
|
||
import FreeCAD | ||
|
||
from App.Importer.OpenRocket.SaxElement import Element | ||
|
||
from App.Constants import TYPE_CONE | ||
|
||
from Ui.Commands.CmdTransition import makeTransition | ||
|
||
class BoatTailElement(Element): | ||
|
||
def __init__(self, parent, tag, attributes, parentObj, filename, line): | ||
super().__init__(parent, tag, attributes, parentObj, filename, line) | ||
|
||
self._shoulderCapped = False | ||
|
||
# self._validChildren.update({ 'subcomponents' : OpenRocket.SubElement.SubElement, | ||
# }) | ||
self._knownTags.extend(["parttype", "length", "diameter", | ||
"reardiameter", "location", "color"]) | ||
# <BoatTail> | ||
# <PartType>BoatTail</PartType> | ||
# <Length>5.5</Length> | ||
# <Diameter>3.08</Diameter> | ||
# <RearDiameter>3.07</RearDiameter> | ||
# <Location>63</Location> | ||
# <Color>Black</Color> | ||
# </BoatTail> | ||
|
||
def makeObject(self): | ||
self._feature = makeTransition() | ||
if self._parentObj is not None: | ||
self._parentObj.addChild(self._feature) | ||
|
||
def handleEndTag(self, tag, content): | ||
_tag = tag.lower().strip() | ||
if _tag == "diameter": | ||
self._feature._obj.ForeDiameter = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "reardiameter": | ||
self._feature._obj.AftDiameter = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "length": | ||
self._feature._obj.Length = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "color": | ||
pass # Not yet implemented | ||
else: | ||
super().handleEndTag(tag, content) | ||
|
||
def end(self): | ||
self._feature._obj.TransitionType = TYPE_CONE | ||
self._feature._obj.ForeShoulder = False | ||
self._feature._obj.AftShoulder = False | ||
|
||
return super().end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# *************************************************************************** | ||
# * Copyright (c) 2021-2023 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 * | ||
# * * | ||
# *************************************************************************** | ||
"""Provides support for importing RASAero files.""" | ||
|
||
__title__ = "FreeCAD RASAero Importer" | ||
__author__ = "David Carter" | ||
__url__ = "https://www.davesrocketshop.com" | ||
|
||
import FreeCAD | ||
|
||
from App.Importer.OpenRocket.SaxElement import NullElement, Element | ||
from App.Importer.RASAero.FinElement import FinElement | ||
|
||
from App.Constants import TYPE_CONE | ||
|
||
from Ui.Commands.CmdBodyTube import makeBodyTube | ||
from Ui.Commands.CmdTransition import makeTransition | ||
|
||
class BodyTubeElement(Element): | ||
|
||
def __init__(self, parent, tag, attributes, parentObj, filename, line): | ||
super().__init__(parent, tag, attributes, parentObj, filename, line) | ||
|
||
self._validChildren.update({ 'fin' : FinElement, | ||
# 'motormount' : MotorMountElement, | ||
}) | ||
self._knownTags.extend(["parttype", "length", "diameter", "launchlugdiameter", "launchluglength", | ||
"railguidediameter", "railguideheight", "launchshoearea", "location", "color", | ||
"boattaillength", "boattailreardiameter", "boattailoffset", "overhang"]) | ||
|
||
self._boatTailLength = 0.0 | ||
self._boatTailRearDiameter = 0.0 | ||
|
||
# <PartType>BodyTube</PartType> | ||
# <Length>48</Length> | ||
# <Diameter>3.08</Diameter> | ||
# <LaunchLugDiameter>0</LaunchLugDiameter> | ||
# <LaunchLugLength>0</LaunchLugLength> | ||
# <RailGuideDiameter>0</RailGuideDiameter> | ||
# <RailGuideHeight>0</RailGuideHeight> | ||
# <LaunchShoeArea>0</LaunchShoeArea> | ||
# <Location>15</Location> | ||
# <Color>Black</Color> | ||
# <BoattailLength>5.5</BoattailLength> | ||
# <BoattailRearDiameter>3.07</BoattailRearDiameter> | ||
# <BoattailOffset>0</BoattailOffset> | ||
# <Overhang>0</Overhang> | ||
|
||
def makeObject(self): | ||
self._feature = makeBodyTube() | ||
if self._parentObj is not None: | ||
self._parentObj.addChild(self._feature) | ||
|
||
def handleEndTag(self, tag, content): | ||
_tag = tag.lower().strip() | ||
if _tag == "diameter": | ||
self._feature._obj.Diameter = FreeCAD.Units.Quantity(content + " in").Value | ||
self._feature._obj.AutoDiameter = False | ||
elif _tag == "length": | ||
self._feature._obj.Length = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "color": | ||
pass # Not yet implemented | ||
elif _tag == "boattaillength": | ||
self._boatTailLength = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "boattailreardiameter": | ||
self._boatTailRearDiameter = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "boattailoffset": | ||
pass # Not yet implemented | ||
elif _tag == "overhang": | ||
pass # Not yet implemented | ||
else: | ||
super().handleEndTag(tag, content) | ||
|
||
def end(self): | ||
|
||
return super().end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# *************************************************************************** | ||
# * Copyright (c) 2021-2023 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 * | ||
# * * | ||
# *************************************************************************** | ||
"""Provides support for importing RASAero files.""" | ||
|
||
__title__ = "FreeCAD RASAero Importer" | ||
__author__ = "David Carter" | ||
__url__ = "https://www.davesrocketshop.com" | ||
|
||
import FreeCAD | ||
|
||
from App.Importer.OpenRocket.SaxElement import NullElement, Element | ||
from App.Importer.RASAero.BodyTubeElement import BodyTubeElement | ||
|
||
from App.Constants import TYPE_CONE | ||
|
||
from Ui.Commands.CmdBodyTube import makeBodyTube | ||
from Ui.Commands.CmdTransition import makeTransition | ||
from Ui.Commands.CmdStage import makeStage, addToStage | ||
|
||
class BoosterElement(BodyTubeElement): | ||
|
||
def __init__(self, parent, tag, attributes, parentObj, filename, line): | ||
super().__init__(parent, tag, attributes, parentObj, filename, line) | ||
|
||
self._knownTags.extend(["insidediameter", "shoulderlength", "nozzleexitdiameter"]) | ||
|
||
self._transitionFore = 0.0 | ||
self._transitionLength = 0.0 | ||
|
||
# <PartType>Booster</PartType> | ||
# <Length>62</Length> | ||
# <Diameter>4.05</Diameter> | ||
# <InsideDiameter>3.08</InsideDiameter> | ||
# <LaunchLugDiameter>0</LaunchLugDiameter> | ||
# <LaunchLugLength>0</LaunchLugLength> | ||
# <RailGuideDiameter>0</RailGuideDiameter> | ||
# <RailGuideHeight>0</RailGuideHeight> | ||
# <LaunchShoeArea>0.0331</LaunchShoeArea> | ||
# <Location>63</Location> | ||
# <ShoulderLength>1.75</ShoulderLength> | ||
# <Color>Black</Color> | ||
# <NozzleExitDiameter>0</NozzleExitDiameter> | ||
# <BoattailLength>0</BoattailLength> | ||
# <BoattailRearDiameter>0</BoattailRearDiameter> | ||
|
||
def makeObject(self): | ||
stage = makeStage() | ||
self._feature = makeBodyTube() | ||
if stage is not None: | ||
addToStage(stage) | ||
self._parentObj = stage | ||
# stage.addChild(self._feature) | ||
|
||
def handleEndTag(self, tag, content): | ||
_tag = tag.lower().strip() | ||
if _tag == "insidediameter": | ||
self._transitionFore = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "shoulderlength": | ||
self._transitionLength = FreeCAD.Units.Quantity(content + " in").Value | ||
elif _tag == "nozzleexitdiameter": | ||
pass # Not yet implemented | ||
else: | ||
super().handleEndTag(tag, content) | ||
|
||
def end(self): | ||
if self._transitionLength > 0: | ||
# Add a boat tail | ||
transition = makeTransition() | ||
transition._obj.TransitionType = TYPE_CONE | ||
transition._obj.ForeShoulder = False | ||
transition._obj.AftShoulder = False | ||
transition._obj.ForeDiameter = self._transitionFore | ||
transition._obj.AftDiameter = self._feature._obj.Diameter | ||
transition._obj.Length = self._transitionLength | ||
|
||
self._parentObj.addChild(transition) | ||
|
||
if self._parentObj is not None: | ||
self._parentObj.addChild(self._feature) | ||
|
||
if self._boatTailLength > 0: | ||
# Add a boat tail | ||
boattail = makeTransition() | ||
boattail._obj.TransitionType = TYPE_CONE | ||
boattail._obj.ForeShoulder = False | ||
boattail._obj.AftShoulder = False | ||
boattail._obj.ForeDiameter = self._feature._obj.Diameter | ||
boattail._obj.AftDiameter = self._boatTailRearDiameter | ||
boattail._obj.Length = self._boatTailLength | ||
|
||
self._parentObj.addChild(boattail) | ||
|
||
return super().end() |
Oops, something went wrong.