Vector Drawing (?) code

150 views
Skip to first unread message

Scott B

unread,
Aug 20, 2012, 12:13:57 AM8/20/12
to hackerspac...@googlegroups.com
If I were to say:

M100.0,0.0
L-5.0,5.0
L-5.0,-5.0
L0.0,-5.0
Z

Does this mean anything to anyone? Is this some kind of standard vector graphic format?

The code is used in our Graphics program to generate shapes, but it gets very tedious to do manually, so I'm hoping there is some way of generating it from a CAD drawing or something?

BTW, 
M = Move
L= Line
H = Horizontal Line
V = Vertical Line
C = Cubic Curve 
..
Z = Close 

Thomas Sprinkmeier

unread,
Aug 20, 2012, 12:18:39 AM8/20/12
to hackerspac...@googlegroups.com
On 20 August 2012 13:43, Scott B <solar....@gmail.com> wrote:
> If I were to say:
>
> M100.0,0.0
> L-5.0,5.0
> L-5.0,-5.0
> L0.0,-5.0
> Z
>
> Does this mean anything to anyone? Is this some kind of standard vector
> graphic format?
>
> The code is used in our Graphics program to generate shapes, but it gets
> very tedious to do manually, so I'm hoping there is some way of generating
> it from a CAD drawing or something?


Last time I had to do something like that I used inkscape and perl.

draw in inkscape, save as SVG, mangle in
perl/python/your-favourite-scripting-language

I needed a non-rectangular windows border in Java, which you do by
using drawto/lineto/moveto type commands.

Poking around the SVG I recognised that these commands were all there,
a bit of munging with perl and voila!


Thomas

Scott B

unread,
Aug 20, 2012, 12:19:55 AM8/20/12
to hackerspac...@googlegroups.com
Ah, looks like its SVG

Paul Schulz

unread,
Aug 20, 2012, 1:30:05 AM8/20/12
to hackerspac...@googlegroups.com
I am (vaguely) reminded of a HP plotter format. I'm surprised that
there isn't a 'pen-up/pen-down' command in there, although I may be
wrong, it's been a very long time since I wrote and code (GWBASIC) to
drive a plotter.
> --
> You received this message because you are subscribed to the Google Groups
> "HackerSpace - Adelaide, South Australia" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hackerspace-adelaide/-/_A4viqINlaAJ.
> To post to this group, send email to hackerspac...@googlegroups.com.
> To unsubscribe from this group, send email to
> hackerspace-adel...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hackerspace-adelaide?hl=en.

Scott B

unread,
Aug 20, 2012, 1:39:33 AM8/20/12
to hackerspac...@googlegroups.com
hmm, downloaded a SVG converter, but it has come out in a different format:

  <title>Export to SVG</title>
  <desc>Generated by CADtoSVG Version 1.0: 20/08/2012 15:03:27</desc>
<line x1="6554" y1="6554" x2="11796" y2="1311" style="stroke:#000000; fill:None;"/>
<line x1="11796" y1="1311" x2="14942" y2="4456" style="stroke:#000000; fill:None;"/>
<line x1="14942" y1="4456" x2="18088" y2="1311" style="stroke:#000000; fill:None;"/>
<line x1="18088" y1="1311" x2="21233" y2="4456" style="stroke:#000000; fill:None;"/>
<line x1="21233" y1="4456" x2="24379" y2="1311" style="stroke:#000000; fill:None;"/>



On Monday, August 20, 2012 1:43:57 PM UTC+9:30, Scott B wrote:

Jonathan Wheare

unread,
Aug 20, 2012, 1:42:34 AM8/20/12
to hackerspac...@googlegroups.com
Are there any magic numbers or codes at the start of the file?

J.
> --
> You received this message because you are subscribed to the Google
> Groups "HackerSpace - Adelaide, South Australia" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hackerspace-adelaide/-/gnuAiTAxKCIJ.
> To post to this group, send email to
> hackerspac...@googlegroups.com.
> To unsubscribe from this group, send email to hackerspace-adelaide
> +unsub...@googlegroups.com.

Scott B

unread,
Aug 20, 2012, 1:49:05 AM8/20/12
to hackerspac...@googlegroups.com
here it is from the beginning:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 65535 65535" >
  <title>Export to SVG</title>
  <desc>Generated by CADtoSVG Version 1.0: 20/08/2012 15:03:27</desc>
<line x1="6554" y1="6554" x2="11796" y2="1311" style="stroke:#000000; fill:None;"/>

Steven Pickles

unread,
Aug 20, 2012, 8:58:21 PM8/20/12
to hackerspac...@googlegroups.com
if you export a path from gimp, it comes out in a format a bit more reminiscent of this. its what i parse at the moment (just M commands) to make my drilling script for the modela.

pix

--
You received this message because you are subscribed to the Google Groups "HackerSpace - Adelaide, South Australia" group.

To post to this group, send email to hackerspac...@googlegroups.com.
To unsubscribe from this group, send email to hackerspace-adel...@googlegroups.com.

Scott B

unread,
Aug 20, 2012, 9:10:59 PM8/20/12
to hackerspac...@googlegroups.com
ooh, I have gimp here somewhere I'll give it a go.

I must do a demo of the Niagara software at a meeting one night - I'm sure you guys would have all sorts of uses for it - and blow my mind with what can be done with it.
pix

To unsubscribe from this group, send email to hackerspace-adelaide+unsub...@googlegroups.com.

Scott B

unread,
Aug 20, 2012, 9:42:22 PM8/20/12
to hackerspac...@googlegroups.com
still looking for the export to path option in gimp... your not going to make me read the instructions are you? ;)

interestingly the hacker space logo .svg is in the correct format for me to use.

Paul Schulz

unread,
Aug 20, 2012, 10:02:50 PM8/20/12
to hackerspac...@googlegroups.com

Try inkscape. It has a veriety of svg / vector export options.


To post to this group, send email to hackerspac...@googlegroups.com.
To unsubscribe from this group, send email to hackerspace-adel...@googlegroups.com.

Steven Pickles

unread,
Aug 20, 2012, 10:09:48 PM8/20/12
to hackerspac...@googlegroups.com

Not export _to_ path. Click on the path tool and draw a path. Then in the "Paths" list (probably one of the tabs next to your layer list) right click on the current path (which got automatically created when you started using the path tool) and save or export it (can't remember the terminology right now). It doesn't give any indication that the saved path will be SVG, but it will be.

pix

On Aug 21, 2012 11:12 AM, "Scott B" <solar....@gmail.com> wrote:

To post to this group, send email to hackerspac...@googlegroups.com.
To unsubscribe from this group, send email to hackerspace-adel...@googlegroups.com.

Scott B

unread,
Aug 20, 2012, 10:30:41 PM8/20/12
to hackerspac...@googlegroups.com
inkscape is looking promising, it has an XML editor that will show me each path and the code for it.... however it does every segment as a separate path, I guess there is a join option here somewhere so that I can turn a heap of segments in to a single path? 

Scott B

unread,
Aug 20, 2012, 10:37:28 PM8/20/12
to hackerspac...@googlegroups.com
Found it, the old combine button (or ctrl+L) makes it in to a single path.

Looks like I can now draw something in AutoCAD, export it to a DXF, import to Inkscape, combine to a single path, view the XML, copy and paste in to the Niagara XML file - all sounds so easy!

Tamsyn Michael

unread,
Aug 20, 2012, 11:19:11 PM8/20/12
to hackerspac...@googlegroups.com

Looks like I can now draw something in AutoCAD, export it to a DXF, import to Inkscape, combine to a single path, view the XML, copy and paste in to the Niagara XML file - all sounds so easy!

...

o.O

Scott B

unread,
Aug 20, 2012, 11:37:57 PM8/20/12
to hackerspac...@googlegroups.com
not quite there yet... 

it appears inkscape won't join the segments in to one singular fluid path, it jumbles up the order with a heap of move commands in between - which screws things up when the graphics package does the 'fill' at the end, as I end up with lots of little closed segments rather than one big one.

maybe its a rounding error? can I set it to snap segments together if they are within say 0.01 of each other? rather than checking them to 5 decimal places?

Or any other thoughts?

Peter Wintulich

unread,
Aug 21, 2012, 12:24:38 AM8/21/12
to hackerspac...@googlegroups.com
Hello Scott,

It may be best just to export a dxf file and directly process it contents in a small converter program.

In Acad you would need to use the poly line command to create the outline.

Somewhere at home I have a book on the DXF format.
Years ago I was creating PCB designs in it and we then ran a basic program to produce Gerber files.
The DXF format has got a bit more complex since then but not unusable.

Another option that will work very well is setup an old plotter driver. Use save to file.
The old hp and huston plotters code was fairly easy to parse. But the vectors may then need reordering.

Regards Peter W.
--
You received this message because you are subscribed to the Google Groups "HackerSpace - Adelaide, South Australia" group.

To post to this group, send email to hackerspac...@googlegroups.com.
To unsubscribe from this group, send email to hackerspace-adel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hackerspace-adelaide?hl=en.


-- 

Peter Wintulich

Voicetronix Pty. Ltd.
Level 1, 246 Pulteney Street,
ADELAIDE  5000
South Australia
AUSTRALIA
+61 8 8232 9112

Sam Hodge at GMail

unread,
Aug 21, 2012, 1:21:12 AM8/21/12
to hackerspac...@googlegroups.com
Writing SVG via scripting isnt that hard:

I wrote a program in Python to do halftoning and write the output to
SVG, which I then converted to PDF for printing.

http://www.hodge.net.au/sam/blog/?p=78

sam

sighmon

unread,
Aug 21, 2012, 7:41:50 PM8/21/12
to HackerSpace - Adelaide, South Australia
Scott: for your interest, I drew the original hackerspace logo in
Adobe Illustrator.. so happy to let you have a play at hackerspace
tonight.

si.

Scott B

unread,
Aug 21, 2012, 8:41:05 PM8/21/12
to hackerspac...@googlegroups.com
yeah hoping to do a bit more experimenting tonight.

I have found that if I draw something in Inkscape it works properly (the XML file contains a single path with no excess moves, which I can cut and paste straight in to Niagara). It just doesn't handle imported paths from AutoCAD well yet - no doubt there will be a function there somewhere to auto-join and re-order which would work.
 
Will be interesting to see if Illustrator handles it any better.
> > hackerspace-adelaide+unsub...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/hackerspace-adelaide?hl=en.
>
> > --
>
> > Peter Wintulich
>
> > Voicetronix Pty. Ltd.
> > Level 1, 246 Pulteney Street,
> > ADELAIDE  5000
> > South Australia
> > AUSTRALIA
> > +61 8 8232 9112
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "HackerSpace - Adelaide, South Australia" group.
> > To post to this group, send email to hackerspac...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > hackerspace-adelaide+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages