Exemplo n.º 1
0
def createTransformation(
    parent, refType="absGlobal", tx=0.0, ty=0.0, tz=0.0, sx=1.0, sy=1.0, sz=1.0, rx=0.0, ry=0.0, rz=0.0
):  # allgemein
    """
    This Method is used for creation in Transformation Element build up from pointTypes for Translation, Scaling and Rotation
    Note that in CPACS 1.0 Translation should be of Type pointAbsRelType Due to TIGL issues this feature is still unabled inside the cpacslib.py
    @author: Jonas Jepsen
    @param parent: should be any Type holding a TransformationType
    @param tx, ty, tz, sx, sy, sz, rx, ry, rz:Translation, Scaling and Rotation   
    """
    # Convert to CPACS Types

    myTranslation = pointAbsRelType(
        refType=refType,
        x=doubleBaseType(valueOf_=str(tx)),
        y=doubleBaseType(valueOf_=str(ty)),
        z=doubleBaseType(valueOf_=str(tz)),
    )
    myScaling = pointType(
        x=doubleBaseType(valueOf_=str(sx)), y=doubleBaseType(valueOf_=str(sy)), z=doubleBaseType(valueOf_=str(sz))
    )
    myRotation = pointType(
        x=doubleBaseType(valueOf_=str(rx)), y=doubleBaseType(valueOf_=str(ry)), z=doubleBaseType(valueOf_=str(rz))
    )

    # Create Element
    myTransformation = transformationType(scaling=myScaling, rotation=myRotation, translation=myTranslation)

    # Append to Parent
    parent.set_transformation(myTransformation)
Exemplo n.º 2
0
    def cpacsExport(self, CPACSObj):
        '''
        Export routine for the engine
        '''
        cpacsPath = '/cpacs/vehicles/aircraft/model/engines/engine'
        myEngine = getObjfromXpath(CPACSObj, cpacsPath)
        myEngine.set_uID('engine')
        myEngine.set_symmetry('x-z-plane')
        myEngine.set_parentUID(stringUIDBaseType(valueOf_="enginePylon"))

        x = doubleBaseType(valueOf_=str(self.xEngine.getValue()))
        y = doubleBaseType(valueOf_=str(self.yEngine.getValue()))
        z = doubleBaseType(valueOf_=str(self.zEngine.getValue()))
        myTranslation = pointAbsRelType(refType="absGlobal", x=x, y=y, z=z)
        myTransformation = transformationType(translation=myTranslation)
        myEngine.set_transformation(myTransformation)

        # Mass Export Engine Pylon
        mass = doubleBaseType(valueOf_=str(self.mEngine.getValue()))
        massIX = doubleBaseType(valueOf_=str(self.massIX.getValue()))
        massIY = doubleBaseType(valueOf_=str(self.massIY.getValue()))
        massIZ = doubleBaseType(valueOf_=str(self.massIZ.getValue()))
        massInertia = massInertiaType(Jxx=massIX, Jyy=massIY, Jzz=massIZ)

        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mPowerUnits'
        mEngines = getObjfromXpath(CPACSObj, cpacsPath)
        massDescription = genericMassType(uID='engine_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="engine"),
                                          massInertia=massInertia)
        mEngines.set_massDescription(massDescription)

        #call overall export method
        super(engine, self).cpacsExport(CPACSObj)
Exemplo n.º 3
0
def createTransformation(parent,
                         refType='absGlobal',
                         tx=0.,
                         ty=0.,
                         tz=0.,
                         sx=1.,
                         sy=1.,
                         sz=1.,
                         rx=0.,
                         ry=0.,
                         rz=0.):  # allgemein
    '''
    This Method is used for creation in Transformation Element build up from pointTypes for Translation, Scaling and Rotation
    Note that in CPACS 1.0 Translation should be of Type pointAbsRelType Due to TIGL issues this feature is still unabled inside the cpacslib.py
    @author: Jonas Jepsen
    @param parent: should be any Type holding a TransformationType
    @param tx, ty, tz, sx, sy, sz, rx, ry, rz:Translation, Scaling and Rotation   
    '''
    # Convert to CPACS Types

    myTranslation = pointAbsRelType(refType=refType,
                                    x=doubleBaseType(valueOf_=str(tx)),
                                    y=doubleBaseType(valueOf_=str(ty)),
                                    z=doubleBaseType(valueOf_=str(tz)))
    myScaling = pointType(x=doubleBaseType(valueOf_=str(sx)),
                          y=doubleBaseType(valueOf_=str(sy)),
                          z=doubleBaseType(valueOf_=str(sz)))
    myRotation = pointType(x=doubleBaseType(valueOf_=str(rx)),
                           y=doubleBaseType(valueOf_=str(ry)),
                           z=doubleBaseType(valueOf_=str(rz)))

    #Create Element
    myTransformation = transformationType(scaling=myScaling,
                                          rotation=myRotation,
                                          translation=myTranslation)

    #Append to Parent
    parent.set_transformation(myTransformation)