custom tool definition

cnc-club.ru for English speaking users
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

custom tool definition

Сообщение badger »

I don't know if this is a custom tool request or about canned cycles, macros, post processor or what? I don't have a controller or machine yet pending figuring out if I can control it. I'm trying to make a rug making bot similar to what is available at www.wilcom-autotuft.com only smaller, slower and cheaper. The basic idea is to move to the stitch location (inkscape node), insert the needle, raise the needle, rotate to the direction of the next move and move to the next location. Using the tangent knife tool gets me really close but is there a way to insert code at each node (after X,Y move and befor A move) to make the needle insertion? An option similar to “insert gcode after path” but “insert after move” could work. Code could be something M08 G04 P500 M09 G04 P500 to activate an air cylinder, wait for it to extend and then retract, although I would prefer to use position sensors instead of dwells. A Z move could also be used instead. A rug could have over 100,000 stitches so manual coding each action isn't too viable.

I have read all of the english part of this site and you do a great service. Thanks.
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

We coud try the following:
add new post processor which will add needed Gcode after any G1, G2 or G3 move.

Can you add an example of gcode that we have now and what we want it to be :)
(two-tree strings will be anought)

Sorry for my English, it's kind late now :)
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

Nick -

Thanks for you ever quick response. Your written English is much than Google's translations. I have hopefully correctly attached files that will help clarify my project. This is my first time dealing with an online forum so hopefully it works. It is also the first time I have coded for machine control in 30 years and then it was on a Commodore 64 with a cassette tape storage drive.

So I have experimented some in Inkscape and Gcodetools and made the sample files. There is a copy of the .svg without the tool and with. I used the default tool because it gives more options than just "tangent knife". "original.gnc" file is after running path-to-gcode.In the "modified.gnc" file I added code after the x,y moves to extend and retract an air cylinder, with the needle attached, using the coolant controls. The other change I made was moving the first knife plunge up a couple of lines so it happens before my added code and the "a" move. This change only happens once at the beginning of each path and could easily be changed by hand. I would like to use a TinyG controller which has a somewhat limited set of G and M codes so I need to cheat at times.

I have also attached a photo of one of my rugs not made with CNC so you have some idea basic designs I plan on using. The rug is about 32" x 84" and has an estimated 110,000 loops pushed in one at a time. I didn't keep track of time but it was probably 6 weeks of weekends and evenings. I need a robot slave.

Any help you can give is greatly appreciated.
Вложения
sample.svg
(3.67 КБ) 1314 скачиваний
sample_tool.svg
(25.63 КБ) 1422 скачивания
modified.ngc
(2.87 КБ) 1653 скачивания
original.ngc
(2.16 КБ) 1620 скачиваний
rug.jpg (14543 просмотра) <a class='original' href='./download/file.php?id=10531&sid=cb0fc98c662732ee9a3e2576ffc8edd1&mode=view' target=_blank>Загрузить оригинал (204.84 КБ)</a>
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

Probably it can be easily done by adding custom post-processor.

Something like
regex( 'regex("(G0?1 [XY\-\.\d\s]*Z[\s\-\.\d]+)", "\1 \nM08 G4 p2500 \nM09 G4 p1000")' )
Are you familiar with regular expressions?

Is that carpet is made by you? Can you attach photos of your machine please? :)
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

Nick -

Yes the carpet is made by me. The tool is a punch needle referred to as an "Oxford Punch". No machine yet. You work on linen fabric stretched tightly on a frame. From the backside you push the needle in until it stops, about 40 mm, pull it out and repeat. It works out to about 8 to 10 stitches per inch and 5 or 6 rows per inch the other way.

I am not familiar with regular expressions but the internet can reveal all. Should I be referencing python or some other language?

Thanks for your interest and help, Badger
Вложения
oxford punch.jpg (14533 просмотра) <a class='original' href='./download/file.php?id=10533&sid=cb0fc98c662732ee9a3e2576ffc8edd1&mode=view' target=_blank>Загрузить оригинал (81.45 КБ)</a>
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

I tried to put the string you sent me in the post processor and I got no output. Next I went into the python code and found the area of interest around line 3894 and decided to just add the M08 G4 P2500 and M09 G4 P1000 to the line that sends the G01 Axxx to the file. ( Actually it would be good to have "M08 G4 P2500" before the "G01 Axxx" and the "M09 G4 P1000" after the "A" move) but access was denied to save or run. [Errno 13]. Is there a way for me to gain access to my copy of gcodetools.py without effecting the rest of the world? Using variables may be better than changing the .py files but for one user it doesn't seem like a problem.

There is absolutely no rush on this so please celebrate a most joyous New Year!

- Badger
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

ups, my fault :) that should be like:
regex("(G0?1.*)$", r'\\1 \nM08 G4 p2500 \nM09 G4 p1000')

if you want "wrap" around string with G01 A... then use something like:
regex("(G0?1\s*A.*)$", r'M08 G4 p2500\n \\1 \nM09 G4 p1000')

regex uses python's implementation of regular extensions (re.sub is applied to every Gcode string). But regular expressions not just python's function - they are almost standalone language... See:
http://en.wikipedia.org/wiki/Regular_expression
http://docs.python.org/2/library/re.html
http://docs.python.org/2/library/re.html#re.sub


PS Happy New Year!!!
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

Nick -
Absolutely fabulous!!! The "rap a round" version is exactly what I needed for proof of concept that Inkscape and gcodetools will do the job I need. I will spend some time looking a regular expressions and python in general to figure out why it works. The only other thing I need to do is move the first "Z" plunge of the path to before the first "A" move for my purposes. (As is, it seems to be correct for actual tangent knife use.) I may try to do it with regex either in postprocessor or in text editor, or get more ballsy and try to get in to the extension. I figured out the issues with permissions so I can now reek havoc on my system. Next to do is design and build the machine, I will post photos when there is something to post.

Some where on one of the forums you asked why people were interested in using inkscape and gcodetools and this is the reason. They function with 95+% of what commercial software does, which I am willing to pay for, but there is no way I could have gotten the help you have given ,me, along with the help the forum has given so many others.

Thanks again for all of your help and I will keep you updated.

- Badger
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

badger писал(а):The only other thing I need to do is move the first "Z" plunge of the path to before the first "A" move for my purposes
Can you add an example?
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

This is the way the gcode is with the new post processor.

(Start cutting path id: path23871)
(Change tool to Tangent knife)

G00 Z5.000000
G00 X47.574604 Y216.907945

M08 G4 p2500
G01 A0.366937611445
M09 G4 p1000
G01 Z-0.125000 F100.0(Penetrate)
G01 X53.848922 Y219.319443 Z-0.125000 F400.000000
M08 G4 p2500
G01 A0.567197197806
M09 G4 p1000

Machine travels to first location of path at Z5.00 then executes first needle insertion above surface. (M08 / M09 sequence). Afterwards it drops to operating level Z-0.125. Preferable sequence is:

(Start cutting path id: path23871)
(Change tool to Tangent knife)

G00 Z5.000000
G00 X47.574604 Y216.907945
G01 Z-0.125000 F100.0(Penetrate)
M08 G4 p2500
G01 A0.366937611445
M09 G4 p1000
G01 X53.848922 Y219.319443 Z-0.125000 F400.000000
M08 G4 p2500
G01 A0.567197197806
M09 G4 p1000

This way the machine travels to first location of path at Z5.00, drops to operating level of Z-0.125 and makes first needle insertion at correct level.

Simple to do in text editor.I just noticed an extra space before G01 A... ,my understanding is that white space doesn't effect anything, does it?

Thanks
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

Hmmm... and what is the meaning of A axis for your machine?

Yes, additional spaces should not have any effect.
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

This is a good question. It seems that there are different usage of axis designations. In my usage the "A" axis is rotation around the "Z" axis in the same manner that a tangent knife rotates to present the sharp edge of the blade to the direction of travel. The punch needle needs to be oriented in the same manner because of the way the yarn flows through the needle. In many references this would be stated as the "C" axis and the "A" axis as rotation around the "X" axis. Do you have any preference or opinion?

Many thanks for your continued help, Badger
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

Are your programs going to be huge? We can try to add Full text regular expression (instead of applying it to every line).
If they will be huge this regular expression can take a while to execute...
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

I would guess that the program will be considered huge. Each loop of yarn will happen at a node in inkscape so that will be 4 lines of gcode per loop. That probably works out to around 175,000 lines of code per square foot of rug. On the other hand I plan on breaking each project into at least 3 programs, one for light grey yarn, one for dark grey yarn, one for color yarn etc. Processing time for the program is not much of an issue to me. I can run the program overnight, or while at work as needed. I am not looking to set any speed records on productivity, just some speed increase over doing it all by hand and saving my wrist from too much stress.

This weekend I will make you a video of some of the process which may make it a little easier to understand, although you are doing a fantastic job of figuring things out for me. I know you a fluent in written English do you also speak English or should I add English text to video?

-Badger
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

175000 lines... that's a lot...
And how does inskcape work with this amount of nodes???

I speak English, so text is not needed, in fact it's usually easier to get the meaning from the voice, if you are not from Ireland, or somewhere there :).
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

I tried simple design based on 1800mm X 2400mm rug and Inskape successfully placed 221370 nodes. The was the last thing it did. I reduced size to 1000mm X 500mm which generated 25499 nodes which using postprocessor you wrote for me generated 218000 lines of gcode. Time to generate gcode was not more than maybe 3 minutes. This works for me! With reference points on drawing I think it should be easy to break up design on layers or areas and just run sections to gcode one at a time with no registration problems.

I think I have ancestors from Ireland but after a few hundred years we have lost the accent. We watch some BBC TV shows on Netflix and some of them set in the north part of the UK might as well be in a foreign to me because I can't understand much of that version of English.
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

Can you attach that svg, or probably make a screenshot (or export to png), if it has big size?
I can not imagine what it looks like :).
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

Not really very interesting. It was the simplest way to generate a bunch of points to test the system for capacity. I really should actually do a "real" design at some point. Video soon to be on an internet near you.
Вложения
test #186.png (14426 просмотров) <a class='original' href='./download/file.php?id=10582&sid=cb0fc98c662732ee9a3e2576ffc8edd1&mode=view' target=_blank>Загрузить оригинал (260.17 КБ)</a>
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: custom tool definition

Сообщение Nick »

badger писал(а):I really should actually do a "real" design at some point.
That's what I'm talking about! :)
Some times a lot of troubles come up when you move to the real tasks.
So it's better to start from a kind of them...
Аватара пользователя
badger
Новичок
Сообщения: 38
Зарегистрирован: 30 дек 2012, 00:32
Репутация: 3
Контактная информация:

Re: custom tool definition

Сообщение badger »

I have made a video of some of the basic rug making process as it applies to my problems.

http://www.youtube.com/watch?v=wOX1uZnB ... e=youtu.be

I think I maybe should have made it a little lower resolution to load faster but live and learn, its my first attempt at youtube.
Ответить

Вернуться в «English forum»