Inkscape.org
Beginners' Questions Offset not precise?
  1. #1
    vytis56 vytis56 @vytis56

    Hi, I've just started using Inkscape and currently I'm trying to understand how this offset works here. I am working with milimeters here and made the shape which is 2.5mm in width at the widest part (so basically in the middle). After adding -0.5mm offset I would have expected it to be 1.5mm in width, but it is not the case here. Am I doing it wrong? I've was just interested and tried pretty much the same thing in cad and it was precise there.

    Gap
    After
    Before
  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    Looks like you are using a path as your measuring tool.

    If the path has a stroke, I'd check the stroke "cap" setting in the Fill and Stroke dialog.

  3. #3
    vytis56 vytis56 @vytis56
    *

    Hi. Thanks for the answer. I've checked and no, I don't use the stroke cap.

    If I understand correctly, Inkscape isn't doing the offset geometrically like cad, so what I'm expecting is not possible?

  4. #4
    Aero Aero @Aero◻️

    It's possible by setting more presicion in document properties.
    Sample SVG files attached.
     

    Moreprecision
    Defaultprecision
  5. #5
    vytis56 vytis56 @vytis56

    I've checked your SVGs and I do see the difference. What precision setting are you using? For me it is 8 by default, I use mm, grid step is 0.1mm.

  6. #6
    Aero Aero @Aero◻️

    The difference is in document properties.

    Scale is affecting viewBox. Press the small dot after scale before changing the value in order to keep existing objects the same size.

  7. #7
    vytis56 vytis56 @vytis56

    I tried pressing that small dot, but it didn't change anything for me. Could you try to see if you can just create a rectangle and put and -0.5cm offset on it?

    Just to try this offset stuff further, I have created 2.5cm x 3cm rectangle (switched to bigger units, thought that maybe there is something with millimeters), duplicated it and put -0.5cm offset. I would expect the new rectangle to be 1.5cm x 2cm, but it is 1.498cm x 1.998cm. I have checked the edges and they were exactly 2.5cm and 3cm. Also it works correctly for me when using positive offset.

  8. #8
    Aero Aero @Aero◻️

    Everything works perfectly using the morePrecision.svg I shared earlier.

    Once the desired scale is set you can change the page size as much as you want. Do not change scale again.

  9. #9
    Lazur Lazur @Lazur

    It's in the svg output settings -shift+ctrl+P.

    If you didn't apply those more digits settings then even if you resave a supposedly more precise svg you can end up losing details (and accuracy).

     

    Still, it's not CAD. In inkscape paths are  made of cubic Béziers which by definition don't have parallel curves and cannot be extrapolated so every approach of offsetting a curve cannot be exact, only precise to match the purpose.

    Check out this page for more info on the background:

    https://pomax.github.io/bezierinfo/

     

    Having said that, node placement can be on point and the error gets bigger towards the midpoint of a curved segment.

    So in your case it might help if you added a node before the offsetting where you want to measure.

     

    Another suggestion is scaling up your drawing. 

    If instead of 2.5 mm you are working with 250 mm, the error won't be larger than before

    -thus it'll be much smaller compared to the design.

  10. #10
    Aero Aero @Aero◻️

    Here is a sample file where transforms is used on layers instead of scaling the document itself (viewBox) like before. Notice how transforms on objects with Path effect Offset is preserved when copying then pasting into a new blank document.

    I use the default settings (8, -8) in preferences.

    Transformed Layers