Is it possible to pass/transform an ACT result to a local coordinate system?

Options
Chemsdine CHEMAI
Chemsdine CHEMAI Member, Employee Posts: 201
First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
edited June 2023 in Structures

Is it possible to pass/transform an ACT result to a local coordinate system?

Tagged:

Best Answer

  • Chemsdine CHEMAI
    Chemsdine CHEMAI Member, Employee Posts: 201
    First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
    Answer ✓
    Options

    Yes, one can use the commands Vector3D() et Matrix4D(), here is an example from the solution 2042686 (from the customer portal) :

    def EvalResult(result, stepInfo, collector):
        step = stepInfo.Set
        nodeIds = collector.Ids
    
        analysis = result.Analysis
        reader = analysis.GetResultsData()
        reader.CurrentResultSet = step
        deformation = reader.GetResult("U")
        fromUnit = deformation.GetComponentInfo("X").Unit           # Unit of Length when the solution was solved
        toUnit = "m"                                                # Always generate the result to display in SI unit
        convFact = units.ConvertUnit(1, fromUnit, toUnit, "Length") # conversion factor
    
        # get selected coordinate system info
        csM = result.Properties["CoordinateSystem"].Value
        csXAxis = csM.XAxis
        csYAxis = csM.YAxis
        csZAxis = csM.ZAxis
    
        xAxis = Vector3D(csXAxis[0], csXAxis[1], csXAxis[2])
        yAxis = Vector3D(csYAxis[0], csYAxis[1], csYAxis[2])
        zAxis = Vector3D(csZAxis[0], csZAxis[1], csZAxis[2])
    
        # create matrix transformation
        idM  =  Matrix4D()
        transM = idM.CreateSystem(xAxis,yAxis,zAxis)
        transM.Transpose()    
    
        for nId in nodeIds:
            defArr = deformation.GetNodeValues(nId)
            vect = Vector3D(defArr[0], defArr[1], defArr[2])
    
            # convert vector using transform matrix
            vectTrans = transM.Transform(vect)
            
            collector.SetValues(nId, [vectTrans[0]*convFact]) 
    
        return
    

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 139
    First Answer First Anniversary Name Dropper Solution Developer Community of Practice Member
    Options

    Hi @Chemsdine CHEMAI, this seems to work only when the target coordinate system has the same origin as the global csys. Is it possible to expand this when the origins are different?