discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Use of a file import for non-linear extrude function possible?

S
SNT
Thu, Oct 15, 2020 2:16 PM

Hello,

I'm a OPENSCAD beginner, and I have a problem, which is really challenging.
1st of all please excuse me my bad english. I'm a germay guy who is heavily
struggling with openscad. -> To my challenge:

Actually I realize an nonlinear extrude function in Z direction from a
simple *.dxf rectangle towards a cube. With a counter running from i=1 to
1000, I use a 0,1mm linear_extrude operation for each i. I get a cube with
100m height that way:

Single_Height=0.1;
for(i=[1:1000]) {
translate([0,0,i*Single_Height]) linear_extrude(Single_Height)
import(file = "/rectangle.dxf");
}

After this, each single extruded object is scaled by use of scale([,x,y,z]))
for every i. Using a mathematical function for z, I can realize nonlinear
stepwise extrusion in Z direction:

Single_Height=0.1;
for(i=[1:1000]) {
translate([0,0,iSingle_Height])
scale([1,cos(i
Single_Height/1.11),1])
linear_extrude(Single_Height) import(file = "/rectangle.dxf");
}

Now the challenge begins: I don't want to use a plenty of complex math.
formulas for very complex nonlinear extrusion. A single math function may be
understood easily but for more complex extrusion, fomula will either
massively expand or will be in form of several piecewise defined formulas.

I'm looking for a more creative and easier graphical way for very complex
nonlinear extrusion. Target is to use a  file (*.dxf or other) in which the
scale factor is set by a comfortable drawn grafic line, which is used for
the scaling. I would like to draw an arbitary line in a file, and make this
usable for scaling.

Does anybody has an idea in which way I could realize this very high
approach? Thank You in advance.

Regards SNT


I'm using OpenScad Version 2019.05

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

Hello, I'm a OPENSCAD beginner, and I have a problem, which is really challenging. 1st of all please excuse me my bad english. I'm a germay guy who is heavily struggling with openscad. -> To my challenge: Actually I realize an nonlinear extrude function in Z direction from a simple *.dxf rectangle towards a cube. With a counter running from i=1 to 1000, I use a 0,1mm linear_extrude operation for each i. I get a cube with 100m height that way: Single_Height=0.1; for(i=[1:1000]) { translate([0,0,i*Single_Height]) linear_extrude(Single_Height) import(file = "/rectangle.dxf"); } After this, each single extruded object is scaled by use of scale([,x,y,z])) for every i. Using a mathematical function for z, I can realize nonlinear stepwise extrusion in Z direction: Single_Height=0.1; for(i=[1:1000]) { translate([0,0,i*Single_Height]) scale([1,cos(i*Single_Height/1.11),1]) linear_extrude(Single_Height) import(file = "/rectangle.dxf"); } Now the challenge begins: I don't want to use a plenty of complex math. formulas for very complex nonlinear extrusion. A single math function may be understood easily but for more complex extrusion, fomula will either massively expand or will be in form of several piecewise defined formulas. I'm looking for a more creative and easier graphical way for very complex nonlinear extrusion. Target is to use a file (*.dxf or other) in which the scale factor is set by a comfortable drawn grafic line, which is used for the scaling. I would like to draw an arbitary line in a file, and make this usable for scaling. Does anybody has an idea in which way I could realize this very high approach? Thank You in advance. Regards SNT ----- I'm using OpenScad Version 2019.05 -- Sent from: http://forum.openscad.org/
CA
Carsten Arnholm
Thu, Oct 15, 2020 3:56 PM

On 15.10.2020 16:16, SNT wrote:

Single_Height=0.1;
for(i=[1:1000]) {
translate([0,0,iSingle_Height])
scale([1,cos(i
Single_Height/1.11),1])
linear_extrude(Single_Height) import(file = "/rectangle.dxf");
}

Now the challenge begins: I don't want to use a plenty of complex math.
formulas for very complex nonlinear extrusion. A single math function may be
understood easily but for more complex extrusion, fomula will either
massively expand or will be in form of several piecewise defined formulas.

For special cases where the input dxf is convex and without holes and
the function is such that the resulting body is also convex, then one
could in principle compute all the points on each level and from that
compute the body from the hull of the points. But in practice you can't
do that in OpenSCAD.

If you instead drop the above restrictions and allow any dxf shape,
possibly with internal holes, I think your only option is to do what you
are doing, but consider using fewer steps and instead use the "scale"
parameter when calling linear_extrude between the levels, something like:

linear_extrude(height=10,scale=[0.7,0.5])
square([30,40]);

Carsten Arnholm

On 15.10.2020 16:16, SNT wrote: > Single_Height=0.1; > for(i=[1:1000]) { > translate([0,0,i*Single_Height]) > scale([1,cos(i*Single_Height/1.11),1]) > linear_extrude(Single_Height) import(file = "/rectangle.dxf"); > } > > Now the challenge begins: I don't want to use a plenty of complex math. > formulas for very complex nonlinear extrusion. A single math function may be > understood easily but for more complex extrusion, fomula will either > massively expand or will be in form of several piecewise defined formulas. For special cases where the input dxf is convex and without holes and the function is such that the resulting body is also convex, then one could in principle compute all the points on each level and from that compute the body from the hull of the points. But in practice you can't do that in OpenSCAD. If you instead drop the above restrictions and allow any dxf shape, possibly with internal holes, I think your only option is to do what you are doing, but consider using fewer steps and instead use the "scale" parameter when calling linear_extrude between the levels, something like: linear_extrude(height=10,scale=[0.7,0.5]) square([30,40]); Carsten Arnholm