@Yaroslav said in Get Spline Data from document->GetActiveObject();:
Forgive me the lack of my expertise.
Hey, we were all beginners at some point. I still ask stupid questions 
Now the question. Suppose the curve is the combination of bezier and linear elements (they are joint).
Not sure what you mean here. A spline can only be of one type. SPLINETYPE::LINEAR
or SPLINETYPE::BEZIER
or one of the other types.
See https://developers.maxon.net/docs/Cinema4DCPPSDK/html/group___s_p_l_i_n_e_t_y_p_e.html#ga7ac05237453839e3b099f55f27512115
I guess you mean that some of the spline's points have tangents, and other's don't (meaning they also have tangents, but with zero length)?
How do we retrieve
- all the start and end points of the constituent elements?
const Vector* padr = splineObject->GetPointR(); // Read-only
or
Vector* padr = splineObject->GetPointW(); // Writeable
See https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_sculpt_object.html#a5f6babccd3d9b408be7f3756fe5767a5
- the control points of Bezier curved elements?
const Tangent* tangents = splineObject->GetTangentR(); // Read-only
or
Tangent* tangents = splineObject->GetTangentW(); // Writeable
See https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_spline_object.html#ab9d27c0ef7b361e532da250c595fe9d2
The only methods that I found are:
const Vector* vec = (*spline).GetPointR();
...
This is correct. There are as many points as splineObject->GetPointCount()
tells you.
To get the position of a spline point, use:
// Get const array of points
const Vector *points = splineObject->GetPointR();
// Get a specific point from the array
const Vector pointPos = points[123];
Same applies to the tangents.
// Get writeable array of tangents
Tangents* tangents = splineObject->GetTangentW();
// Change a tangent
tangents[123].vl = Vector(some, nice, direction);
tangents[123].vr = Vector(another, nice, direction);
tangents[123] = myTangent;
You might want to take a look into circle.cpp
from the cinema4dsdk
project.
Cheers,
Frank