Straight line with exact distance between nodes

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
User avatar
ybaril
Posts: 2
Joined: Fri Feb 26, 2010 6:05 am

Straight line with exact distance between nodes

Postby ybaril » Fri Feb 26, 2010 7:14 am

I'm producing technical like drawing with Inkscape and i have the following problem.

If:
1) i draw a Straight horizontal line with :tool_pen: tool
2) the indicated wide is shown as 245.432 mm
3) i change is length by modifying is wide in the tool's control pallet (ex : 200 mm)
4) the new wide will be 200.323 mm and not 200 mm
5) i change is length to 200 mm again
6) the new distance will be 200.002 mm as if it converge to the desired value.
7) i change the line X position to 20 mm.
8) i take the :tool_node: tool to get the nodes' position and left node supposed to be at 20 mm is at 20.501and the right node supposed to be at 220 mm (200+20) is at 219.501 so the total distance between nodes is 199 mm and not 200 mm
9) also my selection box appear to be a bit wider than my line (i presume 0.501 mm wider (199+ 2x0.501 = 200.2)).

If a do the same modification to a shape like :tool_ellipse: or :tool_rectangle: and convert them to path to obtain the nodes' position they are at the desired position.

Why this phenomenon appear ?
Is their a way to force the exact distance between two nodes of a straight line in any direction?

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Straight line with exact distance between nodes

Postby prkos » Fri Feb 26, 2010 7:58 am

There are some rounding issues, I think it's been reported in the bug tracker.
https://bugs.launchpad.net/inkscape/+bug/168002
https://bugs.launchpad.net/inkscape/+bug/210145
Try increasing the precision in Inkscape preferences.

Have you tried using grid and snapping to grid? I think that way you get very exact measurements.
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

User avatar
Kjohrf
Posts: 170
Joined: Tue Oct 27, 2009 11:42 am
Location: US
Contact:

Re: Straight line with exact distance between nodes

Postby Kjohrf » Fri Feb 26, 2010 2:56 pm

prkos wrote:There are some rounding issues, I think it's been reported in the bug tracker.
https://bugs.launchpad.net/inkscape/+bug/168002
https://bugs.launchpad.net/inkscape/+bug/210145
Try increasing the precision in Inkscape preferences.

Have you tried using grid and snapping to grid? I think that way you get very exact measurements.


I run into this all the time, and have probably barked about it on the bug reports.
I've always guessed that it has to do with adjusting the stroke width (a feature I turn off,
and still have this bug) when the item is resized.

User avatar
ybaril
Posts: 2
Joined: Fri Feb 26, 2010 6:05 am

Re: Straight line with exact distance between nodes

Postby ybaril » Sat Feb 27, 2010 4:04 am

thank's for the fast responce

I did more tests and it appear that the differance between the indicated lenght of the stroke and the distance between nodes is equal to the width of the line even with straight ending.

I'm not sure that my observation is due to a rounding effect as related in referenced issue, the diference between the desired value and the obtained value is more than an effect on the forth decimal as for rectangular shape.

the prescision is set to 8 far over the 1 i have got.

cipnrkorvo
Posts: 1
Joined: Thu Dec 01, 2011 5:18 am

Re: Straight line with exact distance between nodes

Postby cipnrkorvo » Thu Dec 01, 2011 5:24 am

I've seen posts from 2005 with this exact same problem
(and I remember when I was small and trying out Inkscape, re-entering the value 25.0, and it changed to 25.05, and I put in 25.0 again, and it went to 20.3, and I said "NO, Inkscape, not 25.05, I want 20.0!) :x
Can't anyone do anything about it??
(or tell us what we're doing wrong. please! this makes inkscape useless for me right now!)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Straight line with exact distance between nodes

Postby brynn » Fri Dec 02, 2011 12:40 am

Welcome to the forum!

I don't understand which values you're talking about. And since the original message is so old, I can't ask the original poster. So it would be helpful if you could be more clear. Are you talking about stroke widths, line lengths, object dimensions?

Also, you have a current version of Inkscape, right?

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Straight line with exact distance between nodes

Postby druban » Fri Dec 02, 2011 5:27 am

brynn wrote:I don't understand which values you're talking about. Are you talking about stroke widths, line lengths, object dimensions?


Draw an object. switch to the :tool_selector: . The control bar shows numeric fields for object position, width, and height. Try to change the dimensions of the object not by on-canvas manipulation but by entering an exact number in one of the fields. As you type the number it is correct but as soon as you hit enter or switch to another field the number will be changed to something of Inkscape's choosing, usually off by several hundredths.

This behaviour is not always replicable, and I can't tell what sets it off. I have a theory that an object that has a transform may be more susceptible, I am checking it out.

Meanwhile, an invisible pixel or half pixel grid with snapping enabled helps when editing on canvas but it's not always convenient...
Your mind is what you think it is.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Straight line with exact distance between nodes

Postby brynn » Fri Dec 02, 2011 5:41 am

Oh, hi druban :D
If that's what cipnrkorvo is talking about, then I would make sure he/she has the option to scale strokes deselected. But the original message is confusing, so I just wanted to be sure, before trying to make a reply.

I can't reproduce what you describe, with 0.48.1 on Win7, 64-bit. (using a Rectangle shape) Whatever number I enter, it stays that way. Unless I select the option to scale stroke width.

But something tells me I don't have a complete understanding of the problem. (usually weird things happen to me and no one else, not vice versa, lol)

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Straight line with exact distance between nodes

Postby druban » Fri Dec 02, 2011 7:37 am

I think you are right, Brynn, the stroke width might have something to do with it, as well as the preference to use geometric or visual bounding box - I think I found one to be more precise and the other to be more convenient so - flipping back and forth... But in that case it may not be a bug at all, just more information than I can process with a single core brain!
Your mind is what you think it is.

User avatar
LiquidAsh
Posts: 71
Joined: Fri Apr 22, 2011 11:35 pm
Contact:

Re: Straight line with exact distance between nodes

Postby LiquidAsh » Fri Dec 02, 2011 8:52 am

I've experienced this both with and without stroke scaling enabled (drawing a line with the pen tool and a thick stroke width, and then changing the width). It's certainly better with the stroke scaling enabled, but not completely gone. I believe that the reason has to do with strokes being centered on their paths. My solution has been to generally avoid stroked paths for visuals. If I want the appearance of that kind of outline, I generally use the Path > Convert Stroke to Path to avoid the kind of scaling issues described above.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Mon Aug 12, 2013 6:49 am

Hi,


I'm bumping this thread because I have the issue OP was describing. When I draw a line and I want to make it exactly (for example) 100 pixels long, I try and type 100 in the box at the top of the interface. However, the line will be e.g. 100.547 pixels long. I have to repeate typing 100 3 times to make sure the line is exactly 100,000 pixels long.
Also, when I changed the line width from 0,200 or something (the default value) to 1 on my entire drawing, all the lines became just a little longer all of a sudden.
This is rather annoying since I'm drawing plans of a house. I'm working in cm (to draw on a scale of 1/10) and it's not a super big issue (the second one) but still, it should not happen.

Scale stroke width is disabled btw.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Straight line with exact distance between nodes

Postby Lazur » Wed Aug 14, 2013 10:59 pm

Or set no strokes to the paths for the editing only fills or even switch to outlines only display mode too to see those paths.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Sat Aug 17, 2013 6:59 am

Pilosopong Tasyo wrote:In your Inkscape Preferences window, open the Tools category. The bounding box may have been set to use visual instead of geometric. Choose the latter.

It was indeed set to visual. Changed it. However, now I can't change the length at all. Only with the arrows that appear when I select the line, but not by typing numbers in the boxes on the interface top left.


Lazur URH wrote:Or set no strokes to the paths for the editing only fills or even switch to outlines only display mode too to see those paths.

I didn't understand that. At all.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Mon Aug 19, 2013 5:16 am

Thanks for the reply. But when I set a line to no stroke and full with black, it disappears.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Straight line with exact distance between nodes

Postby Lazur » Mon Aug 19, 2013 5:46 am

Thus you would need to change the display mode to outlines only.
Also if you type in the coordinate values instead of the lengths, you will get a better result.
I'm using inkscape for architectural drawings sometimes, and it's not an easy one.
Inaccuracy appears time to time, mostly when you use a boolean on two paths,
so the given coordinates are changing each time, with about 0,001-0,003 values.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Mon Aug 19, 2013 6:07 am

Lazur URH wrote:Thus you would need to change the display mode to outlines only.
Also if you type in the coordinate values instead of the lengths, you will get a better result.
I'm using inkscape for architectural drawings sometimes, and it's not an easy one.
Inaccuracy appears time to time, mostly when you use a boolean on two paths,
so the given coordinates are changing each time, with about 0,001-0,003 values.


Woops I didn't see the 'view' part there. I changed it now and yes that works, but what will my drawing look like when I print it? Guess there's only one way to find out.

Inkscape is pissing me off at the moment btw. I'm doing architectural drawing like you, and did a drawing of a bathroom, and somehow I end up with 2 lines that don't come together perfectly. in scale there is about 1 or 2 cm of space where they should meet. All lines are proper length and all lines are connected too. I don't get why this program has so much trouble with such basic drawing at all. This is so much easier in Illustrator, and particularly Flash (which has the best drawing options/tools of any software I've ever used imo). Unfortunately those are too expensive for one time use.
What do you mean with the 'mostly when you use a boolean on two paths'? Not sure what a boolean is. Google isn't helping either. Maybe it's my very basic understanding of programming but I don't understand how these inaccuracies can happen in a pc.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Straight line with exact distance between nodes

Postby Lazur » Mon Aug 19, 2013 6:18 am

To make the file print-ready you should add the stroke, after each node is in place.
It was just a workaround for the basic problem.

Boolean refers to adding, subtracting, intersecting paths.
I'm too much into details but can't think a situation where the inaccuracy would be that much in a simple design.
Could you post that part here somewhere?
There are more ways to draw the same thing, inkscape offers many tools for different approaches.

Off topic:
Different programs, different issues.
Autocad pissed me off of it's solid modelling (in)ability.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Mon Aug 19, 2013 6:39 am

Lazur URH wrote:To make the file print-ready you should add the stroke, after each node is in place.
It was just a workaround for the basic problem.

Boolean refers to adding, subtracting, intersecting paths.
I'm too much into details but can't think a situation where the inaccuracy would be that much in a simple design.
Could you post that part here somewhere?
There are more ways to draw the same thing, inkscape offers many tools for different approaches.

Off topic:
Different programs, different issues.
Autocad pissed me off of it's solid modelling (in)ability.


Ok I have no idea what that 1st sentence means. A node is a point right? 2 nodes make a line, no? But how would I set 1 node and say what other nodes should be connected to them? Actually, just setting nodes and then telling what node to connect where would be far easier I think. Yes, it takes more concentration, but it would be exact. My plan doesn't have to be exact, but still, I don't want gaps in my drawings.
I've made a screenshot and put it up on Dropbox.
Are there any other ways than just using straight lines to make a floor plan?

Btw, something I noticed too: when I connect the 2 small vertical lines on the left to the small horizontal one, they are exactly 9 pixels apart from eachother (that's what the coördinates show me) despite being connected to a 10 pixel line. I get that they 'overlap' slightly, but the coördinates of the lines should be taken from the center of the line, no? Thickness should not have any influence imo.

https://www.dropbox.com/s/dn575es679m833g/inkscape.jpg

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Straight line with exact distance between nodes

Postby Lazur » Mon Aug 19, 2013 7:26 am

Never mind I have problems to explain things right.
Actually with inkscape you are drawing paths, which are made up of nodes and connecting segments.
The way you draw those is not that effective: you drew paths from two nodes, with the pen tool, for each line?
Seems so.

Some suggestions which can improve your workflow:
Open the document's properties panel (Shift+Ctrl+D) and set the basic unit to mm.
However inkscape works at 90 dpi, it's far easier to work with only one unit.
Also setting up a grid with a 1 mm dimension, and setting automatic snapping to that grid in that panel can be handy.

For the actual drawing, it's a bit more complicated, as there are more ways.
Here is an example how I would draw that:
https://dl.dropbox.com/s/meuj0ihyjl9137d/hlp68.svg

Used the pen tool to draw the filled shape -!as a closed path!-, with snapping the nodes to the right gridpoints.
Without a grid, after placing them around as a sketch,
with the node editor tool each node's coordinates can be given.
When you select a node, you can type in it's position in mm.

The fill is separated from the outlines.
Used one filled path with no stroke for the "fill object", and one without any fill but a stroke given on top of it for an "outline object".
That "outline" path was drawn by duplicating the filled one (Shift+Ctrl+D),
and changed it's fill at the fill and stroke panel (Ctrl+Shift+F),
then drew some more lines with the pen tool and combined them together (Ctrl+K, when both selected).

User avatar
flamingolady
Posts: 687
Joined: Wed Jun 10, 2009 1:40 pm

Re: Straight line with exact distance between nodes

Postby flamingolady » Mon Aug 19, 2013 1:41 pm

Just to add my 2 cents worth. That issue bugs the beegeezers out of me too.
When I need things to be exact, I draw the line and have no stroke. When using a filled object, I do what Lazur said, have one object that is filled with no stroke, and one that is only stroke and no fill. What a waste of time though right? I thought that locking the coordinates in at the top (clicking on the lock) would keep it all intact, but that didn't seem to make a difference, ugh. Good thing I'm an artist and not an architect or the lack of perfection thing would drive me insane, lol.

Muscleduck
Posts: 6
Joined: Mon Aug 12, 2013 6:43 am

Re: Straight line with exact distance between nodes

Postby Muscleduck » Fri Aug 23, 2013 4:53 am

Lazur URH wrote:Never mind I have problems to explain things right.
Actually with inkscape you are drawing paths, which are made up of nodes and connecting segments.
The way you draw those is not that effective: you drew paths from two nodes, with the pen tool, for each line?
Seems so.

Some suggestions which can improve your workflow:
Open the document's properties panel (Shift+Ctrl+D) and set the basic unit to mm.
However inkscape works at 90 dpi, it's far easier to work with only one unit.
Also setting up a grid with a 1 mm dimension, and setting automatic snapping to that grid in that panel can be handy.

For the actual drawing, it's a bit more complicated, as there are more ways.
Here is an example how I would draw that:
https://dl.dropbox.com/s/meuj0ihyjl9137d/hlp68.svg

Used the pen tool to draw the filled shape -!as a closed path!-, with snapping the nodes to the right gridpoints.
Without a grid, after placing them around as a sketch,
with the node editor tool each node's coordinates can be given.
When you select a node, you can type in it's position in mm.

The fill is separated from the outlines.
Used one filled path with no stroke for the "fill object", and one without any fill but a stroke given on top of it for an "outline object".
That "outline" path was drawn by duplicating the filled one (Shift+Ctrl+D),
and changed it's fill at the fill and stroke panel (Ctrl+Shift+F),
then drew some more lines with the pen tool and combined them together (Ctrl+K, when both selected).


I always use the pen tool to draw a random line, then make it the length I need. SOmetimes I just tame a random line from my drawing, duplicate it, and then fix the length.
Basic unit was already set to mm. I actually started my drawing again a while back to do this.
The grid idea is excellent, I'll try that for sure.
Making an object in 1 closed path seems a bit hard I think but I'll try it. It would be great if I could just snap lines together to make them an object, where the point where they snap can be moved. Like what you are saying, but with each line drawn individually.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Straight line with exact distance between nodes

Postby Lazur » Fri Aug 23, 2013 5:32 am

That can be done by combining the individual paths to a compound path (Ctrl+K), or by grouping them together (Ctrl+G).
But doing that won't result in a closed path, that you can add a solid fill.

There are several snapping options, like snapping nodes to cusp nodes,
at the snap controls bar, marked here with 3.:
Image

If you draw each path segments as a new object, you need to adjust double number of nodes.
It's much faster if you are not drawing paths with double nodes/segments, and that way you avoid any rednering problems.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Straight line with exact distance between nodes

Postby druban » Fri Aug 23, 2013 12:50 pm

Everyone is free to use the drawing method they are most comfortable with in transferring their concept into a concrete form (digital concrete anyway). So I don't mean this is a criticism, but advice.

Inkscape is developed to simulate drawing of some sort or the other. although many tools have gone far beyond the real world equivalents, there is still a conceptual link. When you say:

Muscleduck wrote:I always use the pen tool to draw a random line, then make it the length I need. SOmetimes I just tame a random line from my drawing, duplicate it, and then fix the length.

this process is pretty unusual. In the real or digital world. Nothing inherently bad or wrong with it, but I hope you can see that it might be difficult to find software designed to emulate it. Imagine if you were making a ink drawing on paper and having to scrape away the ends of your lines every time. And how would you drag a drawn line into place....! A more usual approach would be to pencil in a bunch of lines that can be used to guide the stopping and starting points of your drawn lines. Inkscape offers many guide creation options that do exactly that. Or to use a rough sketch or a source photo to trace over. Inkscape lets you import pictures to use as tracing sources, automatic or manual.

The point of all this blather - and there is one! is that although the capability exists for joining the ends of lines (with the node tool) to form a larger shape (and of course the capability for dragging objects around as well), the Bezier pen is simply designed to draw shapes by moving from one vertex to another until you return to the first one. And other tools like the calligraphic pen won't adapt to your technique at all, cutting you off from a lot of possibilities.

When it comes right down to it, Inkscape is just not designed to be a sketching tool where you work out the ideas before you have a design. To try to use it in that way is likely to be rather frustrating. But character building. So not a total loss.
Your mind is what you think it is.

nicknelson
Posts: 1
Joined: Fri May 20, 2016 11:20 pm

Re: Straight line with exact distance between nodes

Postby nicknelson » Sat May 21, 2016 12:02 am

I think this happens because when you type the length into the box Inkscape accepts this as the distance between nodes and gives you back
the stroke length of the line. These won't be the same unless the node is actually at the end of the stroke.

In Inkscape 0.91 (I don't think it worked in previous versions:

The way I have solved this is to specify the 'butt' type of line cap. You can find this option under:

Object->Fill and Stroke->Stroke Style

I find that it is now possible to type an exact length in one go.

Nick


Return to “Discuss Software Issues”