I want to design a series of vases. Imagine the shape starting at the
bottom as a circle, and as you rise up, the circle gets smaller, then larger (a neck). But at some point, the circle becomes an ellipse, and then the orientation of the ellipse changes. So, the cross section changes in radius, and X and Y scale as you go up. So, I need to specify those three curves in order to specify the vase. I thought of creating the curves with Bezier curves inside OpenSCAD, but most implementations are limited to 4 control points; and working in OpenSCAD by typing in numbers could be both laborious and nonintuitive. I thought of creating the curves in InkScape, but 1) I'm not sure how to move them in to OpenSCAD, and B) the whole thing becomes a bit clunky (modify the curve in InkScape, Copy [or whatever], Paste into OpenSCAD, F5, rinse, repeat). Any suggestions about how to create a workflow that is less painful and [hopefully] intuitive? I realize that pieces of this have probably been discussed in the past Jon  Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
How do you feel about creating the curves of the cross section along the
Zaxis and performing a rotate_extrude? You get the fine detail control of Inkscape and very little code in OpenSCAD. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion#Rotate_Extrude  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by jon_bondy
This is the kind of shape I want to make, only with better control over
the shape It starts out symmetrical, but then the cross section changes from circular to elliptical. Not very compelling at the moment. I want to be able to draw a curve for the diameter, x scale, and y scale as a function of z. And then, of course, I will want curves for x and y translation. It never ends. inches = 25.4; $fn = 200; module Crosssections(i) { if (i < 90) // base and neck translate([0, 0, i]) cylinder(h = 0.1, d = (3 * cos(4*i) + 6) * inches); else if (i <= 180) // transition to ellipse translate([0, 0, i]) scale([1, 90 / i, 1]) cylinder(h = 0.1, d = 9 * inches); else if (i < 360) // transition to other ellipse translate([0, 0, i]) scale([360 / (2 * i), (180 + i) / 720, 1]) cylinder(h = 0.1, d = 9 * inches); } for (i = [1:360]) hull() { Crosssections(i); Crosssections(i+1); } On 2/15/2018 5:03 PM, jon wrote: > I want to design a series of vases. Imagine the shape starting at the > bottom as a circle, and as you rise up, the circle gets smaller, then > larger (a neck). But at some point, the circle becomes an ellipse, > and then the orientation of the ellipse changes. So, the cross > section changes in radius, and X and Y scale as you go up. So, I > need to specify those three curves in order to specify the vase. > > I thought of creating the curves with Bezier curves inside OpenSCAD, > but most implementations are limited to 4 control points; and working > in OpenSCAD by typing in numbers could be both laborious and > nonintuitive. > > I thought of creating the curves in InkScape, but 1) I'm not sure how > to move them in to OpenSCAD, and B) the whole thing becomes a bit > clunky (modify the curve in InkScape, Copy [or whatever], Paste into > OpenSCAD, F5, rinse, repeat). > > Any suggestions about how to create a workflow that is less painful > and [hopefully] intuitive? > > I realize that pieces of this have probably been discussed in the past > > Jon >  Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Administrator

In reply to this post by jon_bondy
Hi Jon,
I did this a while back by stacking a bunch of linear_extrude() segments: The $t stuff was to play with animations to discover fun variants. SLABS = 30; HEIGHT = 80; TWIST = 90*sin(2*$t*360+90); FREQ=180 + 360*$t; START=200+4*360*$t; SCALE=0.3; IDX=2; slab(HEIGHT/SLABS, 0, TWIST/SLABS, scale(0), scale(1/SLABS)) cross(); for (i = [0:SLABS1]) { translate([0,0,i*HEIGHT/SLABS]) { slab(HEIGHT/SLABS, i*TWIST/SLABS, (i+1)*TWIST/SLABS, scale(i/SLABS), scale((i+1)/SLABS)) slice(); } } module cross() { minkowski() { circle(r=3, $fn=16); union() { square([10,20], center=true); square([20,10], center=true); } } } module slab(h, rot_from, rot_to, scale_from, scale_to) { linear_extrude(height=h, twist=rot_torot_from, scale=scale_to/scale_from) { rotate(rot_from) scale(scale_from) children(); } } function scale(t) = 1+SCALE*(sin(t*FREQ + START)+1); module slice() { difference() { cross(); offset(1) cross(); } } _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by fred_dot_u
Another way of doing it is stacking cross sections, and then hulling an
unioning them in sequence.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by jon_bondy
> $fn = 200;
I've never needed such a high setting (especially while developing!) indeed some of my best pen pots relied on $fn being so small that the triangulation was a feature of the design... adding a twist to linear_extrude can make some great effects.... _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Troberg
On 20180216 10:03, Troberg wrote:
> Another way of doing it is stacking cross sections, and then hulling an > unioning them in sequence. This will only work if the cross sections are solid, without holes. For the typical vase it will not be the case, unless you are ok with creating 2 with slightly different X/Y scaling and subtract one from the other. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Troberg
I agree. My effort is towards allowing me to specify the cross sections
in a manner that is efficient and intuitive, rather than laborious and obscure. On 2/16/2018 4:03 AM, Troberg wrote: > Another way of doing it is stacking cross sections, and then hulling an > unioning them in sequence. > > > >  > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >  Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by fred_dot_u
You may consider using Bezier subdivision as expressed in [1]. That was in principle to generate points in a cubic Bezier curve defined by 4 control points but may be used in a more general setting. If you feed subdivb3() with more than 4 control points, it will generate points of all cubic Bezier arcs defined by p[3*j]... p[3*(j+1)] for some integer j To get smooth transition between arcs you will need some conditions on the control points: p[3*j] is in the segment with extremes p[3*j1] p[3*j+1] for all j>0 An easy way to satisfy this condition is to choose: p[3*j] = ( p[3*j1] + p[3*j+1] ) / 2 In subdivb3, n is the depth of recursion and should be a low integer. [1] http://forum.openscad.org/ Em 15 de fev de 2018 8:04 PM, "jon" <[hidden email]> escreveu:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by cacb
> This will only work if the cross sections are solid, without holes. For
> the typical vase it will not be the case, unless you are ok with > creating 2 with slightly different X/Y scaling and subtract one from the > other. How I've done similar tasks: * Have all the cross sections and make a solid shape by hulling and unioning. * Then, take each cross section (except the first, if you want a bottom), do a negative offset on each, hull and union. * Make a difference between the first object and the second object.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
On 20180216 13:47, Troberg wrote:
> How I've done similar tasks: > > * Have all the cross sections and make a solid shape by hulling and > unioning. > > * Then, take each cross section (except the first, if you want a > bottom), do > a negative offset on each, hull and union. > > * Make a difference between the first object and the second object. Yes, I agree this makes sense in many situations. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by cacb
I am happy to create a solid vase and then use my 3D printer to only
print the exterior. On 2/16/2018 5:59 AM, [hidden email] wrote: > On 20180216 10:03, Troberg wrote: >> Another way of doing it is stacking cross sections, and then hulling an >> unioning them in sequence. > > This will only work if the cross sections are solid, without holes. > For the typical vase it will not be the case, unless you are ok with > creating 2 with slightly different X/Y scaling and subtract one from > the other. > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >  Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
There're tools for getting from Inkscape to OpenSCAD at: https://www.shapeoko.com/wiki/index.php/Inkscape#Interface_w.2F_OpenSCAD On Fri, Feb 16, 2018 at 8:42 AM, jon <[hidden email]> wrote: I am happy to create a solid vase and then use my 3D printer to only print the exterior. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Administrator

> On Feb 16, 2018, at 8:51 AM, William Adams <[hidden email]> wrote:
> > There're tools for getting from Inkscape to OpenSCAD at: https://www.shapeoko.com/wiki/index.php/Inkscape#Interface_w.2F_OpenSCAD > You can also import SVG directly in the dev snapshot. That needs more users for testing. Marius _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by jon_bondy
Jon,
I think your project is just another example, why a more general interface for linear_extrude() would make sense. Of course sweep/skin functionality will also do as it provides the most general interface for extrusions. To show you some example code I implemented a fast solution on top of my Naca_sweep library. The general shape results from some fancy vase() function of z. It uses a translation, a component oriented scaling and some rotation. You can of course alter it to your needs provided you don't introduce selfintersection. vase() is used to define the inner and outer walls. To gain a constant wall thickness for distorted circles I implemented some sloppy outsetXY() function which works for wellbehaved polygons, but will fail on zaggy stuff. The trajectory climbs up the inner wall (starting with index 1 up to N) and then down the outer wall (ending with index N) and can be fed into a single sweep() call. use <Naca_sweep.scad> // https://www.thingiverse.com/thing:900137 $fn=100; sweep(concat(inner(), outer())); cube(); // test for manifoldness function inner(N=100) = [for(i=[0:N]) vase(i)] ; function outer(N=100) = [for(i=[N:1:1]) outsetXY(vase(i), 2)]; function vase(i) = // Rz_(i*i/30, // rotate polygon (Tz_(pow(i, 2)/100, // translate polygon S_(cos(i)+3, sin(4*i)+3,1, // scale polygon vec3D(circle()))))); // polygon function circle(r=10, d = undef, N=$fn?$fn:360/$fa) = let(r_ = d==undef?r:d/2) [for(i=[0:N1]) r_*[cos(360/N*i), sin(360/N*i)]]; function outsetXY(P, d=10) = [for(i=[0:len(P)1]) let(p=P[i]P[(i+1)%len(P)]) let(p_ = p/norm([p.x, p.y])) P[i]+d*[p_[1], p_[0], 0] ];  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
I have to correct my code to better match my explanation. Sorry for that.
renamed outsetXY() into insetXY() as it does an inset, and inner() and outer() are reversed. <http://forum.openscad.org/file/t887/vase.png> use <Naca_sweep.scad> $fn=100; sweep(concat(outer(), inner())); cube(); // test for manifoldness function outer(N=100) = [for(i=[0:N]) vase(i)] ; function inner(N=100) = [for(i=[N:1:1]) insetXY(vase(i), 3)]; function vase(i) = // Rz_(i*i/30, // rotate polygon (Tz_(pow(i, 2)/100, // translate polygon S_(cos(i)+3, sin(4*i)+3,1, // scale polygon vec3D(circle()))))); // polygon function circle(r=10, d = undef, N=$fn?$fn:360/$fa) = let(r_ = d==undef?r:d/2) [for(i=[0:N1]) r_*[cos(360/N*i), sin(360/N*i)]]; function insetXY(P, d=10) = [for(i=[0:len(P)1]) let(p=P[i]P[(i+1)%len(P)]) let(p_ = p/norm([p.x, p.y])) P[i]+d*[p_[1], p_[0], 0] ];  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Parkinbot
The terseness of your code always astonishes me. That said, what is
missing is a way to control the shape easily or intuitively. I do not want to limit my shapes to those that can be calculated with a few sin/cos variants. This is why I was heading towards using a series of smoothed curves to specify scaling, translation, and rotation. You have shown how I could use those scaling, translation, and rotation values if I could calculate them as a function of Z. What remains is a way to control these things "easily". Intuitively? Quickly? Note that there is no need to create the walls (create a hollow container) since I can use a slicer to accomplish that. Jon On 2/16/2018 9:14 AM, Parkinbot wrote: > use <Naca_sweep.scad> //https://www.thingiverse.com/thing:900137 > > $fn=100; > sweep(concat(inner(), outer())); > cube(); // test for manifoldness > > function inner(N=100) = > [for(i=[0:N]) vase(i)] ; > > function outer(N=100) = > [for(i=[N:1:1]) outsetXY(vase(i), 2)]; > > function vase(i) = // > Rz_(i*i/30, // rotate polygon > (Tz_(pow(i, 2)/100, // translate polygon > S_(cos(i)+3, sin(4*i)+3,1, // scale polygon > vec3D(circle()))))); // polygon > > function circle(r=10, d = undef, N=$fn?$fn:360/$fa) = > let(r_ = d==undef?r:d/2) [for(i=[0:N1]) r_*[cos(360/N*i), sin(360/N*i)]]; > > function outsetXY(P, d=10) = [for(i=[0:len(P)1]) > let(p=P[i]P[(i+1)%len(P)]) > let(p_ = p/norm([p.x, p.y])) > P[i]+d*[p_[1], p_[0], 0] ]; >  Sent from my desktop computer. I do not receive emails while away from my desk, nor do I receive texts on my main phone number (which is a land line). If you know that I am on the road, please text me. If you know that I am home, please email me. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
As I wrote, it is up to you to define or configure the vase() function to fit
your needs. You can define it piecewise, or use any other given or userdefined functions and shapes. However, OpenSCAD demands you to use Math to describe it :) I guess, this is the nonintuitive part you plan to avoid. Can't help you there, as it is intuitive for me.  Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by kintel
The SVG would then be used as a shape as part of a design. I want to
use that SVG (curve) to create a data table to be interpolated to produce X, Y, length, width, and rotation values (one curve per value). I imagine that this would take some work. :) On 2/16/2018 9:09 AM, Marius Kintel wrote: >> On Feb 16, 2018, at 8:51 AM, William Adams <[hidden email]> wrote: >> >> There're tools for getting from Inkscape to OpenSCAD at: https://www.shapeoko.com/wiki/index.php/Inkscape#Interface_w.2F_OpenSCAD >> > You can also import SVG directly in the dev snapshot. That needs more users for testing. > > Marius > _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by jon_bondy
On 15/02/18 22:03, jon wrote:
I thought of creating the curves with Bezier curves inside OpenSCAD, but most implementations are limited to 4 control points; and working in OpenSCAD by typing in numbers could be both laborious and nonintuitive. I've been designing a load of teapots and using splines to go from a few control points that I create to something smooth. For the bodies, I often just change diameter, but for the handles, I place circles in space and change both size and angle. Changing how elliptical would be very easy. See code here for an example. https://www.thingiverse.com/thing:2590534 Add "HData = HControl; " after the assignment of hdata to see the control points  I tend to comment such a line in and out when moving control points to aid placement. Sorry it's not intuitive and graphical, but I've been happy with the results. Links to required libraries are at the top of the file.
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Resume Templates  Edit this page 