discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Polyhedron generation from two parallel polygones?

A
adrianv
Wed, Jul 1, 2020 12:53 PM

At the top of each documentation page for BOSL2 it tells you what includes to
use for using the documented library file.  For skin.scad it says:

include <BOSL2/std.scad>
include <BOSL2/skin.scad>

Do you think this is insufficient and the includes should be repeated for
every example?  Note that you are not using rounding.scad in your example.
But you do need std.scad, which you don't list.

So have you achieved your goal or do you still have questions?

amundsen wrote

I managed to use BOSL2's skin function. The examples were lacking the
required use<> code.

So, here's a basic example of what I want to do.

use <BOSL2/skin.scad>
use <BOSL2/rounding.scad>

$fn=32;
polygon_steps = 100;
random_range = 1;

startshape = [for(i=[0:polygon_steps]) [cos(i/polygon_steps * 360) * 2 +
3,
sin(i/polygon_steps * 360) * 4 + 7]];
endshape = [for(i=[0:polygon_steps]) [cos(i/polygon_steps * 360) * 10 - 15
+
rands(-random_range, random_range,1)[0], sin(i/polygon_steps * 360) * 5 -
12

  • rands(-random_range, random_range,1)[0]]];

skin([startshape, endshape], z=[0,10], slices=10);

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


OpenSCAD mailing list

Discuss@.openscad

At the top of each documentation page for BOSL2 it tells you what includes to use for using the documented library file. For skin.scad it says: include <BOSL2/std.scad> include <BOSL2/skin.scad> Do you think this is insufficient and the includes should be repeated for every example? Note that you are not using rounding.scad in your example. But you do need std.scad, which you don't list. So have you achieved your goal or do you still have questions? amundsen wrote > I managed to use BOSL2's skin function. The examples were lacking the > required use<> code. > > So, here's a basic example of what I want to do. > > use &lt;BOSL2/skin.scad&gt; > use &lt;BOSL2/rounding.scad&gt; > > $fn=32; > polygon_steps = 100; > random_range = 1; > > startshape = [for(i=[0:polygon_steps]) [cos(i/polygon_steps * 360) * 2 + > 3, > sin(i/polygon_steps * 360) * 4 + 7]]; > endshape = [for(i=[0:polygon_steps]) [cos(i/polygon_steps * 360) * 10 - 15 > + > rands(-random_range, random_range,1)[0], sin(i/polygon_steps * 360) * 5 - > 12 > + rands(-random_range, random_range,1)[0]]]; > > skin([startshape, endshape], z=[0,10], slices=10); > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/
P
Parkinbot
Wed, Jul 1, 2020 2:39 PM

While your startshape is well behaved, your randomly constructed endshape is
not simple. I.e. it has self-intersections and therefore you won't get a
valid result - check with F12 for pink triangles.

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

While your startshape is well behaved, your randomly constructed endshape is not *simple*. I.e. it has self-intersections and therefore you won't get a valid result - check with F12 for pink triangles. -- Sent from: http://forum.openscad.org/
AP
Alexander Pruss
Wed, Jul 1, 2020 4:48 PM

My tubemesh library is designed precisely for this kind of thing. It allows
the two polygons to have different numbers of points, and tries to optimize
triangle placement. You can do a gradual morphing of one polygon into
another, with various transformations along the way. Sometimes you will have
problems with self-intersections, though often these can be avoided by
adding more morphing layers.

https://www.thingiverse.com/thing:2406760

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

My tubemesh library is designed precisely for this kind of thing. It allows the two polygons to have different numbers of points, and tries to optimize triangle placement. You can do a gradual morphing of one polygon into another, with various transformations along the way. Sometimes you will have problems with self-intersections, though often these can be avoided by adding more morphing layers. https://www.thingiverse.com/thing:2406760 -- Sent from: http://forum.openscad.org/
A
amundsen
Wed, Jul 1, 2020 6:45 PM

I am really happy with my current results (see picture) but I'll have a look
to your library @Alexander Pruss.

@Parkinbot random was just a tryout, I don't really need it.

Thank you everyone.

http://forum.openscad.org/file/t2715/extrusion_13bis.png

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

I am really happy with my current results (see picture) but I'll have a look to your library @Alexander Pruss. @Parkinbot random was just a tryout, I don't really need it. Thank you everyone. <http://forum.openscad.org/file/t2715/extrusion_13bis.png> -- Sent from: http://forum.openscad.org/
A
adrianv
Wed, Jul 1, 2020 7:13 PM

It looks like tubemesh is very similar to BOSL2 skin.  When you say
"gradually morphing of one polygon into another" do you mean simply a linear
interpolation to generate intermediate slices, or is there something else
going on?

Alexander Pruss wrote

My tubemesh library is designed precisely for this kind of thing. It
allows
the two polygons to have different numbers of points, and tries to
optimize
triangle placement. You can do a gradual morphing of one polygon into
another, with various transformations along the way. Sometimes you will
have
problems with self-intersections, though often these can be avoided by
adding more morphing layers.

https://www.thingiverse.com/thing:2406760

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


OpenSCAD mailing list

Discuss@.openscad

It looks like tubemesh is very similar to BOSL2 skin. When you say "gradually morphing of one polygon into another" do you mean simply a linear interpolation to generate intermediate slices, or is there something else going on? Alexander Pruss wrote > My tubemesh library is designed precisely for this kind of thing. It > allows > the two polygons to have different numbers of points, and tries to > optimize > triangle placement. You can do a gradual morphing of one polygon into > another, with various transformations along the way. Sometimes you will > have > problems with self-intersections, though often these can be avoided by > adding more morphing layers. > > https://www.thingiverse.com/thing:2406760 > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/
R
richalt2
Fri, Jul 3, 2020 6:06 PM

Let me also recommend the nSplines library by Parkinbot.
https://www.thingiverse.com/thing:1208001

His library also includes an interpolator which can be applied to an array
of linear lists, and extrapolate new entire lists.  Very nice for smoothing
out rough transitions from one list/polygon to the next!

I have used nSplines quite extensively, such as these flowers:
https://www.thingiverse.com/richalt2/designs

FYI, Rich


richalt2  (so why does the forum show me as OpenSCAD mailing list?)
Rich Altmaier

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

Let me also recommend the nSplines library by Parkinbot. https://www.thingiverse.com/thing:1208001 His library also includes an interpolator which can be applied to an array of linear lists, and extrapolate new entire lists. Very nice for smoothing out rough transitions from one list/polygon to the next! I have used nSplines quite extensively, such as these flowers: https://www.thingiverse.com/richalt2/designs FYI, Rich ----- richalt2 (so why does the forum show me as OpenSCAD mailing list?) Rich Altmaier -- Sent from: http://forum.openscad.org/
C
caterpillar
Wed, Jul 8, 2020 2:45 AM

If you want to use dotSCAD....

use <loft.scad>;
use <sweep.scad>;

$fn=32;
polygon_steps = 100;
random_range = 1;

startshape = [
for(i=[0:polygon_steps])
[
cos(i/polygon_steps * 360) * 2 + 3,
sin(i/polygon_steps * 360) * 4 + 7,
0
]
];

endshape = [
for(i=[0:polygon_steps])
[
cos(i/polygon_steps * 360) * 10 - 15 + rands(-random_range,
random_range,1)[0],
sin(i/polygon_steps * 360) * 5 - 12 + rands(-random_range,
random_range,1)[0],
10  // z
]
];

// I think sweep is enough.
sweep(
[
startshape,
endshape
]
);

/*
// In case you really want a slices parameter...
loft(
[
startshape,
endshape
],
slices = 4
);
*/


https://openhome.cc

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

If you want to use dotSCAD.... use <loft.scad>; use <sweep.scad>; $fn=32; polygon_steps = 100; random_range = 1; startshape = [ for(i=[0:polygon_steps]) [ cos(i/polygon_steps * 360) * 2 + 3, sin(i/polygon_steps * 360) * 4 + 7, 0 ] ]; endshape = [ for(i=[0:polygon_steps]) [ cos(i/polygon_steps * 360) * 10 - 15 + rands(-random_range, random_range,1)[0], sin(i/polygon_steps * 360) * 5 - 12 + rands(-random_range, random_range,1)[0], 10 // z ] ]; // I think `sweep` is enough. sweep( [ startshape, endshape ] ); /* // In case you really want a `slices` parameter... loft( [ startshape, endshape ], slices = 4 ); */ ----- https://openhome.cc -- Sent from: http://forum.openscad.org/
D
dpa
Wed, Jul 8, 2020 8:59 AM

ah!
btw.. I have a Library or a dotSCAD question: Your example starts with
use <loft.scad>;
use <sweep.scad>;

I see this often. But it never works. In order to get it working I need to
change it to
use <*dotSCAD/src/*loft.scad>;
use <*dotSCAD/src/*sweep.scad>;

Is this correct? And normal to need to search the lib' before I know the
exact path or is there a way to shorten this ?

[image: Bildschirmfoto 2020-07-08 um 10.50.47.png]

Am Mi., 8. Juli 2020 um 04:46 Uhr schrieb caterpillar
caterpillar@openhome.cc:

If you want to use dotSCAD....

use <loft.scad>;
use <sweep.scad>;

$fn=32;
polygon_steps = 100;
random_range = 1;

startshape = [
for(i=[0:polygon_steps])
[
cos(i/polygon_steps * 360) * 2 + 3,
sin(i/polygon_steps * 360) * 4 + 7,
0
]
];

endshape = [
for(i=[0:polygon_steps])
[
cos(i/polygon_steps * 360) * 10 - 15 + rands(-random_range,
random_range,1)[0],
sin(i/polygon_steps * 360) * 5 - 12 + rands(-random_range,
random_range,1)[0],
10  // z
]
];

// I think sweep is enough.
sweep(
[
startshape,
endshape
]
);

/*
// In case you really want a slices parameter...
loft(
[
startshape,
endshape
],
slices = 4
);
*/


https://openhome.cc

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


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

ah! btw.. I have a Library or a dotSCAD question: Your example starts with use <loft.scad>; use <sweep.scad>; I see this often. But it never works. In order to get it working I need to change it to use <*dotSCAD/src/*loft.scad>; use <*dotSCAD/src/*sweep.scad>; Is this correct? And normal to need to search the lib' before I know the exact path or is there a way to shorten this ? [image: Bildschirmfoto 2020-07-08 um 10.50.47.png] Am Mi., 8. Juli 2020 um 04:46 Uhr schrieb caterpillar <caterpillar@openhome.cc>: > If you want to use dotSCAD.... > > use <loft.scad>; > use <sweep.scad>; > > $fn=32; > polygon_steps = 100; > random_range = 1; > > startshape = [ > for(i=[0:polygon_steps]) > [ > cos(i/polygon_steps * 360) * 2 + 3, > sin(i/polygon_steps * 360) * 4 + 7, > 0 > ] > ]; > > endshape = [ > for(i=[0:polygon_steps]) > [ > cos(i/polygon_steps * 360) * 10 - 15 + rands(-random_range, > random_range,1)[0], > sin(i/polygon_steps * 360) * 5 - 12 + rands(-random_range, > random_range,1)[0], > 10 // z > ] > ]; > > // I think `sweep` is enough. > sweep( > [ > startshape, > endshape > ] > ); > > /* > // In case you really want a `slices` parameter... > loft( > [ > startshape, > endshape > ], > slices = 4 > ); > */ > > > > > > ----- > https://openhome.cc > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
C
caterpillar
Wed, Jul 8, 2020 9:16 AM

The libraries folder of OpenSCAD is only one of library locations.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries

I set OPENSCADPATH to the src folder of dotSCAD so all my examples start
from the root of src.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH


https://openhome.cc

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

The `libraries` folder of OpenSCAD is only one of library locations. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries I set `OPENSCADPATH` to the src folder of dotSCAD so all my examples start from the root of src. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH ----- https://openhome.cc -- Sent from: http://forum.openscad.org/
D
dpa
Wed, Jul 8, 2020 11:02 AM

I see thank you. This reminds me of a long unsuccessful run. I just tried
it - again no success..  am I to stupid for this? I entered the correct*
path into every .profile:
(* when I call this path in Finder (via cmd+shift+g)
/Users/dpa/Documents/OpenSCAD/libraries/dotSCAD/src then I end up at the
correct path)

  • /User/[me]/.profile
  • /User/[me]/.profile~
  • /User/[me]/.bash_profile

restarted openSCAD .."WARNING: Can't open library 'loft.scad'.WARNING:
Can't open library 'sweep.scad'.
logged out, in: "WARNING: Can't open library 'loft.scad'.WARNING: Can't
open library 'sweep.scad'.
fully restarted: "WARNING: Can't open library 'loft.scad'.WARNING: Can't
open library 'sweep.scad'.

😨

Am Mi., 8. Juli 2020 um 11:17 Uhr schrieb caterpillar
caterpillar@openhome.cc:

The libraries folder of OpenSCAD is only one of library locations.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries

I set OPENSCADPATH to the src folder of dotSCAD so all my examples start
from the root of src.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH


https://openhome.cc

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


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

I see thank you. This reminds me of a long unsuccessful run. I just tried it - again no success.. am I to stupid for this? I entered the correct* path into every .profile: (* when I call this path in Finder (via cmd+shift+g) /Users/dpa/Documents/OpenSCAD/libraries/dotSCAD/src then I end up at the correct path) - /User/[me]/.profile - /User/[me]/.profile~ - /User/[me]/.bash_profile restarted openSCAD .."WARNING: Can't open library 'loft.scad'.WARNING: Can't open library 'sweep.scad'. logged out, in: "WARNING: Can't open library 'loft.scad'.WARNING: Can't open library 'sweep.scad'. fully restarted: "WARNING: Can't open library 'loft.scad'.WARNING: Can't open library 'sweep.scad'. 😨 Am Mi., 8. Juli 2020 um 11:17 Uhr schrieb caterpillar <caterpillar@openhome.cc>: > The `libraries` folder of OpenSCAD is only one of library locations. > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries > > I set `OPENSCADPATH` to the src folder of dotSCAD so all my examples start > from the root of src. > > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH > > > > > > ----- > https://openhome.cc > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >