Look at the following code to draw a heart (it's Christmas, after all). The
first module draws a heart, but I also wanted just a heart outline, so I
made the second. It works by drawing a heart, then drawing a heart of
similar size, do a negative offset, extrude and difference.
module hjarta(width,tjocklek){
spets=width*0.7;
color([1,0,0])
linear_extrude(tjocklek)
union(){
hull(){
translate([-width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[1,spets],[-width/2,spets]]);
}
hull(){
translate([width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[width/2,spets],[-1,spets]]);
}
}
}
module hjartaoutline(width,outlinewidth,tjocklek){
spets=width*0.7;
color([1,0,0])
difference(){
hjarta(width,tjocklek);
translate([0,0,-1])
linear_extrude(tjocklek+2)
offset(delta=-outlinewidth)
union(){
hull(){
translate([-width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[1,spets],[-width/2,spets]]);
}
hull(){
translate([width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[width/2,spets],[-1,spets]]);
}
}
}
}
hjartaoutline(60,5,10);
It looks great from above, but zoom in and look from a low angle at the area
around the inner tip, and it looks like faces are missing.
What am I doing wrong?
(Of course, if anyone wants to use the heart code, have fun.)
--
Sent from: http://forum.openscad.org/
Your rendered model is fine. The missing faces are artifacts of the preview
process. To avoid them just add the argument convexity=10 to all
linear_extrude().
See:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion#Linear_Extrude
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion#Linear_Extrude
2017-12-11 10:52 GMT-02:00 Troberg troberg.anders@gmail.com:
Look at the following code to draw a heart (it's Christmas, after all). The
first module draws a heart, but I also wanted just a heart outline, so I
made the second. It works by drawing a heart, then drawing a heart of
similar size, do a negative offset, extrude and difference.
module hjarta(width,tjocklek){
spets=width*0.7;
color([1,0,0])
linear_extrude(tjocklek)
union(){
hull(){
translate([-width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[1,spets],[-width/2,spets]]);
}
hull(){
translate([width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[width/2,spets],[-1,spets]]);
}
}
}
module hjartaoutline(width,outlinewidth,tjocklek){
spets=width*0.7;
color([1,0,0])
difference(){
hjarta(width,tjocklek);
translate([0,0,-1])
linear_extrude(tjocklek+2)
offset(delta=-outlinewidth)
union(){
hull(){
translate([-width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[1,spets],[-width/2,spets]]);
}
hull(){
translate([width/4,spets,0])
circle(d=width/2);
polygon([[0,0],[width/2,spets],[-1,spets]]);
}
}
}
}
hjartaoutline(60,5,10);
It looks great from above, but zoom in and look from a low angle at the
area
around the inner tip, and it looks like faces are missing.
What am I doing wrong?
(Of course, if anyone wants to use the heart code, have fun.)
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Worked like a charm!
I kept think I've done something wrong in my logic, and kept checking that.
I didn't think as far as the under the hood considerations.
--
Sent from: http://forum.openscad.org/
On 12/11/2017 5:19 AM, Ronaldo Persiano wrote:
Your rendered model is fine. The missing faces are artifacts of the
preview process. To avoid them just add the argument convexity=10 to
all linear_extrude().
Why isn't convexity=10 (or whatever) the default? What's the downside?
Should I be defining my own linear_extrude module that just always slaps
in a convexity=10?
There is a performance penalty for convexity. More convex shapes need a higher convexity setting; setting it manually allows for user control.
Sent from my iPhone
On Dec 11, 2017, at 11:02 AM, Jordan Brown openscad@jordan.maileater.net wrote:
On 12/11/2017 5:19 AM, Ronaldo Persiano wrote:
Your rendered model is fine. The missing faces are artifacts of the preview process. To avoid them just add the argument convexity=10 to all linear_extrude().
Why isn't convexity=10 (or whatever) the default? What's the downside? Should I be defining my own linear_extrude module that just always slaps in a convexity=10?
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Well, he has a point. Perhaps a higher default would make sense.
Why?
Because the people who are likely to run into performance issues are the
ones who are more advanced users. They can probably explicitly set a lower
limit.
Because performance of the hardware is increasing all the time, so
performance issues are likely to go away, given time.
Standard programming wisdom: Make it work first, then look at performance.
It wouldn't break existing code.
--
Sent from: http://forum.openscad.org/
Save for the fact that often on this list people complaining of
excessive "compile" times are those that have (seemingly) randomly
changed defaults and unknowingly created models with a bazillion vertices...
convexity only affects F5 preview times. It doesn't seem to affect it much
either. When I can be bothered I set it appropriately, other times a random
number big enough.
On 11 December 2017 at 22:00, Chris Camacho chris@bedroomcoders.co.uk
wrote:
ones who are more advanced users. They can probably explicitly set a lower
limit.
Save for the fact that often on this list people complaining of excessive
"compile" times are those that have (seemingly) randomly changed defaults
and unknowingly created models with a bazillion vertices...
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org