[EXAMPLE OF HAML TO CREATE SVG]

Indeed. the threads are bit confusing,…

Let me give an example of a HAML file that creates a svg-file dynamically. I used this one to create a ‘grid-system’. The example might be a bit complicated — but I’ll guess you can figure it out. 

Keep in mind that every line that starts with a dash is a Ruby command. 

- C = W / n

Anywhere you see #{something}, we’re outputting Ruby as well:

%path{ "d" => "M  #{offset + n*C} 0 l 0 1200” 

Not in this example, but handy to know, is a dirt way to include one HAML file within another (your bunnies?)

    = Haml::Engine.new(File.read(‘bunny.haml')).render

And here the complete example, again, it creates a system of grid lines, with numbers at the bottom indicating the amount of pixels.

!!! XML
!!!
%svg{ :width => "1400px", :height => "1200px", "xmlns:svg" => "http://www.w3.org/2000/svg", :xmlns => "http://www.w3.org/2000/svg" }
%title Grid system template  
- n = 12
- G = 20
- W = 1200 - G
- C = W / n
- offset = 100
- (0...n).each do |i|
%path{ "d" => "M #{offset + i*C} 0 l 0 1200"        ,  "style" => "fill:none;stroke:#ff88ff;stroke-width:1px;"}
%path{ "d" => "M #{offset + i*C + G} 0 l 0 1200"     , "style" => "fill:none;stroke:#ffccff;stroke-width:1px;" }
%path{ "d" => "M #{offset + i*C + C - G} 0 l 0 1200" , "style" => "fill:none;stroke:#ffccff;stroke-width:1px;" }
%text{ "x" => "#{offset + i*C } ", "y" => "1210",    "style" => "font-size:8px;font-family:Arial"} #{i*C}
%text{ "x" => "#{offset + i*C + C/2} ", "y" => "1230", "style" => "font-size:12px;font-family:Arial"} #{i + 1}
- (0..1200).step(25).each do |i|
%path{ "d" => "M 0 #{i}  l #{1200 + 2*offset} 0"     , "style" => "fill:none;stroke:#ffccff;stroke-width:0.5px;"}

%path{ "d" => "M  #{offset + n*C} 0 l 0 1200", "style" => "fill:none;stroke:#ff88ff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" }
%text{ "x" => "#{offset + n*C } ", "y" => "1210",    "style" => "font-size:8px;font-family:Arial"} #{n*C}


(By the way, n: number of columns, G: gutter width, W: width of the page minus 1 gutter width, C = column width)

Hope it helps you or maybe even inspires others?

Maarten


On 06 Apr 2014, at 15:29, Jake Maier <j.m@...3030...> wrote:

Ooops I'm sorry, don't know what happened. But it got to the wrong thread
J

-----Original Message-----
From: Jake Maier [mailto:j.m@...3073.....]
Sent: Saturday, April 05, 2014 6:30 PM
To: 'Inkscape User Community'
Subject: Re: [Inkscape-user] Overlaying svg files from the commandline

Thank you David,
You are right, I'm using windows 7.
I forgot about the alt space, and that works perfectly. I can move the file
to the center of Windows, but even when I save the file. When I reopen the
file, it will again be at the same place off windows. I can live with that
but it would be nice if the window would open where it is supposed to open.
Do you have any other idea how to fix it?
Thank you very much for your answer.
Jake

-----Original Message-----
From: David Lang [mailto:david@...2429...]
Sent: Saturday, April 05, 2014 6:01 PM
To: Inkscape User Community
Subject: Re: [Inkscape-user] Overlaying svg files from the commandline

On Sat, 5 Apr 2014, John Smith wrote:

On Sat, Apr 5, 2014 at 10:07 PM, David Lang <david@...2429...> wrote:
take a look at the blockdiag tool www.blockdiag.com

It has ways of making network diagrams from text files and outputs
the result in a few different formats (including svg)

David Lang

That's actually pretty cool! Im definitely going to play around with
that one a little, thanks!

Do you know if its possible to use your own graphics instead of the
boxes ? Ive seen at least the addition of a 'network cloud' in an
example by using "inet [shape = cloud];", it would be cool if I could
replace the boxes with other graphics.

There aren't a lot of shapes defined (there are several), but the code is
pretty clean so it shouldn't be hard to add additional shapes. One thing to
keep in mind is that all the different varients share a lot of common code,
so even if something isn't documented in the network diagram documentation,
there are good odds that it will still work.

I actually tried using this to diagram a _very_ complex network (>130
separate networks with >1000 hosts, some multi-homed to as many as 20
different networks), the blockdiag tools spit out a svg for it, but I wasn't
able to find a tool that would open the resulting svg :-( the diagram would
have been about 20' on each side if printed at the default size.

David Lang

----------------------------------------------------------------------------
--
_______________________________________________
Inkscape-user mailing list
Inkscape-user@...2249...sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-user


----------------------------------------------------------------------------
--
_______________________________________________
Inkscape-user mailing list
Inkscape-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-user


------------------------------------------------------------------------------
_______________________________________________
Inkscape-user mailing list
Inkscape-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-user