Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Building an Onshape model viewer

2»

Comments

  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    I don't think you can do iframes with either api keys or locallly. I believe it has to be oauth. But that is over my head right now.

    My first goal will to be get oauth to work locally. Then once I get there, I can move to a public iframes. Technically iframes is already working with the gltf sample. I just don't understand most of it. 
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited July 2022
    iframes are just a web page inside some else's website. 

    I'm thinking one problem with localhost is that you're not running a webserver on localhost and can't provide the webpage that iframe is requesting. 

    Running localhost means that when you shut your computer down, everything goes down with it.  I think if you're building a desktop app that interfaces with OS, then localhost might be appropriate. Not sure about anything else other than that. You don't want to debug a website with localhost, there's a million better ways to do that. I'm not sure OS will list you in the app store if you're running localhost because when you turn your computer off, it all goes dark and they don't want that.

    Building a backend web server use to be painful. I'm not sure that's the case today and won't be the case in the near future.

    I'm thinking if you want to be listed in the OS app store, you'll need a backend server which solves all your issues. 

    I'm not sure if you've heard, but GCP is pushing hard to get into the server space. It's currently the "buzz" in the cloud. Amazon is the king of server space followed by Microsoft with Google not even showing up to the race. Google is trying to catch up and their new documentation is really good and GCP is impressive.

    GCP is "google cloud platform".

    Google "GCP", and watch an introduction.

    I'm currently in the middle of a project, but in September, I'll be moving rustyshed from digital ocean to GCP.

    I've been working on GCP for a while and I like it, it's the next cloud thing.

    Having a backend server should be easy for everyone and with GCP I think it'll be easy for people to create a cloud presence. 



  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited July 2022
    @bill_schnoebelen what gtlf sample are you referring to?
     
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    billy2 said:
    @bill_schnoebelen what gtlf sample are you referring to?
     
    This one: https://github.com/onshape-public/app-gltf-viewer

    I agree with you on the servers. But I need to get react talking to express and express talking to OS first. This is much easier locally.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    @bill_schnoebelen thanks for the gltf link I didn't know this one existed. You know Heroku is a server right? I chose digital ocean over Heroku and I don't remember why. Are you running on a MAC? Brew is a package manager for a MAC. I'm not sure why they're loading files onto a mac, but I'll find out soon. They are running three.js which I have running also and have it configured to look like OS. I like the fact that they're using nodejs vs. some java mavic thingy.

    express? is that a nodejs server? are you running a local server using nodejs? If you are, you'd the man!

    I'll see if I can get this running. I think we've all been waiting for a gtlf viewer for a long time.


  • alan_baljeualan_baljeu Member, User Group Leader Posts: 111 ✭✭
    I'm curious why people want a gltf viewer.  I can imagine many reasons, but what's the present wish?
    Creating knowledge-driven design automation software, for molds, etc.
    www.virtualmold.com

  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    I'm curious why people want a gltf viewer.  I can imagine many reasons, but what's the present wish?
    I just use it to display user interactive 3d models on a website, but I'm stimple.

    https://threejs.org/examples/#webgl_animation_keyframes
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited July 2022
    A deep dive, browsers use a new graphic standard called webgl. It's written by the same guys who wrote opengl except it was refactored using javascript. Three.js sits on top of webgl and makes common tasks easier that's why a lot of people use it. One of the main problems with webgl was getting polygons into a viewer. 4 years ago you had to send stl and convert inside three.js. Then it was hard to define bodies and there were no materials sent along so everything was the same color. 

    The Khronos Group is in charge of most computer graphics these days and the fact that it runs on all phones, desktops & the cloud, this is impressive.

    gltf is an official graphic language transfer format and OS supports it. I haven't played around with it much and believe it's much better than the older stl files.

    Forever, we've been wanting to spin models on our own websites which means you have create a webgl canvas tag and then import your data. It won't do anything so you have to build your own controls. All this to get a model to spin on your website.

    I'd recommend checking out sketchfab.com to see what webgl can do. It's amazing stuff. Makes me wonder why CAD is still RGB.

    Bill has a sample setup for a webgl viewer that I'm currently reviewing. It's well done. It runs on heroku and I'm trying to extract the pieces from it to run on my site. These solutions require both server and client code so it's not a download and run scenario. Bill do you know if any of these guys are still around?



    More importantly is there an public instance of this running somewhere without having to create a heroku account?


  • SethFSethF Member Posts: 130 PRO
    edited July 2022
    @billy2
     So close! Coulda been Ronshape!


  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited July 2022
    @SethF Great! 

    Is there a public instance running?
    Is this example running in a container on Heroku?
    Why redis are you trying to make this stateless?
    Are you using redis to manage a large download?

    I'm still digging into your code and why you guys did what you did.


  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    I have a public instance running but it has to run through my app store application. I would probably have to invite you, I am honestly not sure? It does work, but it also throws some errors. 

    https://cce-app-gltf-viewer.herokuapp.com/
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    Can you share the document with me, I'll PM you my login email. Let's see if this is the problem.




Sign In or Register to comment.