stl fusion of two files
15 views (last 30 days)
Show older comments
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/379716/image.png)
Thanks:)
2 Comments
Fabio Freschi
on 25 Sep 2023
If you attach your file with a simple demo input, it would be easier to help.
Answers (1)
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];
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!