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

Options
Member, Employee Posts: 201
edited June 2023

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

Tagged:

• Member, Employee Posts: 201
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
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
```