필터 지우기
필터 지우기

stl write triangulation error.

조회 수: 3 (최근 30일)
Matthew
Matthew 2023년 10월 25일
댓글: Matthew 2023년 10월 25일
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')
  댓글 수: 1
Matthew
Matthew 2023년 10월 25일
Thank you, I really appreciate your help.

댓글을 달려면 로그인하십시오.

추가 답변 (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