MCAD icon indicating copy to clipboard operation
MCAD copied to clipboard

Deprecated error - square_pyramid

Open Dorro101 opened this issue 5 years ago • 1 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.

Dorro101 avatar Dec 29 '20 11:12 Dorro101

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].

rockstorm101 avatar Jan 03 '21 16:01 rockstorm101