stl write triangulation error.

2 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by