Affinity Designer and rectangles

That’s what I was thinking. We can do it in Illustrator or Inkscape, just wasn’t familiar with Affinity.

Affinity mostly works the same as Illustrator and Inkscape… just with a lot of bits not finished yet. (But they’ve been adding missing features pretty quickly.)

1 Like

No, the opposite. The centered option (first button) has and will export to One True Path with parameters. The other two will look like there is one path with a stroke to one side, but on export will turn into a dual compound path.

2 Likes

Yep. Affinity Designer effectively performs an implicit “Expand Stroke” when exporting such strokes to SVG. Perhaps SVG doesn’t have any built-in way to represent such strokes. (I’ve never looked at that particular portion of the SVG spec.)

I get that the centered option exports just a single path*, but the stroke is offset to both sides of that path. Aligning inside or outside only offsets in one direction, right?

*with that option you’d have to manually choose to convert strokes to paths, that’s why I said…

Yes, exactly.

With centered the (infinitely thin) path is in the center, so the edges of the actual stroke are offset inside and out. (This is how most graphics software draws strokes by default.) The other two use the path for one of the edges, then only synthesize the opposite edge.

Since the centered options is how strokes normally work, that’s easy to export to SVG. If SVG doesn’t have the other options (I haven’t checked yet) then expanding the stroke to a filled object would be the only way to represent it in SVG. Or if SVG supported it but most implementations didn’t, then the makers of AD might have chosen to export as filled shapes for compatibility. (I really should go dig into the spec!)

Ok, it looks like there’s a draft version of a “stroke-alignment” property for SVG that would do what Affinity needs for its stroke alignment options. But it’s only a draft… they’re still working out some issues. So it will be a few years until it’s usable. So Affinity Designer can’t use it for SVG export yet. (If ever. It sounds like there’s some pushback to adding these features to SVG.)

Yes, I understand what is happening, I’m discussing and focusing on how it can be leveraged to perform kerf compensation.

How many religions have started with that as a basis ?
< :upside_down_face: >

5 Likes

I understand that. See my example above of actually carrying out the steps in AD to do so.

It just made me curious as to why AD was exporting SVG in the way they do, so I went and dug into it. And it turns out they’re doing things that SVG can’t (yet) do.

1 Like

That is a nicely prepared image, much better than the one I posted, but I do have a slight issue with it. The second box has been aligned to outside - this step is unnecessary and detrimental to achieving true two-direction kerf compensation. At least, that is my understanding. Perhaps I can explain?

Let’s start with a simple shape - a circle. If we draw a circle with no stroke and no fill in Illustrator (or Illustrator-ish software) and give it a diameter of 20.0mm, the path representing this circle will have a diameter of 20.0mm. I’m willing to bet we agree on this point, at the very least.

This circular path will have a radius of 10.0mm. (I’m briefly changing this to a radius, for clarity.)

OK, let’s apply a solid black stroke to the circular path with a width of 0.2mm (let’s say this is our laser’s kerf width). When we do this the outer radius of the stroke will be 10.1mm (it will increase by 1/2 the stroke width) and the inner radius of the stroke will be 9.9mm (it will decrease by 1/2 the stroke width). The radius of the path, which is basically imaginary and has no thickness, remains at 10.0mm. I can’t imagine we could possibly disagree here either.

The stroke will have an outer diameter of 20.2mm and an inner diameter of 19.8mm. (OK, back to diameters.)

OK, cool.

Now, if we change the stroke so that it is “aligned to the outside”, both the inner and outer diameters of the stroke will increase in size while the path remains unchanged. The OD of the stroke will become 20.4mm and the ID of the stroke will become 20.0mm. This is the step that hurts kerf compensation. The ID of the stroke is NOW equivalent to the diameter of the circular path. I think this is where we may be diverging in opinion, so I’ll lay out my case…

If we convert strokes to paths we’ll convert the outer diameter and inner diameter of the stroke to two new circular paths. If we export the result of that conversion to an SVG, the SVG will have two paths, one with a diameter of 20.4mm and one with a diameter of 20.0mm.

We never said what the circle was.

If the 20mm circle is a necklace pendant, that “align to outside” step was ALMOST useful, in that it did give us a second path that was offset to the outside of our original 20.0mm circle. Unfortunately though, the diameter of that offset path is 20.4mm, 0.2mm larger than it needs to be. The other path, the 20.0mm one, is too small.

If the 20.0mm circle is supposed to be a 20.0mm hole, that “align to outside” step did nothing for us. We have a 20.0mm circle and a 20.4mm circle, both of which are too large if we want the hole to be exactly 20.0mm in diameter. If we had done an “align to inside” it would have brought the OD down to 20.0mm, which I’ve already established is too large, and the ID would be 19.6mm, which is too small. Doing the “align to inside” step did nothing for us either.

Of course, we could have made the stroke width 0.1mm instead, that would have made the OD of the pendent correct (while leaving the ID useless) or it would have made the ID of the hole correct (while leaving the OD useless).

Better yet, we could leave the stroke width at 0.2mm (which we’re calling the laser’s kerf width for this example), leave the stroke aligned to center, and just performe a stroke to path command before exporting the SVG. That SVG would have two circles, one with a diameter of 19.8mm, perfect for cutting out 20.0mm holes and one with a diameter of 20.2mm, perfect for cutting out 20.0mm pendents. Using the technique you showed in your image we can (somewhat-) quickly get rid of all the lines we don’t want and use the remaining kerf corrected lines to cut out some accurately-sized parts.

Sorry to get all wordy, my first post on this subject did make an attempt at brevity.

TL:DR…

3 Likes

I haven’t actually put any thought into which path I’d want to cut for kerf compensation… I was just trying to carry out the steps that @Jules had outlined.

But yes, I believe you’re right.

1 Like

Two ways of doing it. One is to offset the original center line (single) path of the stroke by half the kerf. (And delete the original line.)

Another way is to set the width of the original stroke to be equal to the kerf, then when the stroke is expanded, you wind up with two paths at the outside of what was the original centerline path, exactly half a kerf away in distance.

Delete one of them, and you are left with a path exactly half a kerf away from the original centerline. This laser always follows the centerline of the path that it sees. (Which might be what everyone is overlooking…I don’t know if that’s the same on other lasers.) So at that point, it doesn’t matter where you set the stroke, the laser is going to follow the centerline of that one path that it sees, which happens to be exactly half a kerf away from where it was initially.

The important part is to remember to delete one of the lines if you do it that way. Or you can just use a half a kerf distance offset on a single path.

Does that clear anything up, or make it worse?

1 Like

Your writeup is correct. Also, see the tutorial here.

1 Like

So… not the oppisite?

I was just getting tripped up by your use of the word “path,” which has a specific technical meaning. What you meant is correct.

I was referring to the result post export. And yes, post stroke to path.

Isn’t that the FOUNDATION of this topic?

Oh, okay, then you were absolutely correct.

Wait. I’ve recently moved to Affinity Designer (and JUST got my Glowforge like 2 days ago.)

I’ve just been exporting my vectors as pdf. (No problem.) I totally forgot about svg.

Should I be doing svg instead?

PDF works too. Just depends on what you’re comfortable with. :grinning:

1 Like