openscad / MCAD

OpenSCAD Parametric CAD Library (LGPL 2.1)

Home Page:http://reprap.org/wiki/MCAD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecated error - square_pyramid

Dorro101 opened this issue · comments

//WARNING: variable triangles not specified as parameter, in file regular_shapes.scad, line 249
//DEPRECATED: polyhedron(triangles=[]) will be removed in future releases. Use polyhedron(faces=[]) instead.

//Old code

module square_pyramid(base_x, base_y,height)
{
w=base_x/2;
h=base_y/2;
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,height]],triangles=[[0,3,2,1], [0,1,4], [1,2,4], [2,3,4], [3,0,4]]);
}

//My fix?

module square_pyramid(base_x, base_y,height)
{
w=base_x/2;
h=base_y/2;
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,height]],faces=[[0,3,2,1], [0,1,4], [1,2,4], [2,3,4], [3,0,4]]);
}

// Tests:

Also removed...

// Tests:

test_square_pyramid(){square_pyramid(10, 20, 30);}

Because...

//WARNING: Ignoring unknown module 'test_square_pyramid', in file regular_shapes.scad, line 262


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Hi @Dorro101, the change seems sound, I would suggest you submit a PR against the 'dev' branch. Leave the test though.

For reference, 'triangles' parameter is now deprecated and 'faces' is valid since version 2014.03 [1].