Create stl. file with [F,V,N] data

Hello,
I would like to create a stl. file with given data [F,V,N]. I have problems using the funtion stlwrite (https://de.mathworks.com/matlabcentral/fileexchange/20922-stlwrite-write-ascii-or-binary-stl-files). Can you help me?
My goal is to take the data of a given stl. file and tweek it (like multiplying the values of [F,V,N] times 2). Is this possible?
Thank you :)

More Answers (1)

KSSV
KSSV on 7 Aug 2020

5 Comments

Thanks for the quick reply.
I tryed it but it still doesn't work. It might be my fault though.
TR = triangulation(f,v) %f and v are already defined as F/2 and V/2. F and V I took directly
% from [F, V, N] = stlread('MyFile.stl');
stlwrite(TR,'tritext.stl','text')
I get the following error:
Error using triangulation
The input triangulation must contain index values. Entries with fractional parts are invalid.
Is the fact that I divided the faces and vertices a problem?
You got nodal connectivity data and vertices. You can divide vertice coordinate data by 2, but you should not divide the connectivity data by 2. The connectivity data should be always intgers.
Ok, thanks again. I still get an error though :/
>> Zahn1 = stlread('F.O. - 6 left up.stl');
[F, V, N] = stlread('F.O. - 6 left up.stl');
v = V/2;
TR = triangulation(F,v);
stlwrite(TR,'tritext.stl','text');
Error using fileparts (line 37)
Input must be a row vector of characters or string scalar.
Error in stlwrite (line 70)
path = fileparts(filename);
Can you attach your data? Unsuported file types must first be zipped before you can attach them.
Diego Hens
Diego Hens on 7 Aug 2020
Edited: Diego Hens on 7 Aug 2020
I have uploaded some other data, because I'm not sure if I may send the real data because of data protection regulation. But it doesn't work either. I have probably made a mistake somewhere in the code.
I want to thank you again for repeatedly taking the time to answer :)
Edit: The data file is a different one, but the error persists

Sign in to comment.

Asked:

on 7 Aug 2020

Answered:

on 14 Aug 2020

Community Treasure Hunt

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

Start Hunting!