Finally building my ZenXY

It became possible to do this in the 1.0 version. Since loops and scale/rotate are now effects. I have been meaning to do this with some simple sort of logo. It has to be pretty simple in the beginning, and it helps to not have many concave features. The V1 logo is perfect, but it is already built in. I was thinking of doing a batman bat or something.

Just like some patterns come out too complex when you go from the line preview to the sand. Some patterns look very complex in the preview and end up being pretty simple while they are being drawn. It helps to use the slider in the preview to visualize how it will look while drawing the pattern. But ultimately, it takes skill.

I think of sandify as an instrument. You should be able to pick it up and play with it. But I don’t mind that there are complex things you can only do after a bit of practice. I don’t want it to be an MP3 player, where anyone can just play a perfect song, but there are only so many to choose from.

1 Like

I like that analogy!

After Ryan mentioned the bug with the first two lines of exports getting combined I took a quick look at the code to see if I could figure out what was going on there. Nothing obvious jumped out at me … but looking at the issues I saw a reference to “turtle” in an old issue which got me thinking.

One of my early introductions to computers was logo and turtle graphics on the apple II which got even more fun when our school got a Topo My family was friends with the woman who ran the school’s learning lab and she would watch me in the mornings before school while my sister was at her figure skating lessons. So I’d get to go to the school a few hours early and play with Apple’s and when they got it Topo - even before they let “normal” students use it. I don’t remember the details - but I do remember the woman who ran the lab was frustrated because it was supposed to be able to control topo with turtle graphics but she could never get it working. A few mornings of frustration though and I finally figured out what was wrong and we started to have fun driving him around. Until I ramped up the speed and sent a long repeating design to him and his tether got a little tangled - which pretty quickly sent me from the “Can do no wrong” list to the “Don’t let him touch the robot” list :rofl:

A few years ago I made a little arduino / 28BYJ-48 stepper based robot for my daughter and hacked together a REALLY primitive subset of logo for her to program it with. I had started to look into more comprehensive logo/turtle graphics implementations for arduino and was surprised not to find any at the time. What I hacked together was REALLY basic but she had fun with it for a bit - and I got to bring it to her girl scouts troop and teach her troopmates how to program it which let them all earn a robotics badge. It was a ton of fun seeing how they went from being intimidated by the robot and scared to try and draw a square - to plotting out how to try to draw a basic outline of pikachu in just an hour :smiley:

The point of that is now I’m looking at logo->gcode translators and thinking about what a nice simple language it was for creating these kinds of patterns. My quick look this morning didn’t let me figure out what the reference to “turtle” in that issue was (I’m assuming a library used internally from the discussion) but it does have me wishing that I could dust off the old logo skills to design patterns. I do keep finding things I missed in sandify though so for all I know what I’m thinking of already exists and I just haven’t found it yet :smiley:

Oh - and I definitely want to take a closer look at the internals of Sandify. It’s changed a LOT since last time I looked at it and it looks like there’s a lot more interesting stuff in there than I realized!

1 Like

It doesn’t really do anything for you, but you can add Sandify webpage as an extension so it shows in a tab within FluidNC. I’m not sure if this requires the CORS changes that I have setup on my pen plotter. Of course, that only works if you’re using STA mode for Wifi. I’m not sure how big Sandify is (or if it compiles to a static webpage) to know if you could store it directly in flash like extensions typically are.

I suppose if Sandify was modified to be able to detect if it’s running in a FluidNC extension, and could hook into uploading the file to the SD card, maybe something is possible. It would be cool if it could see the FluidNC status info and overlay the current position on top of the image. I haven’t looked into the Sandify code.

Oh yea, I did try to mess with Sandify, but I was in some kind of Node.js version hell and then my Docker installation was messed up. I think I need to reinstall WSL.

2 Likes

It is a statis web page. Node.js runs it in a “fat” form where it watches the files and gives you instant feedback whenever you save a file. It is very slick for development, but not great for deploying. I run it in a docker and I’m pretty sure my docker compose file is checked in.

The page gets “built” into an unreadable mess for the server. IIRC, there is a special branch called “gh-pages” with the static site in the repo. Whenever I make a new release, github actions builds it and commits it there.

One issue with just pasting the gh-pages onto a fluidnc sd card is that the common dependencies are loaded externally through cdns. So you still need the Internet. At least on the computer connecting to fluidnc. I have manually downloaded these for a project in the past. But it is a rabbit hole. I bet there is a way to make node deploy by copying all the needed files locally. Or maybe there is a way to make the browser do it.

1 Like

Turtle was something James originally talked about and it is very similar to your logo (it’s possible it is derived from logo). The instructions are things like move forward, rotate in place, lift pen (which we can’t do) and then all the programming things like for loops.

EDIT: It is the same. But I haven’t seen the Logo text. Just in forms like this, which make it a bit clearer for beginners: Get Started on iOS | Turtle Graphics

That issue is about adding a text editor so people can make kernel shapes with code. Turtle is just one possible language for it. I don’t want to reinvent the wheel. Logo looks a bit too terse.

At this point, sandify has moved closer to illustrator than that. It is still possible to add. But I wonder if it would be better to completely pull that part out and make it a separate tool and just reuse sandifys ability to limit and export gcode.

1 Like

I’m feeling very very close to having my homing issues resolved. This is what I’m using now for my start code:

; Custom Homing
; Fake line
$HY 
G92 X0 Y0
G0 Y-5
G92 X0 Y0
$HX
G92 X0 Y0
G0 X-15
G92 X0 Y0
G1 X0 Y0 F1200

The two comments are to get around sandify combining the first two lines. It’s just too easy for me to forget to modify something manually after :rofl:

Making sure that $HY and G92 are on separate lines resolved most of the Y crashes. But there was still a small Y crash so I backed my offset off from -6 to -5 and now I’m not getting any more Y crashes.

But - running the steps manually I figured out what was wrong with the X. I needed another G92 after $HX before the G0. I forget exactly what I saw that made me think that was necessary - but I remember that in some situations there were cases were one of the coordinates was off at that point unless I did another G92. I think the work X was off even though the machine X was getting zeroed out from the $HX. But…adding that resolved the X crashes I was having.

And changing the initial move to a G1 to 0,0 solved the issue of the first move being hyper fast.

There’s just one remaining issue. If I’m in those first 15mm between workspace 0 and machine 0 where I’m in machine negative when I start a homing - then it still crashes.

As long as my X is above machine 0 everything works great. But a lot of my patterns end at X0 so starting another pattern immediately after results in a crash when homing.

Reading about fluidnc parameters and expressions just before I went to sleep it sure sounds like I could add something to detect that situation…it also sounds like the expressions would make it possible to do what I was musing about earlier and making it return to 0,0 by perimeter as part of and end code.

The one catch is it wouldn’t work when the machine is unhomed…but there’s a parameter to tell if G92 is applied or not so maybe a check for that…so maybe something like

o102 if [#5210]
  ; G92 is applied so we should be homed
  o103 if [#5420 LT 0]
    G0 X5
  o103 endif
o102 endif

There’s probably a better way to check if the machine is homed…I’ll have to read the docs a bit closer tonight. But if I’m understaning it correctly that should basically say if G92 is applied and X is less than 0 then move to X5.

Some similar logic at the end could be used to check if xmax or xmin is closer to the current position and move towards the closest…and same for ymax / ymin to get to the border. Then just move to max/min positions along the border.

I’ll have to play with this tonight…the parameters and expressions seem really powerful even if they’re kind of basic. Heck - this could be used to do some basic looping like logo/turtle as well it seems.

I’m pretty sure there is…but it’s definitely a rabbit hole I’m not in a hurry to jump down or encourage anyone else to :rofl: I do something similar in gulp on some legacy sites we maintain to copy packages managed by npm out of node_modules and into a deployable form when the site is built in a way that we can’t use something like webpack to package things cleanly. It’s a pretty ugly hack…and I’m sure there’s a better way but it solved the need at the time.

I definitely want to take a closer look at sandify’s code soon. I don’t do a lot with React though we did do a mobile app in react native last year so at least the basics are still fairly close to the front of my mind.

What I’m not sure about is how even if sandify was packaged so it could run as part of the fluidnc GUI how it could send completed gcode - I just haven’t looked at the fluidnc GUI to see what kind of hooks may be available for file transfer.

But…

You make a great point - I’m a big fan of the unix approach with small tools that do one thing and do it well - but can be easily piped/chained together to complete bigger tasks. Though that almost seems backards to me - like sandify would be more the “creative” side for generating paths while the part that would break off would be the “utlity” side for limiting and exporting gcode. But it’s your project and that’s just my impression of which part I associate with the name “sandify” :smiley:

I had never seen a more “visual” turtle graphics like the one you linked. Looks like it might be leveraging blockly? Side note - if anyone who is enjoying this kind of talk is looking for a nice rabbit hole of diversion the guy who created blockly has a really interesting “blog” with a buch of neat nerdy/geeky projects he’s done over the years: Neil Fraser: News

I was also never completely clear on the line between Logo and Turtle Graphics…even back in the 80’s when I was first introduced to them. I know Turtle graphics have been implemented in other languages as well - but given how I was introduced I always associate them as an offshoot of logo. In fact while logo was the second programming language I was exposed to I’m not sure I ever did anything other that turtle graphics with it. Though I do have some vague memories of creating interactive scripts that would prompt the user for inputs that it would use to modify the pattern instead of just hard coding the designs. But I did a lot more with basic than I ever did with logo…then I was introduced to Pascal and shortly after I got my hands on and early 0.98 SLS linux distro and C came into the picture followed closely by bash and zsh and Perl…

Woah…ok…back on track.

Thinking about turtle graphics more and refreshing my memory on it and looking at the parameters / functions that fluidnc supports and I’m wondering if I’d be better off just digging deeper into gcode directly. At least for my own personal itch.

Though it does seem like a simple utility with a easy to learn language would be a nice tool for beginners. Though I also feel like it’s getting close to reinventing the wheel. I suspect an hour or two with google and I’d find someone already created something that does some type of turtle graphics type of approach to creating SVG’s which is 90% of what I’m envisioning…

I home the machine at power on, and then I don’t home the machine at the start of each pattern.

G1 F2000 is what I have in sandify for my starting gcode.

1 Like

Hmm, that’s kind of how I started when I was homing manually. And once Ryan pointed out his homing code I initially planned on setting it up as a macro - but then thought it may be nice to just home before each pattern so I could just plug the machine in and start a pattern.

Over lunch I tried setting it up as a macro instead and something really odd seems to have happened. I didn’t have time to try and figure out what exactly happened but…

I wrote my homing code to a file start.gcode and uploaded it to flash. Then setup a macro for it.

When I hit the macro it seemed to be working correctly - homing Y appeared to work. Then I’m not sure just what happened as I got distracted by one of our dogs and looked away…but it suddenly crashed loudly and far longer than I would have expected. i.e. it didn’t sound like slow homing moves it sounded more like a full speed move. I stopped it and then moved the machine in +Y figured I’d try again and pay closer attention.

But instead of moving in +Y it moved in +Y and +X. Hmmm…I ran a few other jogs and both +X and +Y moves give me diagonal + and both negatives give me diagonal negative. I’m assuming one motor isn’t moving now for some reason. I did a reset on the board…and it’s still doing the same thing.

Sigh…looks like I’ve got some investigating to do this evening now! And here I thought I finally had it working how I wanted and just setting up a homing macro would be a quick and straighforward way to finish the setup.

Logo was something I also used in elementary school. Our assignment was to make a game. i made a pistol the user moved left and right with the arrow keys that shot a giant bullet at something flying across the screen… kind of like space invaders but only one of each and it was all done in logo. pen up, pen down, etc… I just recently used the python turtle library a month or so ago and it is just like logo. It worked well as a visualizer for a path before generating gcode. My python-fu isn’t up to snuff to integrate it all into a single window gui so it has to pop up a window to show the path. Using turtle/logo for a small robot would be pretty easy to use once the functions worked correctly. I wonder if we could hack the vacuum and make it be the turtle and have it draw designs in the yard or drag chalk on the driveway.

I’m watching this build with interest. My zen table is sitting here, but there are half a dozen other projects in front if it.

1 Like

Took a night off and didn’t even try to figure out what caused the oddness at lunch yesterday.

Plugged it in this morning…and it seemed to be moving normally. Ran the homing macro and it seemed to home perfectly with no crashing.

Fired up sandify and cranked out a quick test design and it ran perfect:

Well, other than the F getting a tail that makes it look like an E. But not bad for my first time trying the text tool.

Guess now I have no excuse left not to finish cutting a frame and installing some topper glass.

4 Likes

Also - did a quick google and as I suspected I found a couple of options for already existing ways to use turtle graphics to draw in a browser.

https://turtletoy.net/ Lets you use JS to do turtle graphics and people have done some pretty impressive things with it.

I also found a couple of tips on simple JS code to do turtle style graphics and generate SVG’s.

What I didn’t realize though was that sandify doesn’t import SVG (for some reason I thought it did) :frowning: And the generated SVGs use polylines which jscut.org won’t accept.

But…svg2gcode will quickly and easily convert turtletoy’s output to gcode which sandify will happily read in.

So I’ve got a bit of a workflow that will let me use turtle style graphics commands to generate designs :smiley:

1 Like

Alright - lunch was good today. Homing with the macro worked and my test of the Turtle workflow worked perfectly:

I didn’t save the project on turtletoy…it just just their simple star sample with a loop around it to redraw it offset from itself a few times. Saved as .svg, then used svg2gcode to convert to gcode and loaded as a layer into sandify. The rest was just a 6mm 45degree line wipe, then a 6mm spiral wipe with a mask on top, and finally the gcode from turtletoy.

Now I’ll just have to spend some more time in turtletoy seeing if I can come up with anything that makes an interesting pattern :smiley:

2 Likes

It can export to svg. But SVG standard is huge. I could import some of it. But I haven’t tried to tackle it.

1 Like

Sunday I fired up the LR4 and finally made a top-frame for the prototype table:

Of course I screwed up again. The first attempt I sized the frame to the piece of glass I bought…and it almost worked. But the inside pocket cuts were very slightly undersized so the glass didn’t quite fit. The glass wasn’t really the right size for my table but I was trying to rush and my glass cutters were still at my old house so I sized to the glass instead of to the table.

But since then I brought my glass tools over to the new house so I figured I can cut the glass down to size now and should design it to fix the actual “drawing area” instead of designing to fit the glass.

I also added some rounded corners just because I could. I was going to try and engrave a decorative bead into the top as well…but decided not to push my luck as I really wanted to bring the table into work this week and didn’t want to do that without glass over it.

The problem is I didn’t bother to check the dimensions of the glass this time. The first time I was worried that the X axis was a little tight but that was a few weeks ago so I forgot about that. As a result my glass is slightly too narrow. It still protects things enough that I felt ok bringing it to work…but looks like I’ll have to pickup a larger piece of glass to do it “right”.

The office was excited to see it - but disappointed that it was a static display as I wasn’t able to get wifi to connect. And the only USB-C cables I found around the office were power only so I couldn’t connect over USB to fix the wifi issue. Until I remembered that I had a USB-C cable in my car…which had a plug that didn’t fit into the opening in my case…sigh. And the plug had a hard metal case on it so I couldn’t just carve it down…double sigh.

But - I had brought a bag of tools in since I had to figure out what happened to the office pinball machine (bad news there…the 5v rail on the MPU board is reading 24v so something has failed quite spectacularly and probably destroyed every IC on the early 80’s era PCB which is really tricked to do rework on…that’s going to make for some frustrating evenings.) The toolbag included a nice sharp knife and some snips which I was about to use to mangle the opening allowing the USB to fit.

Turns out when I initially updated the WIFI settings I messed up and changed the AP settings instead - got those sorted out and we were finally able to enjoy a bit of zen table action for the afternoon :smiley:

6 Likes