discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Issue between preview and rendering

R
regressor
Thu, Aug 20, 2015 2:05 AM

Hi,

I'm trying to create a teardrop shape using OpenSCAD - however I'm getting
issues with the rendering. It is only giving me a semicircle, yet in preview
it looks exactly how I want it to.

I have tried to translate the triangular portion so that it is inside the
semicircle, however this didn't seem to help.

Thanks,
Ed

radius = 15;
height = 10;
length = 50;

union () {
difference() {
cylinder(h=height,r=radius,center=false,$fn = 100);
translate([-radius,0,0])//translate so centered
cube(size=[radius2, radius2, height], center=false, $fn = 100);
//have so semicircle, slightly larger
}
//translate([0,-0.5,0])
polyhedron( //triangle
points = [
[-radius,0,0],[radius,0,0],[0,length,0], //bottom
[-radius,0,height],[radius,0,height],[0,length,height] //top
],
faces = [
[3,4,5],[0,1,2], //top and bottom
[0,3,5],[0,5,2], // -x to y
[0,4,3],[0,4,1], // -x to x
[1,4,2],[4,5,2] // x to y
], $fn = 100
);
}

--
View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hi, I'm trying to create a teardrop shape using OpenSCAD - however I'm getting issues with the rendering. It is only giving me a semicircle, yet in preview it looks exactly how I want it to. I have tried to translate the triangular portion so that it is inside the semicircle, however this didn't seem to help. Thanks, Ed radius = 15; height = 10; length = 50; union () { difference() { cylinder(h=height,r=radius,center=false,$fn = 100); translate([-radius,0,0])//translate so centered cube(size=[radius*2, radius*2, height], center=false, $fn = 100); //have so semicircle, slightly larger } //translate([0,-0.5,0]) polyhedron( //triangle points = [ [-radius,0,0],[radius,0,0],[0,length,0], //bottom [-radius,0,height],[radius,0,height],[0,length,height] //top ], faces = [ [3,4,5],[0,1,2], //top and bottom [0,3,5],[0,5,2], // -x to y [0,4,3],[0,4,1], // -x to x [1,4,2],[4,5,2] // x to y ], $fn = 100 ); } -- View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JL
Jean-Paul Louis
Thu, Aug 20, 2015 2:30 AM

Hi regressor,

try

$fn=180;

translate([0,0,20])
hull() {
scale([1,1,10/30]) sphere(15);
translate([0,50,0]) sphere(0.01);
}

translate([0,0,-20])
hull() {
cylinder(h=10,r=15);
translate([0,50,0]) cylinder(h=10,r=0.01);
}

Regards,
Jean-Paul
AC9GH

On Aug 19, 2015, at 10:05 PM, regressor ewyb2833@uni.sydney.edu.au wrote:

Hi,

I'm trying to create a teardrop shape using OpenSCAD - however I'm getting
issues with the rendering. It is only giving me a semicircle, yet in preview
it looks exactly how I want it to.

I have tried to translate the triangular portion so that it is inside the
semicircle, however this didn't seem to help.

Thanks,
Ed

radius = 15;
height = 10;
length = 50;

union () {
difference() {
cylinder(h=height,r=radius,center=false,$fn = 100);
translate([-radius,0,0])//translate so centered
cube(size=[radius2, radius2, height], center=false, $fn = 100);
//have so semicircle, slightly larger
}
//translate([0,-0.5,0])
polyhedron( //triangle
points = [
[-radius,0,0],[radius,0,0],[0,length,0], //bottom
[-radius,0,height],[radius,0,height],[0,length,height] //top
],
faces = [
[3,4,5],[0,1,2], //top and bottom
[0,3,5],[0,5,2], // -x to y
[0,4,3],[0,4,1], // -x to x
[1,4,2],[4,5,2] // x to y
], $fn = 100
);
}

--
View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi regressor, try $fn=180; translate([0,0,20]) hull() { scale([1,1,10/30]) sphere(15); translate([0,50,0]) sphere(0.01); } translate([0,0,-20]) hull() { cylinder(h=10,r=15); translate([0,50,0]) cylinder(h=10,r=0.01); } Regards, Jean-Paul AC9GH > On Aug 19, 2015, at 10:05 PM, regressor <ewyb2833@uni.sydney.edu.au> wrote: > > Hi, > > I'm trying to create a teardrop shape using OpenSCAD - however I'm getting > issues with the rendering. It is only giving me a semicircle, yet in preview > it looks exactly how I want it to. > > I have tried to translate the triangular portion so that it is inside the > semicircle, however this didn't seem to help. > > Thanks, > Ed > > > radius = 15; > height = 10; > length = 50; > > union () { > difference() { > cylinder(h=height,r=radius,center=false,$fn = 100); > translate([-radius,0,0])//translate so centered > cube(size=[radius*2, radius*2, height], center=false, $fn = 100); > //have so semicircle, slightly larger > } > //translate([0,-0.5,0]) > polyhedron( //triangle > points = [ > [-radius,0,0],[radius,0,0],[0,length,0], //bottom > [-radius,0,height],[radius,0,height],[0,length,height] //top > ], > faces = [ > [3,4,5],[0,1,2], //top and bottom > [0,3,5],[0,5,2], // -x to y > [0,4,3],[0,4,1], // -x to x > [1,4,2],[4,5,2] // x to y > ], $fn = 100 > ); > } > > > > -- > View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
M
MichaelAtOz
Thu, Aug 20, 2015 3:37 AM

Check View/Thrown-together (after F5 - maybe need to Design/Flush-cache) the
purple shows your polyhedron is inside out.


Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/

View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555p13557.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Check View/Thrown-together (after F5 - maybe need to Design/Flush-cache) the purple shows your polyhedron is inside out. ----- Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ -- View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555p13557.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Thu, Aug 20, 2015 3:43 AM

You also want to difference() something slightly bigger than the first object
otherwise the preview looks bad (https://en.wikipedia.org/wiki/Z-fighting),
like so

s=0.01;

union () {
difference() {
cylinder(h=height,r=radius,center=false,$fn = 100);
translate([-radius,0,-s])//translate so centered
cube(size=[radius2, radius2, height+s*2], center=false, $fn =
100); //have so semicircle, slightly larger
}

...


Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/

View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555p13558.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

You also want to difference() something slightly bigger than the first object otherwise the preview looks bad (https://en.wikipedia.org/wiki/Z-fighting), like so s=0.01; union () { difference() { cylinder(h=height,r=radius,center=false,$fn = 100); translate([-radius,0,-s])//translate so centered cube(size=[radius*2, radius*2, height+s*2], center=false, $fn = 100); //have so semicircle, slightly larger } ... ----- Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ -- View this message in context: http://forum.openscad.org/Issue-between-preview-and-rendering-tp13555p13558.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Thu, Aug 20, 2015 10:05 AM

If the model should stay as a flat object, it might be helpful to create
the shape in 2D and just extrude that at the end. In most cases that's
much faster then directly going to 3D and has no risk of producing
problematic geometry.

radius = 15;
height = 10;
length = 50;

linear_extrude(height = height) {
hull() {
circle(r = radius);
translate([0, length]) circle(r = 0.1);
}
}

If the model should stay as a flat object, it might be helpful to create the shape in 2D and just extrude that at the end. In most cases that's much faster then directly going to 3D and has no risk of producing problematic geometry. radius = 15; height = 10; length = 50; linear_extrude(height = height) { hull() { circle(r = radius); translate([0, length]) circle(r = 0.1); } }