Hidden Line Removal Test
written by revdancatt
The other day Evil Mad Scientist released the latest update of the AxiDraw tools, going from version 3.8.0 to 3.9.0, this included a Hidden Line Removal feature. Hidden line removal has traditionally been slow, annoying and somewhat tedious to code.
Now it's just slow and mild annoying.
I wanted to test this new feature, the only way I know how, write a tool that spits out thousands of overlapping rectangles. That tool is now on fxhash using params, because this is my new favourite way of releasing SVG generators.
To create an SVG to testing, click the "params" button above, for follow this link: https://www.fxhash.xyz/generative/slug/hidden-line-removal-test-demo-copy/explore-params
REMEMBER: YOU DO NOT NEED TO BUY A MINT, YOU CAN USE THIS TOOL AS-IS FROM THE PARAMS PAGE. YOU ARE NOT SUPPOSED TO BUY IT, JUST USE IT.
The parameters you can change should be fairly-ish-kinda self explanatory, my personal suggestion is to lock all the settings apart from the seed, like this...
...and then hit the randomise button a few times. Then start playing with the width & height and Size Noise before moving onto other things.
Once you have a result that you like hit the "Open in new window" icon in the very bottom-left hand corne...
...this will open your design in a new window, something like this:
The design needs to be opened in a new window, as the project can't accept keyboard input while in the fx(params) iframe preview. Now you have it open you can press a number key 1 to 6, to download an SVG file in sizes A1 to A6 receptively, ie. if you want an A3 design, press the 3 key.
You can also press 's' to download an .png reference image, and 'h' to toggle into high-res mode.
InkScape, or command line tool
Once you have your SVG it's time to open it in InkScape.
First make sure your AxiDraw extensions are up to date, check the installers here: https://wiki.evilmadscientist.com/Axidraw_Software_Installation
If you wish to use the command line tool, the relevant section of the docs is the new --hiding
option: https://axidraw.com/doc/cli_api/#hiding which will turn hiding one.
In InkScape to have a preview of the hidden lines removed, you go to "Extensions > AxiDraw Control..."
Turn "Hidden-line removal" on, the third checkbox down in the Options > Advanced section.
Hit apply, switch back to the "Plot" tab and then hit the Apply button again. The calculations will run to remove the hidden lines and the plot will start. If you want to preview the results of the hidden lines, check the "Preview mode" button.
Removing the hidden lines for around 5,000 lines could take several minutes, up to 8 on my 2020 MacBook Pro M1, and way longer for 10,000!
Once the lines are removed the preview will look something like this, if you turn the main layer so you can see the preview layers.
Because the preview can take a long time, for something like this anyway, it's probably better to just send the thing directly to be plotted.
Another option, is to use the "Save as Copy..." command, and set the format to "AxiDraw Plob", hitting save here will open up a similar dialog to the AxiDraw Control, where you can set a target machine size, optimisation and hidden-line removal.
In this case the hidden lines will be removed and the results saved as a new SVG file, that can then be send to AxiDraw and other pen plotting machines. This way you only need to run line removal once, but plot as many times as you need, even on drawing machines that aren't an AxiDraw.
And that is how, roughly, you can both use the new update from AxiDraw to run hidden line removal on your own projects, and how you can use fxhash as a place to generate SVG files.
You can see it in action in my YouTube video...
And you can follow me on twitter and BlueSky over here.
https://twitter.com/revdancatt
https://staging.bsky.app/profile/revdancatt.com
Or sign up to my newsletter: https://newsletter.revdancatt.com/