Understanding the Path Mode of Inkscape

This blog is an inkscape note, I will talk about my inkscape experience to laser cutting last week. which will cover the understanding of “object to path” and “stroke to path”. And an answer to the fantastic long-run trouble about the missing lxml when using extensions.

1. Understanding “Object To Path”

1.1 Probelm 1:

After Marcel told me about boxes.py to generate the initial box files and apply modification on it. It seemed easy. We brought it to the laser cutter. It doesn’t work. orz. Paul helped to change the parameters for a great while. It still doesn’t work. orz

1.2 Quick Answer:

Applying “Object to Path”

1.3 Detailed Answer:

When I was standing there, I already knew that I messed up the ideas of an Object and a Path in inkscape. The requirement of “being understanding” is not only thinking from another human, such a beginning level, isn’t it. It seems like thinking from the perspective of a program is what all the mammals need to reach. lol

placeholder

Now, this is what inkscape looks at an object, it is a rectangle (with a very round corner though). two nodes (right up corner, left down corner) and one sliding bar (rad of the corner) define the object, I can change them to make a different shape rectangle, but i can’t go beyond a doomed rectangle. This is an Object.

save it as .svg file. this is what I get in the file:

<rect
 style=”opacity:0.67099998;fill:#ff6200;fill-opacity:1;fill-rule:nonzero;stroke:#ffe000;stroke-width:0.69999999;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
 id=”rect5971"
 width=”20.788691"
 height=”19.938244"
 x=”18.993303"
 y=”112.16964"
 ry=”9.9691219" 
/>

No wonder that I failed, I gave this to a laser cutter and expected it to go along the vector which was not there. I didn’t stand a chance.

Now applying “Object to Path”

placeholder

more nodes appear, suddenly we can change it into any shape we want. Not necessary to be a rectangle. The way inkscape looks at it changed.

placeholder

save the path as .svg file. this is what I get, a path indicates the laser cutter to go along:

<path
 style=”opacity:0.67099998;fill:#ff6200;fill-opacity:1;fill-rule:nonzero;stroke:#ffe000;stroke-width:0.69999999;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
 d=”m 28.962425,112.16964 h 0.850447 c 5.522893,0 9.969122,4.44623 9.969122,9.96912 0,5.5229 -4.446229,9.96912 -9.969122,9.96912 h -0.850447 c -5.522893,0 -9.969122,-4.44622 -9.969122,-9.96912 0,-5.52289 4.446229,-9.96912 9.969122,-9.96912 z”
 id=”rect5971" 
/>

while I thought there would be no more trouble, I got another failure.

2. Understanding “Stroke To Path”

2.1 Problem 2:

Finally the laser cutter started to work, but it cut multiple times at the same path.

2.2 Quick Answer:

Being careful with “Stroke to Path”

2.3 Detailed Answer:

When I saw the way the laser cutter moved, it made me think that duplicated paths share the same places so it went over and over again. I made great great effort to try to get rid of the redundant lines, combined nodes. All didn’t work. I started to think maybe they were not overlapped. they were different paths just very close. I made a great close-up. That was really the reason. It came from when a stroke was set with a thickness, and after I applying “stroke to path”, paths along the edges of the original stroke were created.

before “Stroke to Path”, our path is like a single closed line (see the red thin line)

placeholder

after “Stroke to Path”, our path became the edges of the original stroke, they are two closed lines.

placeholder

That is why the laser cutter went through the same (but actually not exactly) path multiple times.

3. Extensions TroubleShooting:

3.1 Problem 3:

When I tried to use Customized Extensions. I kept get missing lxml module error.

3.2 Quick Answer:

Check your python path

3.3 Detailed Answer:

This is such a pain. Because import lxml works just fine. I had no clue why it came along.

All I found is saying that it was a long-term bug.

I took it for granted for days as an inkscape bug. I can do nothing about it. Stop being understanding. Until the day I became A Dude Who Thinks from The Prespective of Inkscape. Yeappy, pay attention when you have the same problem, especially when you are using virtual environment.

when I work on tensorflow, I realize that I am running the python of anaconda. All the library I installed goes to anaconda’s python. What if inkscape is told to use the default native python, of course it will complain, there is no lxml library there. I have to tell inkscape to use that anaconda’s python.

goto your ${HOME}/.config/inkscape/preferences.xml

find the group tag with

id=”extensions”

add one line:

python-interpreter=”${HOME}/miniconda2/bin/python”

the problem is suddenly fixed.

4. Other small Notes

when using inkscape for lasercutting:

placeholder

[END]