What attribute to use as layer name in SVG for axicli

Home Evil Mad Scientist Forums AxiDraw What attribute to use as layer name in SVG for axicli

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #28308
    Nailunia
    Participant

    Hello,

    I’m using the AxiDraw exclusively through the axicli (I create my SVGs through JavaScript and then save the output). The axicli documentation is very thorough, however I’m unable to figure out the layers. What SVG attribute do I need to set as the layer name? The documentation talks about “names”, but does that mean the “name”, “class”, “label”, “id”, or some other attribute name that I can give the SVG through JavaScript?

    Also, does this need to be a “g” (group) element, or can I also have an SVG without groups but with 2 separate “path” elements, one is “named” something starting with the number 1 and another with the number 2, and then use the –layer command?

    #28309
    Windell Oskay
    Keymaster

    The layer feature is set up to work such that if you created a document in Inkscape that had layers, it would work. If you’re hand-coding SVG, you’ll need to emulate that structure. Some of our AxiDraw example files include layers. You can open up those files in a text editor and look at how they are structured.

    An Inkscape layer is a g element with attribute inkscape:groupmode="layer". The layer name is specified by an attribute like inkscape:label="1-Yellow".

    #28312
    Nailunia
    Participant

    Ah! Thank you! I got it now :)

    Using d3.js I had to set svg.attr("xmlns:inkscape", "http://www.inkscape.org/namespaces/inkscape") and then

    
    let g = svg.append("g")
    g.node().setAttributeNS("inkscape","inkscape:groupmode", "layer")
    g.node().setAttributeNS("inkscape","inkscape:label", "1-Yellow")
    

    and now it works like a charm ^_^

    #28313
    Nailunia
    Participant

    Ah! Thank you! I got it now :)

    Using d3.js I had to set svg.attr("xmlns:inkscape", "http://www.inkscape.org/namespaces/inkscape") and then let g = svg.append("g"); g.node().setAttributeNS("inkscape","inkscape:groupmode", "layer"); g.node().setAttributeNS("inkscape","inkscape:label", "1-Yellow")

    and now it works like a charm ^_^

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.