2

I have been using ThreeJS for building my own web based CAD frontend. The API has amazing capabilities. My intent is to integrate the physics of the ThreeJS interface with a different product and sadly, the only supported common CAD format is STL. One of the most important inputs in FEA is the boundaries. In my case, they would be the faces of a 3d model, which can be arbitrary shapes and not triangles. Apparently, ThreeJS considers a Face3 as a face.


For example: a model converted from STL

This representation is also called as Boundary Representation.

Is there any way to get these faces in ThreeJS?

I tried the RayCaster but it did not work and my intent is to get a list of all the faces from the model beforehand.

Many Thanks

gman
  • 100,619
  • 31
  • 269
  • 393
Anil
  • 57
  • 9
  • 1
    First, some semantics. In `THREE.js`, a face is a triangle. For you, a face is a shape (potentially multiple triangles) which makes up a bounded region of the model. Do you have information which describes *your* faces (their bounded regions, face vertex indices, etc.)? If so, you can put them into `Buffergeometry` "`groups`". The raycaster will give you a `faceIndex` which you can then cross-reference against the `groups` to determine your face. – TheJim01 Jun 01 '17 at 14:18
  • Many Thanks for your inputs Jim. So it seems, I had to use an external program for getting BRep from STL. Feel free to post a question for more information. – Anil Jun 15 '17 at 22:35
  • As @TheJim01 stated, the only concern is: "a face is a shape (potentially multiple triangles) which makes up a bounded region of the model". Well now I am able to get co-ordinates for that custom face. I wonder if I can recreate the triangles for those vertices with a different color so that it looks like I have highlighted that face? – Anil Jun 15 '17 at 22:42
  • If you assign an array of materials to the object like `object.material = [ actualObjectMaterial, highlightMaterial ]`, you can set all of your groups to have their `materialIndex` property be 0. Then, when you want to highlight a specific face/group, simply set the `materialIndex` to 1. This will switch the material for that face, and only that face. – TheJim01 Jun 16 '17 at 03:06
  • Thanks again. I never played with materials. Sounds like a good idea. I will try it out. – Anil Jun 16 '17 at 15:39

0 Answers0