Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Polargraph Optimiser
stereoeric
Newbie
Posts: 22
Permalink
stereoeric
Post Polargraph Optimiser
on: December 19, 2014, 23:31
Quote

I have an SVG queue with 190,000 lines, and would like to use the optimizer, but am not sure how to run my queue through the optimizer. Any help would be appreciated.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Polargraph Optimiser
on: December 21, 2014, 00:53
Quote

Hello, I wrote up this page - see if it helps.

https://github.com/euphy/polargraph/wiki/Vector-Optimizer

stereoeric
Newbie
Posts: 22
Permalink
stereoeric
Post Re: Polargraph Optimiser
on: December 21, 2014, 19:25
Quote

Hi, Sandy - thank you for posting instructions on how to use the Optimizer. However, as usual, I have to be led by the hand. As you can see from the attached screenshot, I did what you said (I think), but the word "python" appeared to cause a problem. Then I tried again, leaving out the word "python". This seemed to help, as the optimizer apparently did some optimizing, as evidenced by the subsequent result. However, it apparently ran into a problem somewhere, and although it produced a file named cat3_2.txt, there is nothing on it. Any idea what the problem is? https://www.flickr.com/photos/stereoeric/16072690072/

william_b
Newbie
Posts: 10
Permalink
Post Re: Polargraph Optimiser
on: December 21, 2014, 19:48
Quote

I also tried it. I ran "python process.py queue.txt > queue_2.txt", from within the python folder. (No idea if you need to work from within the python folder.)
It gave the same error as the above. I think it is an error in the code, since dividing by 15 is not always an integer.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Polargraph Optimiser
on: December 21, 2014, 21:20
Quote

Hey thanks for giving it a shot, I wonder if it's a python 3 vs python 2 thing? I've got python 2.7 installed and there are sometimes some odd differences between 2 and 3.

I'm not sure from looking at the code whether the float is the result of the the division or not, but I'd guess that it would get coerced into being an int anyway. You could try modifying line 44 in process.py so it casts the result to int:

for i in range(0, len(glyphs), int(len(glyphs) / 15)):

Does anyone want to send me their command queue and let me try here on my machine?

You could also try processing the sample map.txt that is included with the optimizer - see if that makes the same error.

sn

william_b
Newbie
Posts: 10
Permalink
Post Re: Polargraph Optimiser
on: December 22, 2014, 07:20
Quote

Hello Sandy,
I used the motorcycle.txt, that came with the program.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Polargraph Optimiser
on: December 22, 2014, 10:40
Quote

I tried running stereoeric's queue through on my install (Python 2.7), and it optimised successfully, so I think it is a Python2 vs Python3 issue. There's some subtle differences between the two versions, and I don't have the experience to see the issue immediately. In the immediate, the solution is to install Python2 instead of 3, and I'll try to have a look at porting this to 3.x.

sn

william_b
Newbie
Posts: 10
Permalink
Post Re: Polargraph Optimiser
on: December 22, 2014, 15:21
Quote

I just tried to optimise it with python 2.7, and it works.

Thanks

David
Newbie
Posts: 2
Permalink
Post Re: Polargraph Optimiser
on: July 11, 2015, 14:01
Quote

Hi,
Came across this older thread trying to get the optimizer to work but I must be missing something and have some basic questions.

Okay so I have Python 2.7.10 downloaded and installed in my programmes and also the optimizer files downloaded and extracted into their own folder. Firstly do I need to copy the optimizer files into the Python programme folders and if so where do they need to be copied across to please?

To produce the command queue I've setup the Polargraph with the SVG imported and hit draw vector to produce the queue before quickly pausing the machine. Then save as from the queue menu as a text file (export queue doesn't seem to be giving me a txt file). Is there a way of exporting the queue without having to start and pause the drawing or is this the right approach?

Where then does this text file need to be placed for Python to see it and do the optimising? Does it need to be placed into the Python folder directly or how can I steer it in the direction of another folder location?

Thanks for any help.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Polargraph Optimiser
on: July 12, 2015, 00:12
Quote

Hi David, there's a page about this on the wiki: https://github.com/euphy/polargraph/wiki/Vector-Optimizer see if that gives you any pushes in the right direction.

You don't need to have the queue running to be able to draw vectors, or do anything, so just make sure it's paused before you generate any commands - they won't go anywhere. Alternatively, don't connect your machine, and it won't matter if the queue is running or not.

When building your queue, remember you always need to have a "set home" as the first command in it. That command is pre-loaded automatically when you start the controller too, but if you clear your queue, just bear in mind to make sure you "set home" before you "draw vector".

You can save the queue txt file (export queue) wherever you like, doesn't matter. I always put it in the same folder that I have the polargraph-optimiser unzipped into, so it's easy to refer to when I'm running the optimiser. You don't need to copy the optimiser files anywhere. If python is properly installed, you should be able to open a command line in your optimiser folder, and python will be available from there, so you can run as specified in the wiki.

good luck!
sn

kongorilla
Pro
Posts: 362
Permalink
kongorilla
Post Re: Polargraph Optimiser
on: July 12, 2015, 09:05
Quote

IIRC, installing Python 2.7 for Windows doesn't automatically create the environment variable necessary to run scripts from everywhere (at least it didn't back when I installed it).
For help with that, see:
http://www.pythoncentral.io/add-python-to-path-python-is-not-recognized-as-an-internal-or-external-command/

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.025 seconds.