예제 #1
0
    def __init__(self, parent, tag, attributes, connection, filename, line):
        super().__init__(parent, tag, attributes, connection, filename, line)

        self._knownTags = self._knownTags + [
            "filled", "shape", "foreoutsidediameter", "foreshoulderdiameter",
            "foreshoulderlength", "aftoutsidediameter", "aftshoulderdiameter",
            "aftshoulderlength", "length", "thickness"
        ]

        # Map import shape names to internal names. There may be multiple entries for the same type
        self._shapeMap = {
            "conical": TYPE_CONE.lower(),
            "ellipsoid": TYPE_ELLIPTICAL.lower(),
            "ogive": TYPE_OGIVE.lower(),
            "parabolic": TYPE_PARABOLA.lower(),
            "haack": TYPE_HAACK.lower(),
            "power": TYPE_POWER.lower()
        }

        self._noseType = ""  # Shape
        self._filled = False

        self._outsideDiameter = (0.0, "")
        self._shoulderDiameter = (0.0, "")
        self._shoulderLength = (0.0, "")
        self._length = (0.0, "")
        self._thickness = (0.0, "")
예제 #2
0
    def validate(self):
        super().validate()

        if self._noseType not in [
                TYPE_CONE.lower(),
                TYPE_ELLIPTICAL.lower(),
                TYPE_HAACK.lower(),
                TYPE_OGIVE.lower(),
                TYPE_VON_KARMAN.lower(),
                TYPE_PARABOLA.lower(),
                TYPE_PARABOLIC.lower(),
                TYPE_POWER.lower()
        ]:
            _err("NoseCone: Shape is invalid '%s'" % self._noseType)
            return False

        self.validatePositive(self._outsideDiameter[0],
                              "Outside Diameter invalid")
        self.validateNonNegative(self._shoulderDiameter[0],
                                 "Shoulder Diameter invalid")
        self.validateNonNegative(self._shoulderLength[0],
                                 "Shoulder Length invalid")
        self.validatePositive(self._length[0], "Length invalid")
        if not self._filled:
            self.validatePositive(self._thickness[0], "Thickness invalid")

        self.validateNonEmptyString(
            self._outsideDiameter[1],
            "Outside Diameter Units invalid '%s" % self._outsideDiameter[1])
        self.validateNonEmptyString(
            self._shoulderDiameter[1],
            "Shoulder Diameter Units invalid '%s" % self._shoulderDiameter[1])
        self.validateNonEmptyString(
            self._shoulderLength[1],
            "Shoulder Length Units invalid '%s" % self._shoulderLength[1])
        self.validateNonEmptyString(
            self._length[1], "Length Units invalid '%s" % self._length[1])
        if not self._filled:
            self.validateNonEmptyString(
                self._thickness[1],
                "Thickness Units invalid '%s" % self._thickness[1])
예제 #3
0
    def validate(self):
        super().validate()

        if self._noseType not in [
                TYPE_CONE.lower(),
                TYPE_ELLIPTICAL.lower(),
                TYPE_HAACK.lower(),
                TYPE_OGIVE.lower(),
                TYPE_VON_KARMAN.lower(),
                TYPE_PARABOLA.lower(),
                TYPE_PARABOLIC.lower(),
                TYPE_POWER.lower()
        ]:
            self.raiseInvalid("Shape is invalid '%s'" % self._noseType)

        self.validateNonNegative(self._foreOutsideDiameter[0],
                                 "Fore Outside Diameter invalid")
        self.validateNonNegative(self._foreShoulderDiameter[0],
                                 "Fore Shoulder Diameter invalid")
        self.validateNonNegative(self._foreShoulderLength[0],
                                 "Fore Shoulder Length invalid")
        self.validateNonNegative(self._aftOutsideDiameter[0],
                                 "Aft Outside Diameter invalid")
        self.validateNonNegative(self._aftShoulderDiameter[0],
                                 "Aft Shoulder Diameter invalid")
        self.validateNonNegative(self._aftShoulderLength[0],
                                 "Aft Shoulder Length invalid")
        self.validatePositive(self._length[0], "Length invalid")

        if self._thickness[0] == 0.0:
            self._filled = True
        elif not self._filled:
            self.validatePositive(self._thickness[0], "Thickness invalid")

        self.validateNonEmptyString(
            self._foreOutsideDiameter[1],
            "Fore Outside Diameter Units invalid '%s" %
            self._foreOutsideDiameter[1])
        self.validateNonEmptyString(
            self._foreShoulderDiameter[1],
            "Fore Shoulder Diameter Units invalid '%s" %
            self._foreShoulderDiameter[1])
        self.validateNonEmptyString(
            self._foreShoulderLength[1],
            "Fore Shoulder Length Units invalid '%s" %
            self._foreShoulderLength[1])
        self.validateNonEmptyString(
            self._aftOutsideDiameter[1],
            "Aft Outside Diameter Units invalid '%s" %
            self._aftOutsideDiameter[1])
        self.validateNonEmptyString(
            self._aftShoulderDiameter[1],
            "Aft Shoulder Diameter Units invalid '%s" %
            self._aftShoulderDiameter[1])
        self.validateNonEmptyString(
            self._aftShoulderLength[1],
            "Aft Shoulder Length Units invalid '%s" %
            self._aftShoulderLength[1])
        self.validateNonEmptyString(
            self._length[1], "Length Units invalid '%s" % self._length[1])
        if not self._filled:
            self.validateNonEmptyString(
                self._thickness[1],
                "Thickness Units invalid '%s" % self._thickness[1])