stl write triangulation error.

7 次查看(过去 30 天)
getting the error message
'input argument must be a triangulation object'
this is the code
sidelength = input('Enter Side length: ');
height = input('Enter Height: ');
ax = axes();
xlim(ax, [-20 20]);
ylim(ax, [-20 20]);
zlim(ax, [-20 20]);
view(ax, 3);
hold(ax, 'on');
x6 = (sidelength*3.078)/2;
a = ((2+sqrt(3))*(sidelength))/2; %point to point to determine midpoint starting location for new shape
a8 = (3.236*sidelength);
a1 = (a)*0.9;
h1 = -height;
angle1 = atand(height/x6);
angle2 = 90-angle1;
L = sidelength/2;
L1 = -1*(sidelength/2);
L12 = ((L)*0.9);% Y axis scaled 1:10
L123 = ((L1)*0.9);
angle_12 = 150;
d = (-1*height)*0.1; % Z axis scaled 1:10
b1 = (((sqrt(6)+sqrt(2))/2)*(sidelength));
c1 = ((sqrt(3)+1)*sidelength)*0.5;
c11 = (c1)*0.9;
c2 = -(1.902*sidelength)*0.5;
hold on
x = [c1, c11, a1, a1, a, a];
y = [c1, c11, L12, L123, L1, L];
z = [0, d, d, d, 0, 0];
c = [1; 1; 1; 1; 1; 1];
surf2solid(x,y,z,'thickness',0.1); axis image; camlight;
S = surf2solid(x,y,z,'thickness',0.1);
stlwrite('test.stl',S)

采纳的回答

Fabio Freschi
Fabio Freschi 2023-10-25
编辑:Fabio Freschi 2023-10-25
There are two errors
  1. The output of surf2solid is not a triangulation object
  2. inputs of stlwrite are in the wrong order
sidelength = input('Enter Side length: ');
height = input('Enter Height: ');
ax = axes();
xlim(ax, [-20 20]);
ylim(ax, [-20 20]);
zlim(ax, [-20 20]);
view(ax, 3);
hold(ax, 'on');
x6 = (sidelength*3.078)/2;
a = ((2+sqrt(3))*(sidelength))/2; %point to point to determine midpoint starting location for new shape
a8 = (3.236*sidelength);
a1 = (a)*0.9;
h1 = -height;
angle1 = atand(height/x6);
angle2 = 90-angle1;
L = sidelength/2;
L1 = -1*(sidelength/2);
L12 = ((L)*0.9);% Y axis scaled 1:10
L123 = ((L1)*0.9);
angle_12 = 150;
d = (-1*height)*0.1; % Z axis scaled 1:10
b1 = (((sqrt(6)+sqrt(2))/2)*(sidelength));
c1 = ((sqrt(3)+1)*sidelength)*0.5;
c11 = (c1)*0.9;
c2 = -(1.902*sidelength)*0.5;
hold on
x = [c1, c11, a1, a1, a, a];
y = [c1, c11, L12, L123, L1, L];
z = [0, d, d, d, 0, 0];
c = [1; 1; 1; 1; 1; 1];
surf2solid(x,y,z,'thickness',0.1); axis image; camlight;
% below the changes
[T,P] = surf2solid(x,y,z,'thickness',0.1);
S = triangulation(T,P);
stlwrite(S,'test.stl')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by