コード例 #1
0
ファイル: export.py プロジェクト: techtronics/VAMPzero
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)
コード例 #2
0
ファイル: export.py プロジェクト: techtronics/VAMPzero
def createPoint(parent, x, y, z=None):
    """
    Methods builds a Point from PointType and adds it to parent
    @author: Jonas Jepsen
    @param parent: parent element (i.e. pointListType)
    @param x: X-Coordinate
    @param y: Y-Coordinate  
    @param z: Z-Coordinate, default is NONE
    """
    xP = doubleBaseType(valueOf_=str(x))
    yP = doubleBaseType(valueOf_=str(0.0))
    zP = doubleBaseType(valueOf_=str(y))
    if z is None:
        myPoint = pointType(x=xP, y=yP)
    else:
        zP = doubleBaseType(valueOf_=str(z))
        myPoint = pointType(x=xP, y=yP, z=zP)
    parent.add_point(myPoint)
コード例 #3
0
ファイル: export.py プロジェクト: p-chambers/VAMPzero
def createPoint(parent, x, y, z=None):
    '''
    Methods builds a Point from PointType and adds it to parent
    @author: Jonas Jepsen
    @param parent: parent element (i.e. pointListType)
    @param x: X-Coordinate
    @param y: Y-Coordinate  
    @param z: Z-Coordinate, default is NONE
    '''
    xP = doubleBaseType(None, None, None, str(x))
    yP = doubleBaseType(None, None, None, str(0.0))
    zP = doubleBaseType(None, None, None, str(y))
    if z is None:
        myPoint = pointType(None, None, None, None, xP, yP, None)
    else:
        zP = doubleBaseType(None, None, None, str(z))
        myPoint = pointType(None, None, None, None, xP, yP, zP)
    parent.add_point(myPoint)
コード例 #4
0
ファイル: path.py プロジェクト: p-chambers/VAMPzero
def createStep(deflection, x1, y1, z1, x2, z2, rotation):
    relDeflection = doubleBaseType(valueOf_=str(deflection))
    innerHingeTranslation = pointType(x=doubleBaseType(valueOf_=str(x1)),
                                      y=doubleBaseType(valueOf_=str(y1)),
                                      z=doubleBaseType(valueOf_=str(z1)))
    outerHingeTranslation = pointXZType(x=doubleBaseType(valueOf_=str(x2)),
                                        z=doubleBaseType(valueOf_=str(z2)))
    hingeLineRotation = doubleBaseType(valueOf_=str(rotation))

    return controlSurfaceStepType(relDeflection=relDeflection,
                                  innerHingeTranslation=innerHingeTranslation,
                                  outerHingeTranslation=outerHingeTranslation,
                                  hingeLineRotation=hingeLineRotation)
コード例 #5
0
ファイル: export.py プロジェクト: techtronics/VAMPzero
def createPointList(pointList):
    # new Point List object
    myPointList = pointListType()

    for [xvalue, yvalue] in pointList:
        # Convert Types and Create Point
        x = doubleBaseType(valueOf_=str(xvalue))
        y = doubleBaseType(valueOf_=str(yvalue))
        z = doubleBaseType(valueOf_=str(0.0))
        myPoint = pointType(x=x, y=y, z=z)
        # Add Point to PointList
        myPointList.add_point(myPoint)
    return myPointList
コード例 #6
0
ファイル: export.py プロジェクト: p-chambers/VAMPzero
def createPointList(pointList):
    #new Point List object
    myPointList = pointListType(None, None, None, None)

    for [xvalue, yvalue] in pointList:
        #Convert Types and Create Point
        x = doubleBaseType(None, None, None, str(xvalue))
        y = doubleBaseType(None, None, None, str(yvalue))
        z = doubleBaseType(None, None, None, str(0.0))
        myPoint = pointType(None, None, None, None, x, y, z)
        #Add Point to PointList
        myPointList.add_point(myPoint)
    return myPointList
コード例 #7
0
ファイル: export.py プロジェクト: p-chambers/VAMPzero
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)
コード例 #8
0
ファイル: posCoGMAX.py プロジェクト: techtronics/VAMPzero
        def createPointList(nparray):
            '''
            create a point list for each cog location

            This method is currently without use, as long as there is no update to CPACS 2.2.1
            '''
            myPointList = pointListType()
            zero = doubleBaseType(valueOf_='0.')

            for item in nparray.tolist():
                newPoint = pointType(x=doubleBaseType(valueOf_=str(item)),y=zero, z=zero)
                myPointList.add_point(newPoint)

            return myPointList
コード例 #9
0
ファイル: path.py プロジェクト: codingpoets/VAMPzero
def createStep(deflection, x1, y1, z1, x2, z2, rotation):
    relDeflection = doubleBaseType(valueOf_=str(deflection))
    innerHingeTranslation = pointType(
        x=doubleBaseType(valueOf_=str(x1)), y=doubleBaseType(valueOf_=str(y1)), z=doubleBaseType(valueOf_=str(z1))
    )
    outerHingeTranslation = pointXZType(x=doubleBaseType(valueOf_=str(x2)), z=doubleBaseType(valueOf_=str(z2)))
    hingeLineRotation = doubleBaseType(valueOf_=str(rotation))

    return controlSurfaceStepType(
        relDeflection=relDeflection,
        innerHingeTranslation=innerHingeTranslation,
        outerHingeTranslation=outerHingeTranslation,
        hingeLineRotation=hingeLineRotation,
    )
コード例 #10
0
ファイル: posCoGMAX.py プロジェクト: techtronics/VAMPzero
        def createVectorPointList(nparray):
            '''
            create a point list for each cog location
            '''
            myPointList = pointListType()

            x = '; '.join(str(x) for x in nparray.tolist())

            zeros = np.zeros(nparray.shape)
            y = '; '.join(str(y) for y in zeros.tolist())

            newPoint = pointType(x=doubleBaseType(valueOf_=str(x)),y=doubleBaseType(valueOf_=y), z=doubleBaseType(valueOf_=y))
            myPointList.add_point(newPoint)

            return myPointList