Grasshopper

algorithmic modeling for Rhino

I really love Slic3r because of it's nice features and that I can use every CAD programm and stuff.

But I am working on a 3D Printer with a robot arm and want to do the controlling with GH, Firefly and HAL.

Is it possible to import and interprete GCode with GH? I found a lot of threads and discussions about creating GCode, but none about importing it.

I also like to interprete the imported GCode and use the commands to adress the robot or the extruder. I can import the gcode as the text which it is, but not put it to some use.

I tried interprete it as List and then search for commands, but as they change a little bit everytime, I only can find one specific command in particular...

Do I have to write some VB Code?

Views: 4601

Replies to This Discussion

Hello Paul,

I played around with something similar a couple months ago and created a small plugin that takes Slic3r G-gode, though I worked with KUKA|prc. I've attached the files to this post, install the plugin by copying it to the GH Library.

I'm not on my work-PC so I can only hope that I attached the most recent version.... Also, the plugin may require KUKA|prc to be installed.

Hope it helps!

Best,

Johannes @ Robots in Architecture

Attachments:

Can you point us to a format definition about the GCode flavour you're trying to import? And perhaps upload an example gcode file?

Hi Paul,

Gcode import with customizable words is not available on the current HAL public version, but will be in the next major release (January/February). I already finished the ABB RAPID (available as WIP in the current distribution) and KUKA KRL versions, and I am now working on the URScript and finishing the customizable GCodes.If you just have to parse simple G1 blocks though, it's no big deal to do simple string manip on it without digging in regex.

Best

Hello Paul,

Sorry that it took me a while to get back to you! I'm glad to hear that the component worked. I've quickly made an example how you could process the G-code example you attached using Grasshopper components - see the attachment to this post.

This assumes exactly the code you pasted, usually you have a few headers that you either have to ignore or process, and often the lines of G-code contain only the values that change, i.e. if the X-value stays the same it won't be written again to save space. In that case you would have to do some kind of buffer that remembers the last value.

At that stage it's probably easier to invest some time into learning how to process strings (i.e. text) in C#, VB, or Python. Googling for "C# string operations" and "C# string parsing" brings up  a large number of good examples.

Best,

Johannes @ Robots in Architecture

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service