A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
How to center editable spline axis points using coffee script node in xpresso?
Posted: 07 February 2014 08:24 AM   [ Ignore ]  
Total Posts:  1
Joined  2014-02-05

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_OBJECTop);
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 0
for (
0pcnti++)
{
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.

File Attachments
example.zip  (File Size: 53KB - Downloads: 255)
Profile
 
 
Posted: 07 February 2014 04:15 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Grasycho,

This is the “Tutorial Discussion” forum, and I guess (do I miss something?) this is not related to any tutorial at all.

If you need developer knowledge, you might check here: http://www.maxon.net/support/developer-support.html

Otherwise, the “Axis Center” in Cinema 4D does this already, again, perhaps I miss something in your description.

Good luck with the idea and the link I have provided.

Sassi

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile