Posts by cybervegan@autistics.life
 (DIR) Post #ApqNtv37x8SzxJHqm8 by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @inkscape I'm writing an Inkscape extension using Python Inkex, and I need to know if the contour of two vectors overlap. I'm very much a beginner with Inkex, so I've been using the bounding boxes so far, and it works after a fashion, but of course this produces weird results when a smaller shape is within the bounding-box of a larger shape, but they don't actually overlap. So I need to work out if they really DO overlap, so I can then deal with them appropriately. Can anyone tell me if it's possible to either ascertain if two vectors overlap via the API, or short of that, how to get a raster of pixels of a vector rendered (at any resolution) so I can convert that to a set, and can then check for intersection? Sorry, I don't even know if this question makes sense, so for context, I'm trying to change the z-order of shapes that are enclosed by larger shapes so that they are lower than the enclosing shape(s), because I use Inkscape to design SVGs for #LaserCutting, and you need to cut internal vectors before their enclosing vectors. Lasers on laser cutters have a focal length, and you have to set the focus before you cut; when the laser has completed a closed cut,  the material is apt to drop down by a few millimetres, and the laser is then no longer focused properly on it, so any internal vectors cut after this has happened will be out of focus and may not cut through properly.
       
 (DIR) Post #ApqNtwU6cJdoPGuuSu by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @inkscape Update 2. I have a very simple working POC that can determine if two SVGs with the same co-ordinate systems contain shapes that overlap! It takes a fair bit of image twiddling, but it works on my test cases!I've ended up using svglib and reportlab to create bitmaps out of the SVGs, and then Pillow to massage them down to monochrome and then AND the bitmaps together; I can then tell from the histogram I produce whether the images have any overlapping regions - the resulting image contains NO foreground colours if there was no overlap.Now I need to streamline that a fair bit - mainly by removing the file I/O, and then work out how to make use of it in my existing Inkscape plugin. The main challenge there will be working out how to split the selected objects into separate SVG documents with the same co-ordinate systems as the original. Also hoping to be able to avoid some of the image processing currently involved in getting the colour palette to white on black, by changing that on the SVG docs using the Inkex API.
       
 (DIR) Post #Aq2qa4Lusq4RaITv2e by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @inkscape Update 3. Inkscape shell mode is a bit weird, but I've figured out enough to test for overlap: the "path-intersection" action will leave the inner object if it is enclosed by a larger one, or a new object if they only partially overlap. The weird bit is all of the state management you have to do to be able to repeat this test for n objects. Well, I've cracked that: it's essentially:select-by-id:obj1,obj2duplicatepath-intersectionselect-listselect-clearYou have to duplicate the objects because the path-intersection operation is destructive, and if you want to test obj1 or obj2 against another object, you need to save it. select-list will show you the object(s) remaining after the path-intersection operation - one (or more) object means they intersected; nothing listed means not intersection. I use select-clear to get a clean slate for the next comparison.Around this, I've built another Python POC that uses Inkscape shell mode via a subprocess, and parses the output to ascertain overlap status. It uses a totally naive approach at the moment where it simply checks every object against every other object (twice, because it will test obja,objb and objb,obja because I CBA to make it smarter), and although it works, it chokes (i.e. never completes) on SVGs of 300+ objects. This shouldn't be a problem when I add this into the Inkscape plugin, as that already knows which objects *might* be overlapping (because it has compared their bounding boxes) so I can dramatically reduce the number of tests, and of course avoid doing all checks twice.Shell mode works, but API calls would be better, and more efficient, as I wouldn't have to create a script and parse the response. But if this is all we've got, it'll do.
       
 (DIR) Post #Aq300yEgdFio1K0CTg by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @inkscape To an extent, yes. I've looked at the Pathops code, and the way it re-entrantly calls Inkscape shell to delegate operations to it inspired my current approach. I'm producing a script to test for all of the overlaps I need to resolve, and I'm then parsing the responses to answer the questions I need answered. I'm nearly there now with a more solid POC, but I'm sure it can be improved.
       
 (DIR) Post #Aq7XO9hIG7zXLasyQK by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @inkscape Update 4. It's now working properly: it always places enclosed shapes - defined by the enclosed shape's contour being within the continuous contour of the enclosing shape - lower in z-order than their enclosing shape; it also orders multiple contained shapes by proximity, recursively, in an attempt to minimise laser head zig-zagging. I now need to tidy it up and refactor it, and remove all of the debugging output!It calls inkscape in shell mode to determine the contour overlaps (builds a script, pipes it into Inkscape, then parses the output). Inkscape is only called in this way ONCE per invocation of the plugin.Thanks for all the valuable pointers - it all helped.
       
 (DIR) Post #ArFbYzB43XiNGpV5rU by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @davidrevoy Erasure is just one little thing at a time...
       
 (DIR) Post #AvdOS2vMr6YIGhdl9U by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @TerryHancock @neil All it takes is a dynamic DNS service and a client on your computer the updates your router's dynamic IP address to their DNS system's API. Both free and paid options available. I use the free Dynu offering.I used to run on VPSs, but that's *literally* "someone else's computer". My website used to run on an RPi 4, but I eventually migrated it to sit on my NAS server because it's one less computer to keep updated, and one less power socket constantly in use.
       
 (DIR) Post #AzGR63jeVNTEDOptK4 by cybervegan@autistics.life
       0 likes, 1 repeats
       
       @welshpixie We already are. Lots of #RepairCafes and #MakerSpaces are offering services just like this, including me, via Telford Repair Cafe where I volunteer. I'm also offering a pilot service via Freegle (a UK-only Freecycle platform) and have someone dropping a laptop off in an hour or so to #GetLinuxed! For the Repair Cafe, we have to work out policies, procedures and how the service will work formally - planning to have a meeting with TRC chair next week to run through things. I'm currently in the middle of putting together how-tos on saving files to USB and migrating browser favourites and passwords. If all goes well, we will go live with the RC service in November. I love the #GetLinuxed hashtag idea, however, I fear we are largely preaching to the choir on Mastodon at least. Definitely need people on *other* social media to promote this tag. Will definitely mention it at the meeting next week.
       
 (DIR) Post #AzIPEoH9XetTHXTDrk by cybervegan@autistics.life
       0 likes, 0 repeats
       
       @welshpixie Beautiful. Poisonous though. Did you find any Amethyst Deceivers?