stl fusion of two files

17 次查看(过去 30 天)
Corali Simoes-Véronneau
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 个评论
Golbarg
Golbarg 2023-9-25
编辑:Golbarg 2023-9-25
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 2023-9-25
If you attach your file with a simple demo input, it would be easier to help.

请先登录,再进行评论。

回答(1 个)

Fabio Freschi
Fabio Freschi 2023-9-25
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!

Translated by