<p>Lame solution: creating stepped pyramid with offset. I realized that scale will not worked for motives with holes inside. Offset seems then more appropriate than scale for my application (creation of stamps)</p>
<p>It takes ages to render, but it could be enough for simple patterns. Any better solution are still welcome...</p>
<pre><code>module buildPyramidalExtrude(height,maxOffset,nSlices){
    heightIncrement = height/nSlices;
    offsetIncrement = maxOffset/(nSlices-1);
    for(i=[1:nSlices])
        linear_extrude(height=i*heightIncrement)
              offset(r = maxOffset-(i-1)*offsetIncrement)
                children();
}

buildPyramidalExtrude(4,2.5,20)
   import(file = &quot;Farm/cow.svg&quot;, center = true);
</code></pre>
<p><a href="https://i.sstatic.net/pGUnC.png" rel="noreferrer"><img src="https://i.sstatic.net/pGUnC.png" alt="result" /></a></p>

CC BY-SA 4.0
2020-12-29T13:55:28.470Z
2020-12-29T13:55:28.470Z
Oneira
<p>What you seem to want is not per-path scale but offset. This is an <a href="https://github.com/openscad/openscad/pull/2079" rel="nofollow noreferrer">open PR in OpenSCAD</a> and hopefully will be upstream soon.</p>

CC BY-SA 4.0
2020-12-29T18:42:35.013Z
Looking forward to see it in upstream!
Oneira
CC BY-SA 4.0
2020-12-29T16:57:34.640Z
2020-12-29T16:57:34.640Z
R.. GitHub STOP HELPING ICE
<p>One option is to use <code>minkowski()</code> to combine the svg with a cone. On the positive side, it gives a rather nice result, but the downsides are:</p>
<ul>
<li>it's pretty slow</li>
<li>it fattens the bottom rather than shrinking the top, so depending on your needs you may have to invert the image, run <code>minkowski</code>, then invert again.</li>
</ul>
<p>Another option is to convert to grayscale <strong>png and apply a blur</strong> with an external tool, then to import using <code>surface()</code> (the gray blur will become a nice slope). That will both fatten the bottom and shrink the top, but keeping only the top half should give the desired result.</p>

CC BY-SA 4.0
2022-02-13T21:28:34.300Z
2022-02-13T22:22:23.627Z
2022-02-13T22:22:23.627Z
tarulen
<p>Late to the question, but I'm working on a similar project as the question presents. My solution is to open the SVG file in Inkscape (version &lt; 1.x) and use the <a href="https://www.thingiverse.com/thing:25036" rel="nofollow noreferrer">Path to OpenSCAD</a> extension to create a set of points for each entity.</p>
<p>The extension generates paths based on the desired extrusion height and places each set of points in its own module. In so doing, one can scale each individual entity and manipulate each one as desired.</p>
<p><a href="https://i.sstatic.net/CoOQa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CoOQa.png" alt="Inkscape Extension for OpenSCAD use" /></a></p>
<p>Image from linked site.</p>

CC BY-SA 4.0
2022-12-23T16:51:12.570Z
2022-12-23T16:51:12.570Z
fred_dot_u
<p>In OpenSCAD, I am trying to make a linear_extrude on a shape imported from an svg. The svg file contains multiple path. I would like to scale each path separately. I have tried the following code, but the whole import is considered a single shape resulting in the image below.</p>
<pre><code>linear_extrude(height = 5, center = true, scale=1.2)
    import(file = &quot;xxx.svg&quot;, center = true, dpi = 96);
</code></pre>
<p><a href="https://i.sstatic.net/cg1Rq.png" rel="noreferrer"><img src="https://i.sstatic.net/cg1Rq.png" alt="result" /></a></p>
<p>How can I have each of the letters to have 'its own pyramid' ?</p>
<p>I know I could create one SVG per letter. But for simplicity sake I would like to have only one SVG file, as I want to create much more complex motives in the future. My final goal is to create stamps from SVG drawings.</p>
<p>Edit:
Alternative tried after Mick's comment (same result):</p>
<pre><code>module pyramidChildren(height){
    for ( i= [0:1:$children-1])  
      linear_extrude(height = height, scale=1.5)
        children(i);
 }
 
 pyramidChildren(5)
    import(file = &quot;xxx.svg&quot;, center = true, dpi = 96);
</code></pre>
<p>I have tried to use the basic svg (multiple paths) and also to group each path (with only itself) without changes in the result.</p>

CC BY-SA 4.0
2020-12-28T13:22:01.717Z
Have you tried using `children()` on the object? This should allow you to manipulate each letter separately.
Mick
CC BY-SA 4.0
2020-12-28T17:54:25.477Z
Thanks @Mick I didn't know about `children()`. I tried this after your comment, but it did not change the outcome...
Oneira
CC BY-SA 4.0
2020-12-30T19:06:09.177Z
children doesn't help. The import is a single child node not a sequence of components from the SVG.
R.. GitHub STOP HELPING ICE
<openscad>
OpenSCAD linear_extrude from multiple path svg import
Oneira
# OpenSCAD linear_extrude from multiple path svg import

(Asked by: username_0 on 2020-12-28)

In OpenSCAD, I am trying to make a linear_extrude on a shape imported from an svg. The svg file contains multiple path. I would like to scale each path separately. I have tried the following code, but the whole import is considered a single shape resulting in the image below.
linear_extrude(height = 5, center = true, scale=1.2)
    import(file = "xxx.svg", center = true, dpi = 96);


How can I have each of the letters to have 'its own pyramid' ?
I know I could create one SVG per letter. But for simplicity sake I would like to have only one SVG file, as I want to create much more complex motives in the future. My final goal is to create stamps from SVG drawings.
Edit:
Alternative tried after Mick's comment (same result):
module pyramidChildren(height){
    for ( i= [0:1:$children-1])  
      linear_extrude(height = height, scale=1.5)
        children(i);
 }
 
 pyramidChildren(5)
    import(file = "xxx.svg", center = true, dpi = 96);

I have tried to use the basic svg (multiple paths) and also to group each path (with only itself) without changes in the result.

**Tags:** openscad
> **Comments:**
> **username_1**: Have you tried using `children()` on the object? This should allow you to manipulate each letter separately.  
> **username_0**: Thanks @Mick I didn't know about `children()`. I tried this after your comment, but it did not change the outcome...  
> **username_2**: children doesn't help. The import is a single child node not a sequence of components from the SVG.  

---

## 4 answers

### Answer by username_0 on 2020-12-29. Score: 6

Lame solution: creating stepped pyramid with offset. I realized that scale will not worked for motives with holes inside. Offset seems then more appropriate than scale for my application (creation of stamps)
It takes ages to render, but it could be enough for simple patterns. Any better solution are still welcome...
module buildPyramidalExtrude(height,maxOffset,nSlices){
    heightIncrement = height/nSlices;
    offsetIncrement = maxOffset/(nSlices-1);
    for(i=[1:nSlices])
        linear_extrude(height=i*heightIncrement)
              offset(r = maxOffset-(i-1)*offsetIncrement)
                children();
}

buildPyramidalExtrude(4,2.5,20)
   import(file = "Farm/cow.svg", center = true);


---

### Answer by username_2 on 2020-12-29. Score: 2

What you seem to want is not per-path scale but offset. This is an [open PR in OpenSCAD](https://github.com/openscad/openscad/pull/2079) and hopefully will be upstream soon.

> **Comments:**
> **username_0**: Looking forward to see it in upstream!  

---

### Answer by username_3 on 2022-02-13. Score: 1

One option is to use `minkowski()` to combine the svg with a cone. On the positive side, it gives a rather nice result, but the downsides are:

* it's pretty slow
* it fattens the bottom rather than shrinking the top, so depending on your needs you may have to invert the image, run `minkowski`, then invert again.

Another option is to convert to grayscale **png and apply a blur** with an external tool, then to import using `surface()` (the gray blur will become a nice slope). That will both fatten the bottom and shrink the top, but keeping only the top half should give the desired result.


---

### Answer by username_4 on 2022-12-23. Score: 1

Late to the question, but I'm working on a similar project as the question presents. My solution is to open the SVG file in Inkscape (version < 1.x) and use the [Path to OpenSCAD](https://www.thingiverse.com/thing:25036) extension to create a set of points for each entity.

The extension generates paths based on the desired extrusion height and places each set of points in its own module. In so doing, one can scale each individual entity and manipulate each one as desired.

[![Inkscape Extension for OpenSCAD use](https://i.sstatic.net/CoOQa.png)](https://i.sstatic.net/CoOQa.png)

Image from linked site.


---

