diff --git a/Rocket/Exceptions.py b/Rocket/Exceptions.py index 64df6bc..39b3add 100644 --- a/Rocket/Exceptions.py +++ b/Rocket/Exceptions.py @@ -29,3 +29,9 @@ class UnsupportedVersion(Exception): def __init__(self, message="Unknown manufacturer"): self._message = message + +class UnsupportedConfiguration(Exception): + + def __init__(self, message="Unsupported configuration"): + self._message = message + diff --git a/Rocket/FeatureTransition.py b/Rocket/FeatureTransition.py index 8b1fed7..e86adad 100644 --- a/Rocket/FeatureTransition.py +++ b/Rocket/FeatureTransition.py @@ -35,6 +35,7 @@ from Rocket.Constants import TYPE_CONE, TYPE_ELLIPTICAL, TYPE_HAACK, TYPE_OGIVE, TYPE_VON_KARMAN, TYPE_PARABOLA, TYPE_PARABOLIC, TYPE_POWER from Rocket.Constants import STYLE_CAPPED, STYLE_HOLLOW, STYLE_SOLID, STYLE_SOLID_CORE from Rocket.Constants import STYLE_CAP_SOLID, STYLE_CAP_BAR, STYLE_CAP_CROSS +from Rocket.Constants import FEATURE_INNER_TUBE from Rocket.events.ComponentChangeEvent import ComponentChangeEvent @@ -404,3 +405,8 @@ def execute(self, obj): self._setShapeHandler() if self._shapeHandler is not None: self._shapeHandler.draw() + + def eligibleChild(self, childType): + return childType in [ + #FEATURE_BODY_TUBE, + FEATURE_INNER_TUBE] diff --git a/Rocket/Importer/Rocksim/ComponentElement.py b/Rocket/Importer/Rocksim/ComponentElement.py index ac03d8b..c0be3d0 100644 --- a/Rocket/Importer/Rocksim/ComponentElement.py +++ b/Rocket/Importer/Rocksim/ComponentElement.py @@ -36,7 +36,7 @@ from Rocket.Importer.OpenRocket.SaxElement import Element from Rocket.Constants import LOCATION_PARENT_TOP, LOCATION_PARENT_BOTTOM, LOCATION_BASE from Rocket.Constants import MATERIAL_TYPE_BULK, MATERIAL_TYPE_SURFACE, MATERIAL_TYPE_LINE -from Rocket.position.AxialMethod import AXIAL_METHOD_MAP +from Rocket.position.AxialMethod import AXIAL_METHOD_MAP, BOTTOM from Rocket.Utilities import _err @@ -85,6 +85,8 @@ def handleEndTag(self, tag, content): self.onAxialOffset(float(content)) elif _tag == "locationmode": self.onLocationMode(content) + elif _tag == "radialangle": + self.onAngleOffset(content) elif _tag == "abientcolor": self._appearance.AmbientColor = self.parseColor(content) elif _tag == "diffusecolor": @@ -145,6 +147,10 @@ def onAxialOffset(self, content): if hasattr(self._feature._obj, "AxialOffset"): self._feature._obj.AxialOffset = content + def onAngleOffset(self, content): + if self._feature is not None and hasattr(self._feature._obj, "AngleOffset"): + self._feature._obj.AngleOffset = FreeCAD.Units.Quantity(content + " rad").Value + def onLocationMode(self, content): mode = int(content) if mode == 0: @@ -208,6 +214,12 @@ def parseColor(self, value): def end(self): self.setMaterial(self._feature, self._material, self._densityType) + if self._feature._obj.AxialMethod == BOTTOM: + if hasattr(self._feature._obj, "Location"): + self._feature._obj.Location = -self._feature._obj.Location + if hasattr(self._feature._obj, "AxialOffset"): + self._feature._obj.AxialOffset = -self._feature._obj.AxialOffset + if hasattr(self._feature._obj.ViewObject, "ShapeAppearance"): self._feature._obj.ViewObject.ShapeAppearance = self._appearance diff --git a/Rocket/Importer/Rocksim/NoseElement.py b/Rocket/Importer/Rocksim/NoseElement.py index b5e5ff5..920fa49 100644 --- a/Rocket/Importer/Rocksim/NoseElement.py +++ b/Rocket/Importer/Rocksim/NoseElement.py @@ -82,8 +82,7 @@ def handleEndTag(self, tag, content): elif _tag == "shoulderlen": length = float(content) self._feature._obj.ShoulderLength = length - if length > 0: - self._feature._obj.Shoulder = True + self._feature._obj.Shoulder = (length > 0) elif _tag == "constructiontype": constructionType = int(content) if constructionType == 0: diff --git a/Rocket/Importer/Rocksim/Rocksim.py b/Rocket/Importer/Rocksim/Rocksim.py index bb6818d..21d6218 100644 --- a/Rocket/Importer/Rocksim/Rocksim.py +++ b/Rocket/Importer/Rocksim/Rocksim.py @@ -118,7 +118,8 @@ def __init__(self, parent, tag, attributes, parentObj, filename, line): "showgridtypebase", "gridspacing", "gridopacity", "gridcolor", "maxdiawithfins", "maxdiawithoutfins", "maxlenwithfins", "maxlenwithoutfins", "minxextent", "maxxextent", "calculatedmaxstagedia", "calculatedstagelen", "sideviewdims", "baseviewdims", "vertviewdims", "name", "stage3parts", - "stage2parts", "stage1parts"] + "stage2parts", "stage1parts", "camerastate", "spritepath", "spriteprefix", "comments", "designer", + "revisions"] self._feature = makeRocket(makeSustainer=False) self._stageCount = 1 @@ -127,6 +128,8 @@ def handleEndTag(self, tag, content): _tag = tag.lower().strip() if _tag == "designer": FreeCAD.ActiveDocument.CreatedBy = content + elif _tag == "comment": + self.onComment(content) elif _tag == "revision": pass elif _tag == "stagecount": diff --git a/Rocket/RocketComponentShapeless.py b/Rocket/RocketComponentShapeless.py index 6087e26..2effdec 100644 --- a/Rocket/RocketComponentShapeless.py +++ b/Rocket/RocketComponentShapeless.py @@ -39,6 +39,8 @@ from Rocket.Constants import FEATURE_ROCKET, FEATURE_STAGE from Rocket.Constants import LOCATION_SURFACE, LOCATION_CENTER +from Rocket.Exceptions import UnsupportedConfiguration + from DraftTools import translate class EditedShape(QObject): @@ -672,7 +674,7 @@ def addChildPosition(self, component, index): .format(component.Proxy.getName(), self.getName())) if not self.eligibleChild(component.Proxy.Type): - raise Exception(translate("Rocket", "Component: {} not currently compatible with component: {}") + raise UnsupportedConfiguration(translate("Rocket", "Unsupported configuration: {} not currently compatible with component: {}") .format(component.Proxy.getName(), self.getName())) self._setChild(index, component) diff --git a/package.xml b/package.xml index d13104a..976bdb9 100644 --- a/package.xml +++ b/package.xml @@ -2,8 +2,8 @@ Rocket A workbench for designing model rockets. - 4.1.0 - 2025-01-17 + 4.1.1 + 2025-01-18 David Carter LGPL-2.1-or-later https://github.com/davesrocketshop/Rocket