You are browsing as a guest. Sign up (or log in) to start making projects!

2h 43m 19s logged

Face Selection

I was going to start working on sketching and other features but realized I needed to be able to select faces first. Three.js does have a Raycaster to select objects in the scene but it returns the whole object or triangles since it has no knowledge of the B-REP model (which stores the actual faces we want rather than triangle approximations ) after exporting it.

The solution was replacing build123d’s builtin export for a more manual process. I used the trimesh library to manually add each face of the model as it’s own mesh and exporting them all together as a scene. Three.js load’s the whole scene as a Group which is practically identical to a normal mesh in code. Now when the Raycaster returns a Mesh, it’s actually a face.

0
17

Comments 0

No comments yet. Be the first!