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

Loading GCODE file from URL #11

Closed
hackwin opened this issue Aug 9, 2013 · 7 comments
Closed

Loading GCODE file from URL #11

hackwin opened this issue Aug 9, 2013 · 7 comments

Comments

@hackwin
Copy link

hackwin commented Aug 9, 2013

Any ideas on how to load the GCODE from a URL?

@hudbrog
Copy link
Owner

hudbrog commented Oct 8, 2013

Sorry, modern browser security prevents cross site requests, so there is no way to implement loading from url without server side. I have no plans on making that viewer server dependent.

@hudbrog hudbrog closed this as completed Oct 8, 2013
@hackwin
Copy link
Author

hackwin commented Oct 8, 2013

Thanks for replying. I needed to load the file from within the same
domain. AJAX worked fine

On 10/7/2013 10:55 PM, Alex Ustyantsev wrote:

Sorry, modern browser security prevents cross site requests, so there
is no way to implement loading from url without server side. I have no
plans on making that viewer server dependent.


Reply to this email directly or view it on GitHub
#11 (comment).

@Humphreybas
Copy link

Could you share your code snippet how to load gcode from an URL? Many thanks in advance!

@hackwin
Copy link
Author

hackwin commented May 27, 2014

Lines 187 to 209 contain the added code: http://ideone.com/5oTp9e

You can run it from the browser javascript console using: GCODE.gCodeReader.loadUrl("http://localhost/gCodeViewer/model.gcode");

@Humphreybas
Copy link

Thanks a lot! Unfortunately it's not working. Are you still using it? And on what commit of gCodeViewer?

I will give some extra info below in case you wouldn't mind reading it and have a quick solution, but with no means I expect you to invest time in it and fix my issues of course.

The latest commit gives me a "gcode.match is not function" error in detectSlicer and a js syntax error on the gcode file itself (as if the browser tries to interpret it as a javascript?).
After adding "gcodeResponse = String(gcodeResponse);" to the loadUrl function the gcode.match error is replaced by other errors like: "TypeError: Argument 1 of SVGMatrix.translate is not a finite floating-point value"
I switched to the commit which is close to your original post (Oct 8 2013 so I took: a797c52) but that didn't fix it either.

@hackwin
Copy link
Author

hackwin commented May 27, 2014

Here's a copy of the code I used: http://jbcse.com/downloads/gCodeViewer.zip

http://i.imgur.com/rFpgwRj.png

Here's a demo page: http://jbcse.com/projects/gCodeViewer-from-URL/

Enter into the console: GCODE.gCodeReader.loadUrl("thin-wall.gcode");

@Humphreybas
Copy link

Thanks mate, stupid of me I didn't check Chrome, works like a charm there, but not in FF, so it was a browser issue.
Thanks for your help, I will use it in chrome until I gain super javascript powers.

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

3 participants