Clear Filters
Clear Filters

stl fusion of two files

26 views (last 30 days)
Corali Simoes-Véronneau
Corali Simoes-Véronneau on 13 Oct 2020
Answered: Fabio Freschi on 25 Sep 2023
Hi!
I am trying to put a simple triangle in 3D on top of a cylindre in 3D too. I know it seems easy to do but I'm just starting to use MATLAB with STL and I don't know how to write the function to fusion these two designs.
Here is the start of our code for the fusion function:
Thanks:)
  2 Comments
Golbarg
Golbarg on 25 Sep 2023
Edited: Golbarg on 25 Sep 2023
Hi!
I hope you have found a way. I'm almost new in MATLAB and I'm trying to do the same thing. My geometries are a little bit complicated and I want to combine their stl files.
I appreciate any help :)
Fabio Freschi
Fabio Freschi on 25 Sep 2023
If you attach your file with a simple demo input, it would be easier to help.

Sign in to comment.

Answers (1)

Fabio Freschi
Fabio Freschi on 25 Sep 2023
While waiting for more details about the inputs, I make my guesses.
  • if your objectSTL has nodes/faces/normals, you can't address them like you did. They are likely structures, so you should write something like
f1 = objectSTL1.face;
v1 = objectSTL1.vertex;
n1 = objectSTL1.normals;
  • your concatenation cannot be correct. In fact each object has its own numeration of vertices. Use something like
objectSTL3.face = [f1; f2+size(v1,1)];
objectSTL3.vertex = [v1; v2];
objectSTL3.normals = [n1; n2];
  • now you realize that your temporary variables are useless
objectSTL3.face = [objectSTL1.face; objectSTL2.face+size(v1,1)];
objectSTL3.vertex = [objectSTL1.vertex; objectSTL2.vertex];
objectSTL3.normals = objectSTL1.normals; objectSTL2.normals];

Community Treasure Hunt

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

Start Hunting!