1
$\begingroup$

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);

result

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.

$\endgroup$
3
  • $\begingroup$ Have you tried using children() on the object? This should allow you to manipulate each letter separately. $\endgroup$ – Mick Dec 28 '20 at 13:22
  • $\begingroup$ Thanks @Mick I didn't know about children(). I tried this after your comment, but it did not change the outcome... $\endgroup$ – Oneira Dec 28 '20 at 17:54
  • $\begingroup$ children doesn't help. The import is a single child node not a sequence of components from the SVG. $\endgroup$ – R.. GitHub STOP HELPING ICE Dec 30 '20 at 19:06
2
$\begingroup$

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);

result

$\endgroup$
1
$\begingroup$

What you seem to want is not per-path scale but offset. This is an open PR in OpenSCAD and hopefully will be upstream soon.

$\endgroup$
1
  • $\begingroup$ Looking forward to see it in upstream! $\endgroup$ – Oneira Dec 29 '20 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.