Accessing normals via coffee script.

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

On 22/10/2007 at 03:06, xxxxxxxx wrote:

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

---------
Hello.
 
My problem is one discussed previously in some posts, but I put it on the table again because all previous posts were related to C++ plugins rather than coffee scripts inside C4D (9.52 in my case).
My question: Is it possible to access the normals via coffee (face or vertex normals?) . CreatePhongnormals(...) does not work within the Script Manager.
I would like to write an export plugin which respects the phong shading breaks and angle limits of the phong tag while exporting.
 
Thanks!

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

On 18/03/2012 at 14:46, xxxxxxxx wrote:

Man that's an old one. Anyway, maybe someone is interested into the solution here.
You can calculate the face-normals yourself

main(doc, op) {  
  var poly = op->GetPolygon(0);  
  var v1 = op->GetPoint(poly->a);  
  var v2 = op->GetPoint(poly->b);  
  var v3 = op->GetPoint(poly->c);  
  var v4 = op->GetPoint(poly->d);  
  var normal = vnorm(vcross(v3 - v1, v4 - v2));  
  println(normal);  
}

The vertex-normals are just the arithmetic middle between the face-normals of all ascending polygons.

Cheers,
-Niklas