I have searching this for a week could not find a solution yet. May be you would help me.
I’m trying to create a xpresso setup.
First of all I should use COFFEE node in order to make it work in my case.
Is it possible to make one spline axis points centered via coffee script?
Lets say we have a left aligned text and we convert it to editable spline. We want to use that spline but its axis points should be centered in order to calculate other operations.
I have found one script, tried to modify it but could not make it since my script knowledge is not enough.
main () {
var doc = GetActiveDocument();
var op = Object;
if(op->GetType() != Opolygon) return;//error handling
var newmatrix = new(Matrix); // create a new matrix(axis)
var newpos = newmatrix->SetV0(vector(a1,a2,a3));// The position of this new Matrix(axis)
doc->AddUndo(UNDO_OBJECT, op);
var invertednewmatrix = newmatrix->GetClone();// Create a clone of the Matrix(axis) and assign it to this variable
invertednewmatrix->Invert();// Invert the matrix so the variable name makes sense
var invpos = invertednewmatrix->GetV0(); // Get the position of the inverted Matrix(axis)
var gp = op->GetPoints();// Get all the vertices of the object
var pcnt = op->GetPointCount();//Used to tell how many times the loop should run
var i = 0;
for (i = 0; i < pcnt; i++)
{
gp[i] = newmatrix->GetMulP(gp[i]); //offsets each vertice by the newpos amount
op->SetPosition(invpos); //offset the axis by the newpos amuont
}
op->SetPoints(gp);
op->Message(MSG_UPDATE);
doc->EndUndo();
}
I would be so glad if you could help me,
Thanks a lot,
Best Regards.