stlloader | Simple loader for STL 3D model files | 3D Printing library

 by   dacunni C++ Version: v0.1 License: MIT

kandi X-RAY | stlloader Summary

kandi X-RAY | stlloader Summary

stlloader is a C++ library typically used in Modeling, 3D Printing applications. stlloader has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Simple loader for STL 3D model files. This is a C++ header-only library. To use it, #include "stlloader.h" wherever you intend to use the library. You must #define STLLOADER_IMPLEMENTATION before including it in one of your files for the implementation to be defined for the linker.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              stlloader has a low active ecosystem.
              It has 5 star(s) with 1 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 2 open issues and 1 have been closed. On average issues are closed in 2 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of stlloader is v0.1

            kandi-Quality Quality

              stlloader has no bugs reported.

            kandi-Security Security

              stlloader has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              stlloader is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              stlloader releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of stlloader
            Get all kandi verified functions for this library.

            stlloader Key Features

            No Key Features are available at this moment for stlloader.

            stlloader Examples and Code Snippets

            stlloader
            C++dot img1Lines of Code : 7dot img1License : Permissive (MIT)
            copy iconCopy
            #define STLLOADER_IMPLEMENTATION
            #include "stlloader.h"
            
            #include "stlloader.h"
            [...]
                stlloader::Mesh mesh;
                stlloader::parse_file(filename, mesh);
                stlloader::print(mesh);
              

            Community Discussions

            QUESTION

            Loading STL files with Vue-cli and Three.js
            Asked 2021-Mar-11 at 10:59

            I currently have the problem that I am not able to load a STL file into a three.js scene which is created via vue-cli.

            Project setup with vue-cli 'vue init webpack ProjectName', 'cd ProjectName', 'npm install three --save' and replace the 'HelloWorld' component with this code.

            stl file is on the same folder as this vue component.

            ...

            ANSWER

            Answered 2021-Mar-11 at 10:59
            Answer

            I installed the last version of vue-cli which have a "public" folder. I also installed "vue-3d-model" by hujiulong and now it's working fine! :D

            I don't know what was the issue, maybe Vue have restricted permission without a public folder ?

            Source https://stackoverflow.com/questions/66348733

            QUESTION

            Component Render Issues (Long Read)
            Asked 2021-Feb-24 at 06:17

            I am dynamically getting data from my database to display on my website but I've encountered a problem and don't know how to fix it.

            I have a main Home page which loads in a bunch of tiles that you can click on and take you to another page on my SPA. Some of the tiles you can click on can render STL objects from a file or some tiles will not when clicked on.

            I have encountered an issue with my components that render STL files.

            Issues?
            1. Clickable Component is Multi Rendering my Model Component (or something like that?)
            2. I have unmount and remount for each page view?
            3. General Issue with Project Setup?
            4. Issue with STL (Model) component can be found at the bottom
            Provided
            1. Home.js (main component)
            2. ClickableImage (component that returns [])
            3. Layout.js (dynamic content pages)
            4. Model.js (Component that loads my model)
            5. Reproducible Code Current Issue CodeSandBox
            Updates

            11:03pm Feb 23 : Added in CodeSandBox

            codesandbox code explanation. 2 Images are displayed, clicking on first image will take you to a layout that doesn't load in the STL file. The second image does. That's when everything breaks.

            In Model.js under `/src/components/Layout/

            Home.js ...

            ANSWER

            Answered 2021-Feb-24 at 06:17

            The problem is that useLoader() is having issues fetching the file you are providing in the url variable.

            In your example, the value you end up providing as "url" is "./RaspberryPiCase.stl".

            To fix your issue, simply provide the full absolute URL where your STL file can be fetched from.

            Based on your provided Codesandbox, it's on your project /public folder, so a simple way to fix your issue is doing:

            Source https://stackoverflow.com/questions/66343603

            QUESTION

            Render STL File in React
            Asked 2021-Feb-24 at 01:13

            I'm trying to display an STL file using react-three-fiber and threejs from a https link / file.

            Issues:
            1. CORS (localhost -> https issue)
            2. Cannot load local files either

            Also I know I can load files using threejs regularly (haven't tried this way nor do I know the correct integration between react-three and three) but I don't plan to use it since I will be loading in all my models via a link and I just assume react-three-fiber is better to use in my case?

            What I've Tried ...

            ANSWER

            Answered 2021-Feb-24 at 01:13

            QUESTION

            STLLoader in Vue not functioning
            Asked 2020-Aug-19 at 09:48

            I am trying to use the THREE STLLoader to render an object in my Vue scene. (I am using the Vuetify framework, but that shouldn't matter for the working of the THREE renderer.)

            I cannot figure out why this is not working. I have a working STLLoader in 'vanilla' HTML and Javascript (using the CDN), but I can't seem to get it to work with the node modules. (This verifies that the files I am trying to render are not corrupt)

            I also had a working 'hello world' example with a spinning cube on this page earlier, to test out the basic THREE functionality. So I am pretty sure this is an issue with my code and not with the THREE and Vue intergration.

            I am not getting any errors except for this one:

            ...

            ANSWER

            Answered 2020-Aug-19 at 09:48

            This did the trick for me in the end:

            Source https://stackoverflow.com/questions/63337350

            QUESTION

            Three.js Change Mesh face colour using Raycaster
            Asked 2020-Jul-15 at 16:38

            I am currently working on a web application that is supposed to give the faces another color when they are hovered over by a Raycaster (mouse).

            I currently have a working .stl viewer and orbital controls in place.

            To download and run my code with a known working .stl file see my github. You can run it quite easily, only requiring a live server (which is easy to do in e.g. VSCode, see the readme).

            It currently works perfectly with changing the whole object's color, but when I try to change the facecolor using the raycaster's intersects (the same way you change the object's properties), it does not work. I already read that you have to add vertexColors: THREE.VertexColors to your material properties.

            I can see the color value is changing (using console.log on the face's color property) and it changes to a different, corrosponding value when I change intersects[i].face.color.setHex(0x0f0f0f). But the visual face isn't changing.

            I think I am missing something or overlooking something, but I can't seem to figure it out.

            My current code:

            ...

            ANSWER

            Answered 2020-Jul-15 at 16:38

            The face property of the intersection object is read-only. Meaning even if you modify it, the actual geometry data won't be updated.

            Keep in mind that you work with BufferGeometry which represents geometries via vertex data. There is no face abstraction like with the legacy Geometry class. So if you want to modify colors per faces, you have to ensure that no face definitions in your geometry share vertices. Or in other words, you can only do this with non-indexed geometries. Fortunately, STLLoader only returns non-indexed geometries.

            The actual vertex color data are stored in a color buffer attribute. You can access it via const colorAttribute = geometry.getAttribute( 'color' );. You have to update the colors values in this buffer attribute to implement your intended feature. The pattern for this is:

            Source https://stackoverflow.com/questions/62914985

            QUESTION

            Selecting faces with Raycaster in ThreeJS with STL Loader
            Asked 2020-Jul-15 at 12:51

            I am currently working on a .stl viewer using Three.js. The goal is select and calculate certain areas. For this area calculation I need to be able to select (e.g. change the color) faces.

            I have found something similar, but from what I have seen in my own research this only seems to be working with ready made meshes (like the cube in the example).

            I am looking to implement this example in my own code.

            It is evident that something like this has been done before, but I just can't seem to implement any kind of working way in my own code:

            My current code has a fully functional .stl loader and viewer. The raycaster is there, but doesn't seem to be working properly so I have commented it out for the moment. Mugen87, thank you for the fix!

            You can download my code and an example .stl file from github. Which only requires a Live Server environment which can easily be ran using VSCode (see readme).

            My current code:

            ...

            ANSWER

            Answered 2020-Jul-15 at 10:03

            The raycaster is there, but doesn't seem to be working properly so I have commented it out for the moment.

            I have debugged your code locally. Raycasting does not work since onMouseMove() is not yet called. You have to register it as an event listener first. So try to add the following line to your example:

            Source https://stackoverflow.com/questions/62911473

            QUESTION

            How to connect input and three.js canvas?
            Asked 2020-Jul-10 at 11:28

            This is STL Viewer:

            ...

            ANSWER

            Answered 2020-Jul-10 at 11:28

            Here is a full working example that shows the basic workflow: https://jsfiddle.net/17q6b2sd/2/

            First, you need a respective input tag:

            Source https://stackoverflow.com/questions/62832351

            QUESTION

            How to fix my rotation from speeding up using Matrix4 in three.js
            Asked 2020-Feb-27 at 16:49

            I want to be able to rotate my object when I press the "x" key using a Matrix4. My code below works however, the longer I hold the "x" key, the object starts to rotate much faster over time then to start. How can I fix this.

            ...

            ANSWER

            Answered 2020-Feb-27 at 16:49

            .applyMatrix4 does not set a matrix, it concatenates the new transformation to the current transformation of the mesh. Since Rx is incremented, the rotation wich is add increase and the rotation speeds up. Don't increment Rx, append the same transformation (of 1°) per key press, to solve the issue:

            Rx += Math.PI/180

            Source https://stackoverflow.com/questions/60437743

            QUESTION

            Three.js - Smooth shading results in weird edges
            Asked 2020-Feb-22 at 14:01

            I’m trying to get .stl files to appear smooth, but the edges result in these weird dark areas.

            With flatShading set to true

            With flatShading set to false

            Is there any way to make the edges perfectly smooth without these weird artifacts?

            ...

            ANSWER

            Answered 2020-Feb-21 at 19:34

            The problem isn't with Three.js, but with your geometry. Three.js uses "vertex normals" to know which direction the vertex is facing. This is used to smooth out faces. See the illustration below, your edge has a "smooth edge" (left diagram), where the direction of the faces is blended along that 90-degree angle. If you want a "sharp edge" (on the right), you'll have to tell your your geometry to create a second normal, each one pointing perpendicular to the face, so the angles don't blend.

            .

            Here's what your normals look like in Blender, in a before/after animation. Notice that a single normal down the middle gives the undesired smooth shading:

            The way to achieve this varies from one editor to another, but I'm sure you can find the exact step-by-step instructions by looking up "mark sharp edge" for your editor of choice.

            Source https://stackoverflow.com/questions/60343410

            QUESTION

            Cannot set property 'y' of undefined
            Asked 2020-Feb-05 at 16:04

            I'm currently trying to load and display a .stl file using three.js using this code:

            ...

            ANSWER

            Answered 2020-Feb-05 at 16:04

            An STL file contains only geometry. STLLoader returns a BufferGeometry object. A BufferGeometry object does not have a position property, but you can use it to create a Mesh, which does.

            Source https://stackoverflow.com/questions/60078756

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install stlloader

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/dacunni/stlloader.git

          • CLI

            gh repo clone dacunni/stlloader

          • sshUrl

            git@github.com:dacunni/stlloader.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular 3D Printing Libraries

            OctoPrint

            by OctoPrint

            openscad

            by openscad

            PRNet

            by YadiraF

            PrusaSlicer

            by prusa3d

            openMVG

            by openMVG

            Try Top Libraries by dacunni

            fluxrt

            by dacunniC++

            FastRender

            by dacunniC++

            PyTrace

            by dacunniPython

            dacunni.github.io

            by dacunniHTML