Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8561

Using PoTrace inside grasshopper

$
0
0

@evo85210 wrote:

So I’ve been trying to convert a hand drawn drawing into curves that I can manipulate in grasshopper.

I’ve tried the image sampler method, but having to sort and filter through the points to recreate a meaningful curve have proved to be too time consuming/impossible for me.

I’ve came across PoTrace, which has it’s own a stand alone program that’s executed thru command prompt, and a plugin trace that uses PoTrace in rhino 6. I haven’t tried the cmd method, but the Trace plugin works great, now i just need it in grasshopper.

After some searching, I’ve found 2 C# ports of PoTrace:
Vectorization: https://www.drawing3d.de/Downloads.aspx (it’s in german and it comes with no instructions)
PoTrace-1: https://github.com/XuechaoLee/PoTrace-1 (an adaption of Vectorization, in english, but still lacks instructions)

What i’ve done is:
1.using PoTrace-1, merge and copy CsPotrace.cs and CsPtoraceExport.cs into Custom additional code, and add the necessary using statements at the start

using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using CsPotrace;
using System.Drawing.Drawing2D;
using System.IO;
using System.Diagnostics;

2.unblock and add CsPotrace.dll in manage assemblies (found from Vectorization)

but i’m getting errors:

Error (CS1519): Invalid token 'namespace' in class, struct, or interface member declaration (line 68)
Error (CS1519): Invalid token '{' in class, struct, or interface member declaration (line 69)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2563)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2563)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2564)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2564)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2565)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2566)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2567)
Error (CS1518): Expected class, delegate, enum, interface, or struct (line 2569)
Error (CS1001): Identifier expected (line 2587)
Error (CS1001): Identifier expected (line 2589)
Error (CS1022): Type or namespace definition, or end-of-file expected (line 2590)

I also got no idea how to initialize potrace/what to code in RunScript
Just wondering if someone can take a look and give me some pointers on how to proceed with this in GH.

Attached is the C# component with the merged code and the dll
potraceGH.7z (39.3 KB)

sidenote: came across another program called Sketch Simplification, it’s more inline with what I want, but it uses python, but i don’t understand python at all, it’ll be something i’ll try to tackle once i’ve learned python.

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 8561

Trending Articles