Setting Spline Points

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/01/2004 at 03:46, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.500 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;

---------
Hi,
i have Problem wie this Code, as Expression it works fine but in my Plugin only a empty Spline Object will be create but no points set, that makes me really wonder and  i dont find help with the forum search.
thx a lot for help
MfG Morph21
 
MyDialog::CreateSpline()
{
var count = 3;
var doc = GetActiveDocument();
//set spline
var spline=doc->FindObject("ruler_spline");
if (!spline && !instanceof(doc,SplineObject))
{
 var spline=new(SplineObject);
 spline->SetName("ruler_spline");
 doc->InsertObject(spline,NULL,NULL);
 spline->Message(MSG_UPDATE);
 return FALSE;
}

//update new obj/point count
var vc=new(VariableChanged); if(!vc) return FALSE;
vc->Init(0,count);
spline->Message(MSG_POINTS_CHANGED,vc);
var points=new(array,count);
points[0]=vector(0.0,0.0,0.0);
points[1]=vector(100.0,0.0,0.0);
points[2]=vector(0.0,100.0,0.0);
spline->SetPoints(points);
spline->Message(MSG_POINTS_CHANGED,vc);
return spline;

}

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/01/2004 at 13:39, xxxxxxxx wrote:

A couple of things to check:
1. What would spline->GetPoints() return, i.e. has it understood that the spline has three elements?
2. Does calling spline->Message(MSG_UPDATE) help?