Offset then extrude offset

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Offset then extrude offset

xgarb
Is this possible? I can do it in Fusion 360

<http://forum.openscad.org/file/t3036/fusion360_unicorn.jpg>

I'm new to OpenSCAD and have gone through a bunch of examples and tutorials
but I've not worked out if it's possible or how to do it. This is my last
attempt which is the reverse of what I wanted.

<http://forum.openscad.org/file/t3036/openscad_unicorn.jpg>

module icon(){
    import(file = "unicorn.svg");
}

difference(){
    offset(r=2){
        icon();
    }
}

linear_extrude(height = 10, center = false, convexity = 10)
icon();

I want to be able to set up a script to automatically make extruded STLs
from icons.







--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Offset then extrude offset

crunchysteve
xgarb wrote

> Is this possible? I can do it in Fusion 360
>
> &lt;http://forum.openscad.org/file/t3036/fusion360_unicorn.jpg&gt; 
>
> I'm new to OpenSCAD and have gone through a bunch of examples and
> tutorials
> but I've not worked out if it's possible or how to do it. This is my last
> attempt which is the reverse of what I wanted.
>
> &lt;http://forum.openscad.org/file/t3036/openscad_unicorn.jpg&gt; 
>
> module icon(){
>     import(file = "unicorn.svg");
> }

^ this is OK...


xgarb wrote
> difference(){
>     offset(r=2){
>         icon();
>     }
> }

but what are you trying to difference here? If you have a command after the
offset close bracket and before the difference close bracket, then you will
take a difference of that line from the offset icon(), otherwise it's just
going to render the same as "offset(r=2) icon();" (for short commands, you
don't need the brackets, provided the command comes before the object.)


xgarb wrote
> linear_extrude(height = 10, center = false, convexity = 10)
> icon();

And the other problem is you've created several, separate instances of
icon() and done different things to them. You need to call icon(), place a
command around it (or before it without brackets), place the next command
around or before that for the next command, and so on...

linear_extrude(height=10,convexity=10) offset(r=2) icon(); <-- Yes, you CAN
write it this way!

If your SVG files don't have open space, you'll create solid tiles. For
example, if I created an SVG of this Apple Music icon, I'd need to cut the
white note pair out before making the the SVG for import into OpenSCAD, as
OpenSCAD has no colour sensing and SVGs are simply paths.
Screen_Shot_2020-12-05_at_7.png
<http://forum.openscad.org/file/t3026/Screen_Shot_2020-12-05_at_7.png>  

The OpenSCAD Cheat Sheet has been invaluable in pointing me at the right
parts of the manual at the right times. It's also a list of everything
possible.
http://www.openscad.org/cheatsheet/ <http://www.openscad.org/cheatsheet/>  

Keep learning. It looks a mile high where you're standing, but you'll get to
the top. Hells, I did... wel, I'm half way up.



-----
Make things, travel and tell stories.
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Make things, travel and tell stories.
Reply | Threaded
Open this post in threaded view
|

Re: Offset then extrude offset

Ronaldo
In reply to this post by xgarb
You are almost there:

height = 10;
thickness = 2;

difference() {
  linear_extrude(height=height, convexity=10)
    icon();
  translate([0,0,thickness])
    linear_extrude(height=height, convexity=10)
      offset(-thickness)
        icon();
}

Em sex., 4 de dez. de 2020 às 18:51, xgarb <[hidden email]> escreveu:
Is this possible? I can do it in Fusion 360

<http://forum.openscad.org/file/t3036/fusion360_unicorn.jpg>

I'm new to OpenSCAD and have gone through a bunch of examples and tutorials
but I've not worked out if it's possible or how to do it. This is my last
attempt which is the reverse of what I wanted.

<http://forum.openscad.org/file/t3036/openscad_unicorn.jpg>

module icon(){
    import(file = "unicorn.svg");
}

difference(){
    offset(r=2){
        icon();
    }
}

linear_extrude(height = 10, center = false, convexity = 10)
icon();

I want to be able to set up a script to automatically make extruded STLs
from icons.







--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Offset then extrude offset

JordanBrown
In reply to this post by xgarb
[ Sigh, sent from wrong e-mail address. ]

I don't have your SVG so I can't trivially check, but you probably want something like this:

module icon(){
    import(file = "unicorn.svg"); 
}

linear_extrude(height = 10, center = false, convexity = 10)
difference(){
    offset(r=2){
        icon();
    }
    icon();
}

You want to subtract the smaller version of the icon from the larger, and then extrude it.

(This is a little better than the 3D variant that Ronaldo supplied, because subtracting 2D objects is faster and doesn't require trickery to avoid Z-fighting.)



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org