Dear Experts
I have the following gcode but the gcode viewer is showing nothing,
btw I am using this for previewing a movement path. please help
Cleaner.gcode (234.0 KB)
This gcode is rather strange as there are no references to Z or E. The values for X and Y are rather large for a 3D printer, 0-800mm in both directions.
Can you explain in more detail what you are trying to accomplish?
Its a random Gcode, all my softwares including simplify 3d, prusa slicer, cura, and pronterface do show the gcode preview without any problem, but the gcode viewer does not show the gcode. should it contain a specific command so the gcode view can render it?
I didn't say anything about a 3d printer. (its a standard gcode with standard gcode syntax, I don't realize why it is not shown on the gcode viewer)
What I'm going to accomplish is to preview the gcode before it is ran by octoprint.
The Gcode viewer in OctoPrint is primarily meant to watch the printhead moves during the print layer by layer.
It's not a 3D preview.
For this you may use:
@shadowofthedamn, I know you are trying to keep it a secret but we are hampered by a lack of information.
I'm going to guess the device you have attached to OctoPrint is a laser engraver with G1 commands the laser to move to X,Y with the laser on and G0 commands the laser to move to X,Y with the laser off.
The Gcode viewer in OctoPrint is expecting a Gcode file that is meant for a 3D printer.
Unless someone with intimate knowledge of the viewer responds, you best bet is to examine the sources for the Gcode viewer in OctoPrint which are at:
https://github.com/OctoPrint/OctoPrint/tree/master/src/octoprint/plugins/gcodeviewer
thanks a lot to everyone
Your guess is somehow close as the motion is similar but completely wrong as the application is completely different. I will post the results here when I have completely done it. I swear.
What I'm doing currently for 4 days, as you have rightfully suggest, is examining the source code but I thought out of tiredness that maybe this way someone can keep me from a few weeks of searching and realizing the logic behind the source.
hope the gcode viewer programmer/copyright owner sees this and help me.
Regards
prettyGcode plugin is not working either for the file. I should add gcode viewer can preview the 3d printer gcodes, but its not 3D. I think presence of extruder movement is essential for these plugins to work.
In your gcode example (your first post) there are only head moves, no extrusion.
Gcode viewers won't show anything or even just slightly seeing, because there is no material used.
Try again with a "real" model with a sliced gcode.
I am creating the gcodes myself and I told you its not a 3d printer so slicing is not an option. I guess that I should chnage purgeEmptyLayers variable to false in the gcode viewer reader.js library but I dont know where octoprint keep the javascript file so I can change them on my current installation. Or maybe I should install my own source for octoprint (thats hard)
Update: Found the location: /home/pi/oprint/lib/python3.7/site-packages/octoprint/plugins/gcodeviewer/static/js/viewer
but its not as easy as I guessed. needs more modifications.
OK solved the problem, Kind of hackish. should add a Z movement at the beginning of the gcode. the viewer does not show anything if the Z axis <= 0. after adding G1 Z0.1 every thing works now.