Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run cad.js example #32

Open
majvr93 opened this issue Apr 11, 2016 · 6 comments
Open

How to run cad.js example #32

majvr93 opened this issue Apr 11, 2016 · 6 comments

Comments

@majvr93
Copy link

majvr93 commented Apr 11, 2016

I wanted to run an example as in Snazzy Demos.

problem

I followed all the steps README.md and installed the project on my PC successfully, but now I can not view an example.

After the project is running with ("npm run start-dev"), how I can do to see an example? What request should I do? I've tried several ways but I can not see anything in the browser.

I created a folder "data" as indicated and put the files there that I got after running the command "node scripts/scrapeModel.js -d date/cutter -h http://www.steptools.com/demos/cutter/index.xml" and "node scripts/xmlToJson.js -d date/cutter -i index.xml" at the end made the following request "http://localhost:8080/cad.js?resource_url=/data/modelname/index.xml " and also experimented with "http://localhost:8080/cad.js?resource_url=/data/modelname/index.json" but had no effect and the page was blank.

How do I see an example in the browser?

thanks

@rszeto
Copy link

rszeto commented Aug 1, 2016

I am having the same issue. Looking at the resources in Chrome's Developer Tools, I think the problem is that the same page is loaded every time, regardless of the URL you're using. So when the client requests a .js file, it loads some HTML instead of the proper .js file. Fixing the same-page-every-time problem might fix this issue.

@rszeto
Copy link

rszeto commented Aug 1, 2016

To better illustrate my point, compare what curl returns when you retrieve http://localhost:8080/ and http://localhost:8080/js/main.js:

> curl http://localhost:8080/
<html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/js/main.css"/><title>CAD.js</title></head><body data-services="{&quot;api_endpoint&quot;:&quot;&quot;,&quot;socket&quot;:&quot;&quot;,&quot;version&quot;:&quot;/v1&quot;,&quot;auth&quot;:&quot;/v1/user&quot;,&quot;model&quot;:&quot;/v1/model&quot;}" data-config="{&quot;embedded&quot;:false,&quot;auth&quot;:false,&quot;two_factor&quot;:true,&quot;socket&quot;:true,&quot;upload&quot;:true}" class="non-initialized"><div id="primary-view" class="primary-view"></div><script src="/js/main.js"></script></body></html>

> curl http://localhost:8080/js/main.js
<html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/js/main.css"/><title>CAD.js</title></head><body data-services="{&quot;api_endpoint&quot;:&quot;&quot;,&quot;socket&quot;:&quot;&quot;,&quot;version&quot;:&quot;/v1&quot;,&quot;auth&quot;:&quot;/v1/user&quot;,&quot;model&quot;:&quot;/v1/model&quot;}" data-config="{&quot;embedded&quot;:false,&quot;auth&quot;:false,&quot;two_factor&quot;:true,&quot;socket&quot;:true,&quot;upload&quot;:true}" class="non-initialized"><div id="primary-view" class="primary-view"></div><script src="/js/main.js"></script></body></html>

@rszeto
Copy link

rszeto commented Aug 2, 2016

Got the viewer to not show a blank screen. My problem was that I didn't compile with webpack before running the application (instructions did not make that clear). After compilation, I believe a model loaded as per the samples should be viewed at <url>/<modelname> (e.g. http://localhost:8080/cutter). I'm still getting an issue (link), but at least it's not a blank screen.

@choumanb
Copy link

I followed the instructions (compiled & built with webpack), and used the url (http://localhost:8080/cutter) I get the page displays only the lines but not the actual cutter (3D model)
(see attached pic - https://cloud.githubusercontent.com/assets/5707190/17962669/f29d8e8a-6ac2-11e6-8dc7-b2e51abab010.jpg)

I am using chrome and mozilla.
Any hints please on what seems to be missing?

Many Thanks,

cadjs_nomodel

@coutcout
Copy link

coutcout commented Oct 9, 2016

Hi,
I'm having the same issue...
Could we have help ?

Thanks.

@zhonghuiwen
Copy link

Hey guys i tried using 0.74.0 for three.js and it worked! Change the package.json to "three": "^0.74.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants