Story: How to deal with point transfer between local and global coordinate system - HiStructClient/femcad-doc GitHub Wiki
In various situations during scripting one has to deal with coordinate systems. The basic one - global coordinate system is simply defined as
Origin={0 0 0}, Axes={X={1,0,0}, Y={0,1,0}, Z={0,0,1}}
Any other coordinate system can be defined using arbitrary origin point and three vectors (see details)
Now, if you want to transform point from global coordinates into local system (or the other way round), the following syntax can be used:
Lcs.PointToLcs(point)
Lcs.PointToGcs(point)
This function tells you what are the coordinates of point in Local coordinate system. For example, having the following point and lcs: p1 := Fcs.Geometry.Point3D(1,1,0) Lcs1 := Fcs.Geometry.Lcs(Fcs.Geometry.Point3D(2,-2,0),Fcs.Geometry.Matrix33(GCS.Axes.X, GCS.Axes.Y, GCS.Axes.Z))
gives
Lcs1.PointToLcs(p1) = (-1,3,0)
Lcs1.PointToGcs(p1) = (3,-1,0)
The above was proofed using points, but there are useful functions (in FcsFunctions.fcs) how to convert coordinates to point, point to coordinates, coordinates to vertex etc.
pointToCoors := p => [ p.X, p.Y, p.Z ]
coorsToPoint := c => Fcs.Geometry.Point3D( c[0], c[1], c[2] )
coorsToVertex := c => Fcs.Geometry.Vertex3D( coorsToPoint( c ))