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
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:
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:
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)
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.
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
add one line:
the problem is suddenly fixed.
4. 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.
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).
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.
用Blender过程中有一个事情我比较难搞定,就是选中,往往用户是知道要选中什么object的,可以在菜单栏选中它,但是菜单栏只是把目标选为Active Object,真正Select永远依仗用户在场景里去瞄准点击它,当工程很小这都没差,但随着工程变大,这就要求用户越过层层object,或者很多次滚轮缩放移动再选中,这也费blender的计算量,因为它要花力气去根据用户鼠标位置计算到底是哪个object,所以用到后面,用户往往会发现,“选中”变成了一个越来越“艰难”的事情,然而这些只要有个select active object的选项就可以避免了,可惜一阵搜索之后,并没有这样的东西,大家都会把鼠标选中当成一个想当然的事情,可我不这么认为。 我通过它的API给它写了一个Add-On,并生成了一个方便使用的菜单和热键,这个Add-On的功能是,在菜单栏选择想要的object后,按下Ctrl+Shift+空格,或者选择菜单栏的Object -> Select Active,就可以自动在场景里选中这个object了,在object非常多,或者想选中相机和灯时,会相当好用。
Add-On代码
把脚本命名为Select_Active_Object_byThatWolfieFeeling.py放在Blender目录的脚本位置../../scripts/addons
在启动Blender后,在User Perference中选择Add-Ons,再搜索wolfie,勾上Object: Select Current Active Object就可以在每次使用Blender的时候用这个功能了。
3. 角落
如果发现顶点超过10k后,选中花费很长时间,应该是驱动不支持,可以试试看在User Preference -> System -> Selection -> 从Automatics改成OpenGL Occlusion Queries
Given an array of integers, return indices of the two numbers such that they
add up to a specific target.
You may assume that each input would have exactly one solution, and you may
not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
Given an array of integers, return indices of the two numbers such that they
add up to a specific target.
You may assume that each input would have exactly one solution, and you may
not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].