Made cube and cylinder static functions of the package, not some specific TriangleMesh object.

This commit is contained in:
Joseph Lenox 2016-11-28 02:46:43 -06:00 committed by bubnikv
parent 26b6e4c619
commit 716dc2e650
2 changed files with 19 additions and 7 deletions

View File

@ -344,12 +344,12 @@ sub on_btn_lambda {
my $params = $dlg->ObjectParameter; my $params = $dlg->ObjectParameter;
my $type = "".$params->{"type"}; my $type = "".$params->{"type"};
my $name = "lambda-".$params->{"type"}; my $name = "lambda-".$params->{"type"};
my $mesh = Slic3r::TriangleMesh->new(); my $mesh;
if ($type eq "box") { if ($type eq "box") {
$mesh = $mesh->cube($params->{"dim"}[0], $params->{"dim"}[1], $params->{"dim"}[2]); $mesh = Slic3r::TriangleMesh::cube($params->{"dim"}[0], $params->{"dim"}[1], $params->{"dim"}[2]);
} elsif ($type eq "cylinder") { } elsif ($type eq "cylinder") {
$mesh = $mesh->cylinder($params->{"cyl_r"}, $params->{"cyl_h"}); $mesh = Slic3r::TriangleMesh::cylinder($params->{"cyl_r"}, $params->{"cyl_h"});
} else { } else {
return; return;
} }

View File

@ -37,10 +37,7 @@
%code{% RETVAL = THIS->bounding_box().center(); %}; %code{% RETVAL = THIS->bounding_box().center(); %};
int facets_count(); int facets_count();
void reset_repair_stats(); void reset_repair_stats();
Clone<TriangleMesh> cube(double x, double y, double z)
%code{% RETVAL = make_cube(x, y, z); %};
Clone<TriangleMesh> cylinder(double r, double h)
%code{% RETVAL = make_cylinder(r, h); %};
%{ %{
void void
@ -228,6 +225,21 @@ TriangleMesh::bb3()
OUTPUT: OUTPUT:
RETVAL RETVAL
Clone<TriangleMesh>
cube(double x, double y, double z)
CODE:
RETVAL = make_cube(x,y,z);
OUTPUT:
RETVAL
Clone<TriangleMesh>
cylinder(double r, double h)
CODE:
RETVAL = make_cylinder(r, h);
OUTPUT:
RETVAL
%} %}
}; };