THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/03/2008 at 21:14, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac OSX ;
Language(s) : C.O.F.F.E.E ;
---------
Hi! Today I wrote my first coffee script, a simple script to generate sphere objects at the selected points of a polygon object.
The script works well if I only select one point of a polygon object. But if I select more than one point, Cinema4D will not be responding, and I have to force quit the program.
I was struggling to find out the problem, but have no results. Please have a look at the following code. Many thanks!
> \> if(!instanceof(op, PolygonObject)) return; \> \> var bsOp = op->GetPointSelection(); \> if (bsOp->GetCount() == 0) return; \> \> var pt_list = new(array,100); //new array to store the selected point positions. \> var i, n = 0; \> \> for(i = 0; i < op->GetPointCount(); i++) \> { \> if(bsOp->IsSelected(i)) { \> pt_list[n] = op->GetPoint(i); \> n++; \> } \> } \> \> var mOp = op->GetMg(); \> var j = 0; \> var pt; \> var new_sphere = AllocObject(Osphere); \> \> while (pt_list[j]) \> { \> pt = mOp->GetMulP(pt_list[j]); \> println(pt); \> \> doc->InsertObject(new_sphere, NULL, NULL); \> new_sphere->SetPosition(pt); \> \> j++; \> } \>