Get all faces of the mesh from the code

Good morning,

Due to project requirements I have to access all the faces of a Mesh from the code. But the faces are only calculated when I select them or hover over them in the visual editor.

Is there any way to calculate and get the faces from the code?

Thank you very much and best regards

0

Comments

3 comments
Date Votes
  • Please try this approach:

    private void Design1_SelectionChanged(object sender, Workspace.SelectionChangedEventArgs e)
    {
      Workspace.SelectedFace selFace = e.AddedItems[0] as Workspace.SelectedFace;

      Mesh.FaceElement meshFace = ((Mesh)selFace.Item).Faces[selFace.Index];

      List<int> triangles = meshFace.Triangles;
    }

     

    0
  • And there is no way to select faces without the selection event?
    Because without the faces being selected, they are not in the Mesh.Faces list. I want to populate this list from code, without using manual selection.

    0
  • You probably need the Workspace.ProcessSelectionVisibleOnly() method

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post