Importing SVG with layers?

This forum is for general discussion regarding VCarve Pro
Post Reply
ds53652
Posts: 10
Joined: Sun Feb 12, 2023 2:45 am
Model of CNC Machine: X50

Importing SVG with layers?

Post by ds53652 »

I have a SVG file that has layers in it. I can't figure out a way to import the SVG and it include the inherent layers. Is this possible?

User avatar
Adrian
Vectric Archimage
Posts: 14685
Joined: Thu Nov 23, 2006 2:19 pm
Model of CNC Machine: ShopBot PRS Alpha 96x48
Location: Surrey, UK

Re: Importing SVG with layers?

Post by Adrian »

It's certainly possible as the attached file shows (unzip it to see the two files within). I would suspect whichever program you're using to create the SVG file isn't creating the file correctly.
Attachments
Layer Test.zip
(1.66 KiB) Downloaded 19 times

User avatar
martin54
Vectric Archimage
Posts: 7355
Joined: Fri Nov 09, 2012 2:12 pm
Model of CNC Machine: Gerber 48, Triac PC, Isel fixed gantry
Location: Kirkcaldy, Scotland

Re: Importing SVG with layers?

Post by martin54 »

As Adrian has said it does work & the problem is often the software you are exporting from either not supporting layers when exported or it is not set up to support it. Have a look at the software you are exporting froms settings to see if it is something in their export filters that needs to be changed :lol: :lol:

ds53652
Posts: 10
Joined: Sun Feb 12, 2023 2:45 am
Model of CNC Machine: X50

Re: Importing SVG with layers?

Post by ds53652 »

Thank you Adrian! I was able to download your test files and import them with the layers. The file in question is one I purchased. I will follow up with the seller. Thank you!
Adrian wrote:
Tue Feb 14, 2023 9:52 am
It's certainly possible as the attached file shows (unzip it to see the two files within). I would suspect whichever program you're using to create the SVG file isn't creating the file correctly.

ds53652
Posts: 10
Joined: Sun Feb 12, 2023 2:45 am
Model of CNC Machine: X50

Re: Importing SVG with layers?

Post by ds53652 »

So I went back to where I got the file from and they state that it is done in layers and even sent a screen shot (see attached PNG). I'm also attaching the SVG file (zipped) that's in question and was wondering if someone else could import it and see if they see the layers, because I can't for the life of me see the supposed inherent layers.

Many thanks in advance
Attachments
Screenshot showing the layers of the SVG file
Screenshot showing the layers of the SVG file
4th2-01.zip
Zipped SVG file
(4.4 KiB) Downloaded 24 times

User avatar
Adrian
Vectric Archimage
Posts: 14685
Joined: Thu Nov 23, 2006 2:19 pm
Model of CNC Machine: ShopBot PRS Alpha 96x48
Location: Surrey, UK

Re: Importing SVG with layers?

Post by Adrian »

There aren't any named layers in that file. I can see from it that is was created with Illustrator. Perhaps they didn't set up the Object Id to Layer name relationship when exporting or maybe they didn't name the layers at all as I can't see any layer names in that screenshot.

User avatar
adze_cnc
Vectric Wizard
Posts: 4380
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008
Location: Vancouver, BC, Canada

Re: Importing SVG with layers?

Post by adze_cnc »

Bringing the SVG into Illustrator shows that it does have a layer named “Layer 1”:
 
illustrator.png
 
and looking at the SVG in a text editor verifies that:
 
svg source.png
 
Your screenshot showing that “it is done in layers” shows what the Illustrator screenshot above shows. One layer with elements (groups and paths in Illustrator) as sub-branches of that layer.

By the way if the following is true of the SVG posted above;
The file in question is one I purchased.
Then you really shouldn’t have posted it here as it is someone else’s intellectual property.

User avatar
Adrian
Vectric Archimage
Posts: 14685
Joined: Thu Nov 23, 2006 2:19 pm
Model of CNC Machine: ShopBot PRS Alpha 96x48
Location: Surrey, UK

Re: Importing SVG with layers?

Post by Adrian »

What I meant was multiple layers which is what the OP is expecting. For layers to show up in the SVG import each one needs to have an id on the <g> section.

Code: Select all

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
  <g id="Layer1">
    <rect x="10" y="10" width="80" height="80" fill="red" />
  </g>
  <g id="Layer2">
    <polygon points="50,5 25,95 95,40 5,40 75,95" fill="yellow" />
  </g>
  <g id="Layer3">
    <polygon points="50,5 95,30 80,85 20,85 5,30" fill="green" />
  </g>
</svg>

Post Reply