Hello,
I successfully created a ellipse shaped profile (thanks to the guys on this
forum helping out!). Now i want to engrave text on the flat outside of this
ring, but i cant figure out how i could do it. Anybody a good idea? Its a
tough one, trust me.
Please help!
requires:
https://github.com/openscad/list-comprehension-demos
https://github.com/OskarLinde/scad-utils
use <list-comprehension-demos/sweep.scad>
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/lists.scad>
A=451/2; //long half-axis of ellipse
B=301/2; //short half-axis of ellipse
quarter_segments = 4; //Number of displayed quarter segments
/*
Brim cross section parameters
*/
ring_hoehe_ges = 20.00; // Total height of ring
ring_breite_ges = 10.00; // Total width of ring
ring_hoehe_overlap_aussen = 10.00; // Height of outer ring shield
ring_breite_overlap_aussen = 0.90; // Width of outer ring shield
ring_breite_vertiefung = 4.00;
ring_hoehe_vertiefung = 1.00;
step = 0.0005; // Step size for sweep
function e(i) = [
0,
A * cos(6 * 360 * i), //faktor 6?
B * sin(6 * 360 * i) //faktor 6?
];
module section(){
polygon( points = [
[0,0],
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -3.1],
[4.85, -3.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80]] //5.75 - 0.9 für Vertiefung
);
}
//!section();
module test_bezier(){
polygon( points = [[0, -12.8], [-0.608, -12.16], [-1.152, -11.52],
[-1.632, -10.88], [-2.048, -10.24], [-2.4, -9.6], [-2.688, -8.96], [-2.912,
-8.32], [-3.072, -7.68], [-3.168, -7.04], [-3.2, -6.4], [-3.168, -5.76],
[-3.072, -5.12], [-2.912, -4.48], [-2.688, -3.84], [-2.4, -3.2], [-2.048,
-2.56], [-1.632, -1.92], [-1.152, -1.28], [-0.608, -0.64]]
);
}
//!test_bezier();
function shape() = [
[0,0],
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -4.1], //Achtung: eigentlich -3.1!!!!!
[4.85, -4.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80],
[0,-12.80]]; //5.75 - 0.9 für Vertiefung
/*
To avoid degenerate polygon with roundtop
*/
function shape2() = [
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -3.1],
[4.85, -3.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80]]; //5.75 - 0.9 für Vertiefung
/*
Bezier functions
*/
function getpt(n1,n2,i) = n1+((n2-n1)*i);
function bezier(x1,y1,x2,y2,x3,y3,g) = [ for( i= [0:1/g:1+1/g])
[getpt(getpt(x1,x2,i),getpt(x2,x3,i),i),getpt(getpt(y1,y2,i),getpt(y2,y3,i),i)]];
//echo(bezier(0,0,2,12,10,0,30));
/*
Forms a top that seems slim from the outside and broad from the inside
/
function slimtop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=90+i90/g) r *
[xs+(cs*cos(a)), ys+sin(a)]];
/*
Forms a quarter top rounded from inside
/
function quartertop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=180+i90/g) r *
[xs+(cs*cos(a)), ys+sin(a)]];
/*
Forms a circular shaped top
/
function roundtop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=90+i180/g) r *
[xs+(cs*cos(a)), ys+sin(a)]];
/*
Create variants
*/
function variant_round() =
concat(reverse(shape2()),roundtop(6.4,100,2.0,0,-1));
function variant_thin_outside() =
concat(reverse(shape2()),slimtop(5,20,0.5,0,1));
function variant_quarter_round() =
concat(reverse(shape2()),quartertop(10,20,1.0,0,1));
function variant_bezier() =
concat(shape(),bezier(-3,-12.80,-15.5,-6.4,-3,0.00,100));
//!echo(bezier(0,-12.80,-6.4,-6.4,0,0,20));
module create_ellipse(){
path = [for (i=[0:step:(1*quarter_segments/4)-step]) e(i)];
path_transforms = construct_transform_path(path);
sweep(variant_bezier(), path_transforms);
echo(variant_bezier());
}
translate([0,0,14.59]){
mirror([1,0,0]){
rotate([180,90,0]){
create_ellipse();
}
}
}
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Something like this will give you the "projection" of the text on the
surface. Bending the text to follow the surface would be very difficult.
I am creating text that goes through the ellipse and intersecting a slightly
larger ellipse with it. If you want more precise control over the thickness
of the text then do a minkowski with the base ellipse and a
cube([2thickness,2thickness,0.01],center=true).
It will take a long time to compile.
Steve
xy_scale = 1.02;
//Explicit Union, don't really need it
union(){
intersection(){
translate([0,0,5])
rotate([90,0,90])
linear_extrude(height=175)
text("This is your text", halign="center", size = 16);
translate([0,0,14.59]){
scale([xy_scale,xy_scale,1])
mirror([1,0,0]){
rotate([180,90,0]){
create_ellipse();
}
}
}
}
translate([0,0,14.59]){
mirror([1,0,0]){
rotate([180,90,0]){
create_ellipse();
}
}
}
}
PYM wrote
Hello,
I successfully created a ellipse shaped profile (thanks to the guys on
this forum helping out!). Now i want to engrave text on the flat outside
of this ring, but i cant figure out how i could do it. Anybody a good
idea? Its a tough one, trust me.
Please help!
requires:
https://github.com/openscad/list-comprehension-demos
https://github.com/OskarLinde/scad-utils
use <list-comprehension-demos/sweep.scad>
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/lists.scad>
A=451/2; //long half-axis of ellipse
B=301/2; //short half-axis of ellipse
quarter_segments = 4; //Number of displayed quarter segments
/*
Brim cross section parameters
*/
ring_hoehe_ges = 20.00; // Total height of ring
ring_breite_ges = 10.00; // Total width of ring
ring_hoehe_overlap_aussen = 10.00; // Height of outer ring shield
ring_breite_overlap_aussen = 0.90; // Width of outer ring shield
ring_breite_vertiefung = 4.00;
ring_hoehe_vertiefung = 1.00;
step = 0.0005; // Step size for sweep
function e(i) = [
0,
A * cos(6 * 360 * i), //faktor 6?
B * sin(6 * 360 * i) //faktor 6?
];
module section(){
polygon( points = [
[0,0],
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -3.1],
[4.85, -3.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80]] //5.75 - 0.9 für Vertiefung
);
}
//!section();
module test_bezier(){
polygon( points = [[0, -12.8], [-0.608, -12.16], [-1.152, -11.52],
[-1.632, -10.88], [-2.048, -10.24], [-2.4, -9.6], [-2.688, -8.96],
[-2.912, -8.32], [-3.072, -7.68], [-3.168, -7.04], [-3.2, -6.4], [-3.168,
-5.76], [-3.072, -5.12], [-2.912, -4.48], [-2.688, -3.84], [-2.4, -3.2],
[-2.048, -2.56], [-1.632, -1.92], [-1.152, -1.28], [-0.608, -0.64]]
);
}
//!test_bezier();
function shape() = [
[0,0],
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -4.1], //Achtung: eigentlich -3.1!!!!!
[4.85, -4.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80],
[0,-12.80]]; //5.75 - 0.9 für Vertiefung
/*
To avoid degenerate polygon with roundtop
*/
function shape2() = [
[14.59, 0], //15,49 - 0.9 für Vertiefung
[14.59, -0.9],
[-0.9, -0.9],
[-0.9, -3.1],
[4.85, -3.1], //5.75 - 0.9 für Vertiefung
[4.85, -12.80]]; //5.75 - 0.9 für Vertiefung
/*
Bezier functions
*/
function getpt(n1,n2,i) = n1+((n2-n1)*i);
function bezier(x1,y1,x2,y2,x3,y3,g) = [ for( i= [0:1/g:1+1/g])
[getpt(getpt(x1,x2,i),getpt(x2,x3,i),i),getpt(getpt(y1,y2,i),getpt(y2,y3,i),i)]];
//echo(bezier(0,0,2,12,10,0,30));
/*
Forms a top that seems slim from the outside and broad from the inside
/
function slimtop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=90+i90/g) r *
[xs+(cs*cos(a)), ys+sin(a)]];
/*
Forms a quarter top rounded from inside
/
function quartertop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=180+i90/g) r
/*
Forms a circular shaped top
/
function roundtop(r,g,cs,xs,ys) = [for (i=[0:g-1]) let (a=90+i180/g) r *
[xs+(cs*cos(a)), ys+sin(a)]];
/*
Create variants
*/
function variant_round() =
concat(reverse(shape2()),roundtop(6.4,100,2.0,0,-1));
function variant_thin_outside() =
concat(reverse(shape2()),slimtop(5,20,0.5,0,1));
function variant_quarter_round() =
concat(reverse(shape2()),quartertop(10,20,1.0,0,1));
function variant_bezier() =
concat(shape(),bezier(-3,-12.80,-15.5,-6.4,-3,0.00,100));
//!echo(bezier(0,-12.80,-6.4,-6.4,0,0,20));
module create_ellipse(){
path = [for (i=[0:step:(1*quarter_segments/4)-step]) e(i)];
path_transforms = construct_transform_path(path);
sweep(variant_bezier(), path_transforms);
echo(variant_bezier());
}
translate([0,0,14.59]){
mirror([1,0,0]){
rotate([180,90,0]){
create_ellipse();
}
}
}
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13433.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi Steve,
thanks for your reply, i will give your idea a shot tomorrow. I think you
are right,doing it accurately is very difficult, but it should be doable. I
saw this code bending text around a parabola, so i think it should be
possible to also bend it on an ellipsoid shape.
https://www.thingiverse.com/thing:210099
https://www.thingiverse.com/thing:210099
Although i dont know how to transfer the code on a generic ellipsoid shape
yet. Can you help?
Patrick
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13434.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@PYM the scad_utils you reference don't contain shapes.scad, lists.scad and a
few others.
Where did you get those ones from ?
Maybe I should start a request for a sticky thread with the common libs
people include but aren't part of the OpenSCAD distro. We could keep it up
todate as OpenSCAD slowly includes their functionality (possibly).
I'm sure everyone has their favourites... ?
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13436.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I used this stuff to run PYM's design.
https://github.com/openscad/scad-utils
https://github.com/openscad/scad-utils
The other scad-utils has missing functions in addition to the missing files.
I think it must be an older version.
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13438.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hello,
yeah it is confusing, rickan's link is the correct one. Sorry for mixing up.
Anybody a solution yet? This problem drives me crazy!
Patrick
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13439.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi Steve, unfortunately your code gives me an error with CGAL:
Rendering Polygon Mesh using CGAL...
WARNING: Ignoring 3D child object for 2D operation
PolySet has nonplanar faces. Attempting alternate construction
ERROR: Alternate construction failed. CGAL error in CGAL_Nef_polyhedron3():
CGAL ERROR: assertion violation! Expr: pe != 0 File:
/data/OpenSCAD/libraries-mingw64-master/mxe-w64/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
Line: 212
Geometries in cache: 18
Geometry cache size in bytes: 100702352
CGAL Polyhedrons in cache: 170
CGAL cache size in bytes: 104805768
Total rendering time: 0 hours, 0 minutes, 31 seconds
Cheers,
Patrick
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13443.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Bump. Anybody has a solution to that?
--
View this message in context: http://forum.openscad.org/Tough-Nut-How-to-get-text-on-this-ellipse-shape-tp13430p13453.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On Mon, Aug 03, 2015 at 12:19:15PM -0700, PYM wrote:
Hello,
I successfully created a ellipse shaped profile (thanks to the guys on this
forum helping out!). Now i want to engrave text on the flat outside of this
ring, but i cant figure out how i could do it. Anybody a good idea? Its a
tough one, trust me.
Here's a starting point (untested):
for (i = [0:step:(1*quarter_segments/4)-step])
rotate (e_a (i), Z)
translate ([-e_r (i), -e_c (i), 0])
rotate (90, Z)
rotate (90, X)
linear_extrude (height)
text (t, valign = "center");
You'll need to figure out the formula for these functions:
e_r(i) gives you the radius from the center of your ellipse at that specific
point.
e_a(i) gives you the angle from the X axis for that particular point.
You should be able to get the e_r(i) and e_a(i) by converting e(i)'s coordinates
into polar coordinates.
e_c(i) gives you the partial circumference starting from i=0 until current i.
I'm still not sure about the formula for this.
--
Kind regards,
Loong Jin
On Thu, Aug 06, 2015 at 09:47:57AM +0800, Chow Loong Jin wrote:
On Mon, Aug 03, 2015 at 12:19:15PM -0700, PYM wrote:
Hello,
I successfully created a ellipse shaped profile (thanks to the guys on this
forum helping out!). Now i want to engrave text on the flat outside of this
ring, but i cant figure out how i could do it. Anybody a good idea? Its a
tough one, trust me.
Here's a starting point (untested):
for (i = [0:step:(1*quarter_segments/4)-step])
rotate (e_a (i), Z)
translate ([-e_r (i), -e_c (i), 0])
rotate (90, Z)
rotate (90, X)
linear_extrude (height)
text (t, valign = "center");
You'll need to figure out the formula for these functions:
e_r(i) gives you the radius from the center of your ellipse at that specific
point.
e_a(i) gives you the angle from the X axis for that particular point.
You should be able to get the e_r(i) and e_a(i) by converting e(i)'s coordinates
into polar coordinates.
e_c(i) gives you the partial circumference starting from i=0 until current i.
I'm still not sure about the formula for this.
Here's an animation to help you picture what's going on here:
https://cloud.githubusercontent.com/assets/3725313/4020624/8d55c042-2ac3-11e4-82d6-48f3c5a8b15b.gif
Imagine that the red piece is your text. You need to emulate that with an
elliptical path.
--
Kind regards,
Loong Jin