A Dude Who Thinks from The Prespective 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.
Fail 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
Quick Answer: applying “Object to Path”
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
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”
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.
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.
Fail 2: Finally the laser cutter started to work, but it cut multiple times at the same path.
Quick Answer: Being careful with “Stroke to Path”
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)
after “Stroke to Path”, our path became the edges of the original stroke, they are two closed lines.
That is why the laser cutter went through the same (but actually not exactly) path multiple times.
Fail 3: When I tried to use Customized Extensions. I kept get missing lxml module error.
The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml
Technical details: No module named lxml
Quick Answer: Check your python path
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 withid ="extension"
add one line: python-interpreter="${HOME}/miniconda2/bin/python"
the problem is suddenly fixed.
Other small Notes when using inkscape for lasercutting:
- in inkscape, set width of stroke as “0.1mm”, in corelDraw, set as “Hairline”
- two way to engrave, 1) set different colors, one for cutting, one for engrave, and setting cut way as “combine”, because engraving goes like bitmap. 2) make two runs, set less power for engrave part, then it will not able to go through.
- material and parameters: https://hci.rwth-aachen.de/lasercutter
- lasercutter can cut paper
- inkscape extensions having .py and .inx to say where to put it in the menu. they all goes to ${HOME}/.congif/inkscape/extensions, and restart the program. customized font folder in my machine /usr/share/fonts
- making a physical dot on the material along the laser calibration red pot. just in case when the job has to be interrupted. we still have a chance to continue. when the material is not standard size, set the canvas in program as real size to save material. And if still not confident, making power as 0 to see if every thing is in the area or use VisiCut to preview.
- in inkscape, the display unit “mm” is set at File ->Document Properties, select in object mode can change object size.
- one node can only connect to two other nodes. so don’t try to make three connects to a node.
- perfect fitting distance doesn’t make a tight-enough assembly, we used glue. tightness needs offset (e.g. 0.1mm).
- most common used is the sequence of selecting with path mode, then node-selecting or goto selecting mode to move/delete. combine/break apark under path are working on nodes. group/ungroup are working on objects (kinda)
- important generator http://www.instructables.com/id/The-Ultimate-Guide-to-Laser-cut-Box-Generators/
- Boxes.py can be installed as extension of inkscape. but besides making
python-interpreter
, have to change from<command reldir="extensions">boxes</command>
to<command reldir="extensions" interpreter="python">boxes</command>
- Path generated by Boxes.py has redundant nodes. That is the reason why it can’t be filled with color. To use Blender virtual Laser-Cutter the filling has to be done. so we need to clean the path by selecting one path, and draw a box selecting all the nodes in the path, and then apply “join selected nodes”.
- cool svg design with joiners: https://clementzheng.github.io/joinery/
- when load .svg to blender as preview, path-combine the nodes. and making fill. Inter-section Filling option is not obvious, it is two icons on the right up corner of Fill setting.
[END]