SVG generation gem?

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.

···

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

I had a similar experience a few months ago. I was looking specifically to
generate graphs from log data and found a passable library but I don't think
it's still active and it is a bit of a pain. It is working for my very
specific and not too important needs, but I'd probably go from scratch if it
were important or needed to be flexible.

···

On Fri, Jul 30, 2010 at 9:59 AM, Rick DeNatale <rick.denatale@gmail.com>wrote:

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can’t hear a word you’re saying."

-Greg Graffin (Bad Religion)

Rick DeNatale wrote:

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.

Topher Cyll's book, "Practical Ruby Projects; Ideas for the Eclectic Programmer", has a chapter that generates animations with SVG.
SVG is wrapped in an SVGObject class but it is only developed to the extent needed for the example project. It may give you a start.

See http://www.cyll.org/

I coded my own SVG class a few years ago:

It's basically replacing xml tags by their name (as methods) and using
arguments in a better way.

SVGPath was a fun try to go further, allowing to build step-by-step a path.

I wanted to add animations which could be rendered using either
<animate> tags or JS.

I would enjoy to improve it and/or collaborate.

Please say me if this could be a start for what you are looking for.

Regards,
B.D.

···

On 30 July 2010 17:59:31 UTC+2, Rick DeNatale <rick.denatale@gmail.com> wrote:

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

I've been thinking about this a bit more, and for my purposes, which
is having an api to describe a static vector graphic for use with
things like laser cutters and other cam-like stuff with takes svg
input, that it might be interesting to try to use the same API as
Prawn for generating the graphics object model.

The graphics models for pdf and svg seem to be quite similar, not
surprising given Adobe's major input to SVG. I tend to see both as a
declarative expression of the Postscript drawing model, or at least
starting there.

I notice that there's at least one Prawn svg 'renderer' out there, but
it goes in the opposite direction I'm pursuing in that it renders svg
into prawn calls, rather than generating SVG from the prawn document
model.

I haven't investigated any of this really deeply, but it may be
possible to write something which extends and reuses most of Prawn but
with a different class of Document and some associated classes which
render SVG rather than PDF.

Perhaps Gregory Brown or one of the other core Prawn contributors will
see this and comment?

···

On Fri, Jul 30, 2010 at 2:11 PM, William Rutiser <wruyahoo05@comcast.net> wrote:

Rick DeNatale wrote:

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.

Topher Cyll's book, "Practical Ruby Projects; Ideas for the Eclectic
Programmer", has a chapter that generates animations with SVG.
SVG is wrapped in an SVGObject class but it is only developed to the extent
needed for the example project. It may give you a start.

See http://www.cyll.org/

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Thanks to JEG2, I now know about this thread. :slight_smile:

Right now we're not in a super stellar state for dropping in an
alternate renderer, but it's a huge goal of ours and we're heading in
that direction. A sufficiently interesting use case such as this
would really help. Anyone looking to wrap Prawn's high level
features onto a different backend format, please do contact us via the
Prawn mailing list, we will be happy to make the refactorings
necessary to make this easy:

http://groups.google.com/group/prawn-ruby

···

On Sat, Jul 31, 2010 at 11:38 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

On Fri, Jul 30, 2010 at 2:11 PM, William Rutiser <wruyahoo05@comcast.net> wrote:

I haven't investigated any of this really deeply, but it may be
possible to write something which extends and reuses most of Prawn but
with a different class of Document and some associated classes which
render SVG rather than PDF.

Perhaps Gregory Brown or one of the other core Prawn contributors will
see this and comment?

Rick DeNatale wrote:

  

Rick DeNatale wrote:
    

I've recently started playing with an Epilog laser cutter, and I find
myself wanting to programmatically generate SVG files.

I googled for ruby and svg this morning and although there seem to be
a few old stagnant efforts, there's nothing too useful I could find.

I suppose it wouldn't be too hard to start cooking something up using
Jim Wierich's xml builder gem, but before I got started I wanted to
see if there was anything I missed.
      

Topher Cyll's book, "Practical Ruby Projects; Ideas for the Eclectic
Programmer", has a chapter that generates animations with SVG.
SVG is wrapped in an SVGObject class but it is only developed to the extent
needed for the example project. It may give you a start.

See http://www.cyll.org/
    
I've been thinking about this a bit more, and for my purposes, which
is having an api to describe a static vector graphic for use with
things like laser cutters and other cam-like stuff with takes svg
input, that it might be interesting to try to use the same API as
Prawn for generating the graphics object model.

The graphics models for pdf and svg seem to be quite similar, not
surprising given Adobe's major input to SVG. I tend to see both as a
declarative expression of the Postscript drawing model, or at least
starting there.

I notice that there's at least one Prawn svg 'renderer' out there, but
it goes in the opposite direction I'm pursuing in that it renders svg
into prawn calls, rather than generating SVG from the prawn document
model.

I haven't investigated any of this really deeply, but it may be
possible to write something which extends and reuses most of Prawn but
with a different class of Document and some associated classes which
render SVG rather than PDF.

Perhaps Gregory Brown or one of the other core Prawn contributors will
see this and comment?
  

I am also interested in generating vector graphics with Ruby. One thing I have peeked into is Cairo which advertises Ruby bindings. Cairo itself seems to be widely used and is intended to support multiple back ends including SVG.

Cairo is used by Shoes and Gnome. The Ruby bindings are called rcairo but the api docs are mostly in Japanese.

-- Bill

···

On Fri, Jul 30, 2010 at 2:11 PM, William Rutiser <wruyahoo05@comcast.net> wrote: