GithubHelp home page GithubHelp logo

Show Edges in 3D about online3dviewer HOT 9 CLOSED

kovacsv avatar kovacsv commented on August 11, 2024
Show Edges in 3D

from online3dviewer.

Comments (9)

X-Ryl669 avatar X-Ryl669 commented on August 11, 2024 1

Tried it and it works:

diff --git a/source/viewer/viewer.js b/source/viewer/viewer.js
index e5acfe0..5dad2d3 100644
--- a/source/viewer/viewer.js
+++ b/source/viewer/viewer.js
@@ -230,6 +230,9 @@ OV.Viewer = class
         for (let i = 0; i < meshes.length; i++) {
             let mesh = meshes[i];
             this.scene.add (mesh);
+            let edges = new THREE.EdgesGeometry(mesh.geometry);
+            let lines = new THREE.LineSegments(edges, new THREE.LineBasicMaterial( { color: 0xFF0000 }));
+            this.scene.add (lines);
         }
         this.Render ();
     }

It renders this:
image

from online3dviewer.

kovacsv avatar kovacsv commented on August 11, 2024

At the moment it's not possible.

from online3dviewer.

X-Ryl669 avatar X-Ryl669 commented on August 11, 2024

You can probably add this by rendering two model, once like it's done currently, and a second with wireframe/edge mode only (it would also draw hidden edges, I think.
Like this:

const geometry = new THREE.BoxGeometry( 100, 100, 100 );
const edges = new THREE.EdgesGeometry( geometry );
const line = new THREE.LineSegments( edges, new THREE.LineBasicMaterial( { color: 0xffffff } ) );
scene.add( line );

from online3dviewer.

kovacsv avatar kovacsv commented on August 11, 2024

Thanks for the example code, @X-Ryl669. It works great, and your code can be used as a workaround until it will be part of the core feature set.

Here are my results with your code:
image

from online3dviewer.

Emilien-Etadam avatar Emilien-Etadam commented on August 11, 2024

Look great ! how can I do this (without coding knowledge) ?

from online3dviewer.

kovacsv avatar kovacsv commented on August 11, 2024

Unfortunately I don't think it's possible without coding knowledge.

from online3dviewer.

Emilien-Etadam avatar Emilien-Etadam commented on August 11, 2024

I did it ! It's quite simple. Just add 3 lines at the right place. But the result is not what I expect, it show all edges :
2021-04-19_21-08-49

But I think the problem come from STL file (if I upload STL files on grabcad edges are not showing )

from online3dviewer.

kovacsv avatar kovacsv commented on August 11, 2024

STL files doesn't contain edges, so it's up to the visualizer to draw them or not. The trick that was mentioned before are just using a helper to show the edges, and it depends on the angle of polygons if an edge is visible or not. Fortunately there is a second parameter for EdgesGeometry that defines the threshold angle. Playing with this value maybe you can get the result you want.

let edges = new THREE.EdgesGeometry(mesh.geometry, 30);
let lines = new THREE.LineSegments(edges, new THREE.LineBasicMaterial( { color: 0xFF0000 }));
this.scene.add (lines);

from online3dviewer.

Emilien-Etadam avatar Emilien-Etadam commented on August 11, 2024

it works ! Thanks.
2021-04-20_08-57-32

from online3dviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.