discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Joining lists of points together

JH
Jose H
Sun, Dec 12, 2021 10:00 PM

Hello,

My name is Jose and I want to create a library for joining rectangular
aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find OpenSCAD
would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape. This
profile can be seen on the attached (freecad)screenshot and I have a
problem creating that on Openscad.
Then I remove some material using boolean operations but that is not
problematic to create.

My problem is this, imagine that I have a polygon created by a list of
points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];
inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:
list1= [p0,p1,p2,p3];
another with the inside point:
list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 = [list1,
list2] but I don't know how to do that or if that is possible. I tried
different things and openscad compiler fails.

Why I want this?
If you see the picture there is a round corner in the polygon, that round
corner could have ten,a hundred points or a thousand depending on the
resolution and can be created from the tutorial using something like:
points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and can
be grouped in another list.

Is it possible to join those two list together? This way the parametric
list does not affect the fixed one, and it would be very easy to create a
parametric shape.

It looks Openscad language is too limited for dynamic manipulation of lists
and that only lets you do static. Maybe trying to do that in such limited
language is a bad idea and I should focus on using python scripts instead.
Why do you think?

Hello, My name is Jose and I want to create a library for joining rectangular aluminum profiles in OpenScad using 3D printed pieces. I already have those created in Freecad and CADQuerry but I find OpenSCAD would be easier to use for most people. I start with a 2d polygon that I extrude to create the general shape. This profile can be seen on the attached (freecad)screenshot and I have a problem creating that on Openscad. Then I remove some material using boolean operations but that is not problematic to create. My problem is this, imagine that I have a polygon created by a list of points: p0 = [0, 0]; p1 = [0, 10]; p2 = [10, 10]; p3 = [10, 0]; inside_point = [5, 5]; points = [p0, p1, p2, p3, inside_point]; polygon(points); What I want to do is create one list with four points: list1= [p0,p1,p2,p3]; another with the inside point: list2= [inside_point]; And then create a new list that is list2 appended to list1. list3 = [list1, list2] but I don't know how to do that or if that is possible. I tried different things and openscad compiler fails. Why I want this? If you see the picture there is a round corner in the polygon, that round corner could have ten,a hundred points or a thousand depending on the resolution and can be created from the tutorial using something like: points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; Then there are 5 points of the rest of the corners that are fixed and can be grouped in another list. Is it possible to join those two list together? This way the parametric list does not affect the fixed one, and it would be very easy to create a parametric shape. It looks Openscad language is too limited for dynamic manipulation of lists and that only lets you do static. Maybe trying to do that in such limited language is a bad idea and I should focus on using python scripts instead. Why do you think?
NH
nop head
Sun, Dec 12, 2021 10:06 PM

You can join lists with concat(list1, list2);

You can also have a list with fixed points and multiple for loops in the
same list comprehension.

On Sun, 12 Dec 2021 at 22:00, Jose H jose.francisco.hevia@gmail.com wrote:

Hello,

My name is Jose and I want to create a library for joining rectangular
aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find OpenSCAD
would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape. This
profile can be seen on the attached (freecad)screenshot and I have a
problem creating that on Openscad.
Then I remove some material using boolean operations but that is not
problematic to create.

My problem is this, imagine that I have a polygon created by a list of
points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];
inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:
list1= [p0,p1,p2,p3];
another with the inside point:
list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 =
[list1, list2] but I don't know how to do that or if that is possible. I
tried different things and openscad compiler fails.

Why I want this?
If you see the picture there is a round corner in the polygon, that round
corner could have ten,a hundred points or a thousand depending on the
resolution and can be created from the tutorial using something like:
points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and can
be grouped in another list.

Is it possible to join those two list together? This way the parametric
list does not affect the fixed one, and it would be very easy to create a
parametric shape.

It looks Openscad language is too limited for dynamic manipulation of
lists and that only lets you do static. Maybe trying to do that in such
limited language is a bad idea and I should focus on using python scripts
instead.
Why do you think?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You can join lists with concat(list1, list2); You can also have a list with fixed points and multiple for loops in the same list comprehension. On Sun, 12 Dec 2021 at 22:00, Jose H <jose.francisco.hevia@gmail.com> wrote: > Hello, > > My name is Jose and I want to create a library for joining rectangular > aluminum profiles in OpenScad using 3D printed pieces. > > I already have those created in Freecad and CADQuerry but I find OpenSCAD > would be easier to use for most people. > > I start with a 2d polygon that I extrude to create the general shape. This > profile can be seen on the attached (freecad)screenshot and I have a > problem creating that on Openscad. > Then I remove some material using boolean operations but that is not > problematic to create. > > My problem is this, imagine that I have a polygon created by a list of > points: > > p0 = [0, 0]; > p1 = [0, 10]; > p2 = [10, 10]; > p3 = [10, 0]; > inside_point = [5, 5]; > > points = [p0, p1, p2, p3, inside_point]; > polygon(points); > > What I want to do is create one list with four points: > list1= [p0,p1,p2,p3]; > another with the inside point: > list2= [inside_point]; > > And then create a new list that is list2 appended to list1. list3 = > [list1, list2] but I don't know how to do that or if that is possible. I > tried different things and openscad compiler fails. > > Why I want this? > If you see the picture there is a round corner in the polygon, that round > corner could have ten,a hundred points or a thousand depending on the > resolution and can be created from the tutorial using something like: > points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; > > Then there are 5 points of the rest of the corners that are fixed and can > be grouped in another list. > > Is it possible to join those two list together? This way the parametric > list does not affect the fixed one, and it would be very easy to create a > parametric shape. > > It looks Openscad language is too limited for dynamic manipulation of > lists and that only lets you do static. Maybe trying to do that in such > limited language is a bad idea and I should focus on using python scripts > instead. > Why do you think? > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
MichaelAtOz
Sun, Dec 12, 2021 10:17 PM

You can also have a list with fixed points and multiple for loops in the same list comprehension.

i.e. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/List_Comprehensions


From: nop head [mailto:nop.head@gmail.com]
Sent: Mon, 13 Dec 2021 09:06
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: Joining lists of points together

You can join lists with concat(list1, list2);

You can also have a list with fixed points and multiple for loops in the same list comprehension.

On Sun, 12 Dec 2021 at 22:00, Jose H jose.francisco.hevia@gmail.com wrote:

Hello,

My name is Jose and I want to create a library for joining rectangular aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find OpenSCAD would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape. This profile can be seen on the attached (freecad)screenshot and I have a problem creating that on Openscad.

Then I remove some material using boolean operations but that is not problematic to create.

My problem is this, imagine that I have a polygon created by a list of points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];

inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:

list1= [p0,p1,p2,p3];

another with the inside point:

list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 = [list1, list2] but I don't know how to do that or if that is possible. I tried different things and openscad compiler fails.

Why I want this?

If you see the picture there is a round corner in the polygon, that round corner could have ten,a hundred points or a thousand depending on the resolution and can be created from the tutorial using something like:

points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and can be grouped in another list.

Is it possible to join those two list together? This way the parametric list does not affect the fixed one, and it would be very easy to create a parametric shape.

It looks Openscad language is too limited for dynamic manipulation of lists and that only lets you do static. Maybe trying to do that in such limited language is a bad idea and I should focus on using python scripts instead.

Why do you think?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

> You can also have a list with fixed points and multiple for loops in the same list comprehension. i.e. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/List_Comprehensions _____ From: nop head [mailto:nop.head@gmail.com] Sent: Mon, 13 Dec 2021 09:06 To: OpenSCAD general discussion Subject: [OpenSCAD] Re: Joining lists of points together You can join lists with concat(list1, list2); You can also have a list with fixed points and multiple for loops in the same list comprehension. On Sun, 12 Dec 2021 at 22:00, Jose H <jose.francisco.hevia@gmail.com> wrote: Hello, My name is Jose and I want to create a library for joining rectangular aluminum profiles in OpenScad using 3D printed pieces. I already have those created in Freecad and CADQuerry but I find OpenSCAD would be easier to use for most people. I start with a 2d polygon that I extrude to create the general shape. This profile can be seen on the attached (freecad)screenshot and I have a problem creating that on Openscad. Then I remove some material using boolean operations but that is not problematic to create. My problem is this, imagine that I have a polygon created by a list of points: p0 = [0, 0]; p1 = [0, 10]; p2 = [10, 10]; p3 = [10, 0]; inside_point = [5, 5]; points = [p0, p1, p2, p3, inside_point]; polygon(points); What I want to do is create one list with four points: list1= [p0,p1,p2,p3]; another with the inside point: list2= [inside_point]; And then create a new list that is list2 appended to list1. list3 = [list1, list2] but I don't know how to do that or if that is possible. I tried different things and openscad compiler fails. Why I want this? If you see the picture there is a round corner in the polygon, that round corner could have ten,a hundred points or a thousand depending on the resolution and can be created from the tutorial using something like: points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; Then there are 5 points of the rest of the corners that are fixed and can be grouped in another list. Is it possible to join those two list together? This way the parametric list does not affect the fixed one, and it would be very easy to create a parametric shape. It looks Openscad language is too limited for dynamic manipulation of lists and that only lets you do static. Maybe trying to do that in such limited language is a bad idea and I should focus on using python scripts instead. Why do you think? _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
TP
Torsten Paul
Sun, Dec 12, 2021 10:19 PM

Declaring lists is pretty flexible. Using "each" you can inline other lists, or just directly use additional loops or fixed values.

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];

list1 = [ p0, p1 ];

list2 = [ p2 ];

list3 = [
each list1,
p3,
each list2,
for (x = [1:3]) [x, 0],
[5, 5]
];

echo(list3);

Declaring lists is pretty flexible. Using "each" you can inline other lists, or just directly use additional loops or fixed values. p0 = [0, 0]; p1 = [0, 10]; p2 = [10, 10]; p3 = [10, 0]; list1 = [ p0, p1 ]; list2 = [ p2 ]; list3 = [ each list1, p3, each list2, for (x = [1:3]) [x, 0], [5, 5] ]; echo(list3);
RW
Raymond West
Sun, Dec 12, 2021 11:31 PM

Hi Jose,

I wouldn't do it like that, not for that shape, need no polygons.

If it is plates that you want, then in 2D

difference(){
   union() {
       translate([8,0])
        square([20,10]);
      translate ([0,8])
        square([10,20]);
     translate([8,8])
        circle (r=8);
        }
    translate([10,10])  // chop out back of circle.
       square(20);
}

Easy enough to make these simple shapes parametric, put the dimensions
in a list/whatever for different sized tubes, etc. ( I guessed your
dimensions, but you should get the idea).

But, if it is 'bent tubes' into which the ali sections are inserted,
then use cubes and cylinders, and repeat but add whatever wall thickness
you want for your part, and difference (offsetting, correctly of course).

You can set $fn to fix the number of steps around the curve. For this
sort of thing, openscad is far, far better than freecad, imnsho.

Best wishes,

Ray

On 12/12/2021 22:00, Jose H wrote:

Hello,

My name is Jose and I want to create a library for joining rectangular
aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find
OpenSCAD would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape.
This profile can be seen on the attached (freecad)screenshot and I
have a problem creating that on Openscad.
Then I remove some material using boolean operations but that is not
problematic to create.

My problem is this, imagine that I have a polygon created by a list of
points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];
inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:
list1= [p0,p1,p2,p3];
another with the inside point:
list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 =
[list1, list2] but I don't know how to do that or if that is possible.
I tried different things and openscad compiler fails.

Why I want this?
If you see the picture there is a round corner in the polygon, that
round corner could have ten,a hundred points or a thousand depending
on the resolution and can be created from the tutorial using something
like:
points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and
can be grouped in another list.

Is it possible to join those two list together? This way the
parametric list does not affect the fixed one, and it would be very
easy to create a parametric shape.

It looks Openscad language is too limited for dynamic manipulation of
lists and that only lets you do static. Maybe trying to do that in
such limited language is a bad idea and I should focus on using python
scripts instead.
Why do you think?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hi Jose, I wouldn't do it like that, not for that shape, need no polygons. If it is plates that you want, then in 2D difference(){    union() {        translate([8,0])         square([20,10]);       translate ([0,8])         square([10,20]);      translate([8,8])         circle (r=8);         }     translate([10,10])  // chop out back of circle.        square(20); } Easy enough to make these simple shapes parametric, put the dimensions in a list/whatever for different sized tubes, etc. ( I guessed your dimensions, but you should get the idea). But, if it is 'bent tubes' into which the ali sections are inserted, then use cubes and cylinders, and repeat but add whatever wall thickness you want for your part, and difference (offsetting, correctly of course). You can set $fn to fix the number of steps around the curve. For this sort of thing, openscad is far, far better than freecad, imnsho. Best wishes, Ray On 12/12/2021 22:00, Jose H wrote: > Hello, > > My name is Jose and I want to create a library for joining rectangular > aluminum profiles in OpenScad using 3D printed pieces. > > I already have those created in Freecad and CADQuerry but I find > OpenSCAD would be easier to use for most people. > > I start with a 2d polygon that I extrude to create the general shape. > This profile can be seen on the attached (freecad)screenshot and I > have a problem creating that on Openscad. > Then I remove some material using boolean operations but that is not > problematic to create. > > My problem is this, imagine that I have a polygon created by a list of > points: > > p0 = [0, 0]; > p1 = [0, 10]; > p2 = [10, 10]; > p3 = [10, 0]; > inside_point = [5, 5]; > > points = [p0, p1, p2, p3, inside_point]; > polygon(points); > > What I want to do is create one list with four points: > list1= [p0,p1,p2,p3]; > another with the inside point: > list2= [inside_point]; > > And then create a new list that is list2 appended to list1. list3 = > [list1, list2] but I don't know how to do that or if that is possible. > I tried different things and openscad compiler fails. > > Why I want this? > If you see the picture there is a round corner in the polygon, that > round corner could have ten,a hundred points or a thousand depending > on the resolution and can be created from the tutorial using something > like: > points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; > > Then there are 5 points of the rest of the corners that are fixed and > can be grouped in another list. > > Is it possible to join those two list together? This way the > parametric list does not affect the fixed one, and it would be very > easy to create a parametric shape. > > It looks Openscad language is too limited for dynamic manipulation of > lists and that only lets you do static. Maybe trying to do that in > such limited language is a bad idea and I should focus on using python > scripts instead. > Why do you think? > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
RW
Raymond West
Mon, Dec 13, 2021 12:05 AM

Or, if the same proportions exist for all angle pieces, then -

w =10; //width of plate

difference(){
   union() {
       translate([w*.8,0])
        square([w+w,w]);
      translate ([0,w*.8])
        square([w,w+w]);
     translate([w*.8,w*.8])
        circle (r=w*.8);
        }
    translate([w,w])  // chop out back of circle.
       square(w+w);
}

you could use  'for' to iterate over a list of w's, to produce all the
parts needed, whatever values of w are required.

If it is tubular corner pieces, and the aluminium sections fit inside,
then a 3d equivalent will only need the width and height of the ali
cross section (assuming it is square) and the wall thickness of your
printed piece. Similar concept for 'T' pieces and corners for joining
thee tubes at right angles, or any other design you wish.

-------- Forwarded Message --------
Subject: Re: [OpenSCAD] Joining lists of points together
Date: Sun, 12 Dec 2021 23:31:58 +0000
From: Raymond West raywest@raywest.com
To: discuss@lists.openscad.org

Hi Jose,

I wouldn't do it like that, not for that shape, need no polygons.

If it is plates that you want, then in 2D

difference(){
   union() {
       translate([8,0])
        square([20,10]);
      translate ([0,8])
        square([10,20]);
     translate([8,8])
        circle (r=8);
        }
    translate([10,10])  // chop out back of circle.
       square(20);
}

Easy enough to make these simple shapes parametric, put the dimensions
in a list/whatever for different sized tubes, etc. ( I guessed your
dimensions, but you should get the idea).

But, if it is 'bent tubes' into which the ali sections are inserted,
then use cubes and cylinders, and repeat but add whatever wall thickness
you want for your part, and difference (offsetting, correctly of course).

You can set $fn to fix the number of steps around the curve. For this
sort of thing, openscad is far, far better than freecad, imnsho.

Best wishes,

Ray

On 12/12/2021 22:00, Jose H wrote:

Hello,

My name is Jose and I want to create a library for joining rectangular
aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find
OpenSCAD would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape.
This profile can be seen on the attached (freecad)screenshot and I
have a problem creating that on Openscad.
Then I remove some material using boolean operations but that is not
problematic to create.

My problem is this, imagine that I have a polygon created by a list of
points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];
inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:
list1= [p0,p1,p2,p3];
another with the inside point:
list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 =
[list1, list2] but I don't know how to do that or if that is possible.
I tried different things and openscad compiler fails.

Why I want this?
If you see the picture there is a round corner in the polygon, that
round corner could have ten,a hundred points or a thousand depending
on the resolution and can be created from the tutorial using something
like:
points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and
can be grouped in another list.

Is it possible to join those two list together? This way the
parametric list does not affect the fixed one, and it would be very
easy to create a parametric shape.

It looks Openscad language is too limited for dynamic manipulation of
lists and that only lets you do static. Maybe trying to do that in
such limited language is a bad idea and I should focus on using python
scripts instead.
Why do you think?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Or, if the same proportions exist for all angle pieces, then - w =10; //width of plate difference(){    union() {        translate([w*.8,0])         square([w+w,w]);       translate ([0,w*.8])         square([w,w+w]);      translate([w*.8,w*.8])         circle (r=w*.8);         }     translate([w,w])  // chop out back of circle.        square(w+w); } you could use  'for' to iterate over a list of w's, to produce all the parts needed, whatever values of w are required. If it is tubular corner pieces, and the aluminium sections fit inside, then a 3d equivalent will only need the width and height of the ali cross section (assuming it is square) and the wall thickness of your printed piece. Similar concept for 'T' pieces and corners for joining thee tubes at right angles, or any other design you wish. -------- Forwarded Message -------- Subject: Re: [OpenSCAD] Joining lists of points together Date: Sun, 12 Dec 2021 23:31:58 +0000 From: Raymond West <raywest@raywest.com> To: discuss@lists.openscad.org Hi Jose, I wouldn't do it like that, not for that shape, need no polygons. If it is plates that you want, then in 2D difference(){    union() {        translate([8,0])         square([20,10]);       translate ([0,8])         square([10,20]);      translate([8,8])         circle (r=8);         }     translate([10,10])  // chop out back of circle.        square(20); } Easy enough to make these simple shapes parametric, put the dimensions in a list/whatever for different sized tubes, etc. ( I guessed your dimensions, but you should get the idea). But, if it is 'bent tubes' into which the ali sections are inserted, then use cubes and cylinders, and repeat but add whatever wall thickness you want for your part, and difference (offsetting, correctly of course). You can set $fn to fix the number of steps around the curve. For this sort of thing, openscad is far, far better than freecad, imnsho. Best wishes, Ray On 12/12/2021 22:00, Jose H wrote: > Hello, > > My name is Jose and I want to create a library for joining rectangular > aluminum profiles in OpenScad using 3D printed pieces. > > I already have those created in Freecad and CADQuerry but I find > OpenSCAD would be easier to use for most people. > > I start with a 2d polygon that I extrude to create the general shape. > This profile can be seen on the attached (freecad)screenshot and I > have a problem creating that on Openscad. > Then I remove some material using boolean operations but that is not > problematic to create. > > My problem is this, imagine that I have a polygon created by a list of > points: > > p0 = [0, 0]; > p1 = [0, 10]; > p2 = [10, 10]; > p3 = [10, 0]; > inside_point = [5, 5]; > > points = [p0, p1, p2, p3, inside_point]; > polygon(points); > > What I want to do is create one list with four points: > list1= [p0,p1,p2,p3]; > another with the inside point: > list2= [inside_point]; > > And then create a new list that is list2 appended to list1. list3 = > [list1, list2] but I don't know how to do that or if that is possible. > I tried different things and openscad compiler fails. > > Why I want this? > If you see the picture there is a round corner in the polygon, that > round corner could have ten,a hundred points or a thousand depending > on the resolution and can be created from the tutorial using something > like: > points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; > > Then there are 5 points of the rest of the corners that are fixed and > can be grouped in another list. > > Is it possible to join those two list together? This way the > parametric list does not affect the fixed one, and it would be very > easy to create a parametric shape. > > It looks Openscad language is too limited for dynamic manipulation of > lists and that only lets you do static. Maybe trying to do that in > such limited language is a bad idea and I should focus on using python > scripts instead. > Why do you think? > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JH
Jose H
Mon, Dec 13, 2021 9:30 AM

Thank you, @nop.head that is extremely useful.

El dom, 12 dic 2021 a las 23:06, nop head (nop.head@gmail.com) escribió:

You can join lists with concat(list1, list2);

You can also have a list with fixed points and multiple for loops in the
same list comprehension.

On Sun, 12 Dec 2021 at 22:00, Jose H jose.francisco.hevia@gmail.com
wrote:

Hello,

My name is Jose and I want to create a library for joining rectangular
aluminum profiles in OpenScad using 3D printed pieces.

I already have those created in Freecad and CADQuerry but I find OpenSCAD
would be easier to use for most people.

I start with a 2d polygon that I extrude to create the general shape.
This profile can be seen on the attached (freecad)screenshot and I have a
problem creating that on Openscad.
Then I remove some material using boolean operations but that is not
problematic to create.

My problem is this, imagine that I have a polygon created by a list of
points:

p0 = [0, 0];
p1 = [0, 10];
p2 = [10, 10];
p3 = [10, 0];
inside_point = [5, 5];

points = [p0, p1, p2, p3, inside_point];
polygon(points);

What I want to do is create one list with four points:
list1= [p0,p1,p2,p3];
another with the inside point:
list2= [inside_point];

And then create a new list that is list2 appended to list1. list3 =
[list1, list2] but I don't know how to do that or if that is possible. I
tried different things and openscad compiler fails.

Why I want this?
If you see the picture there is a round corner in the polygon, that round
corner could have ten,a hundred points or a thousand depending on the
resolution and can be created from the tutorial using something like:
points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]];

Then there are 5 points of the rest of the corners that are fixed and can
be grouped in another list.

Is it possible to join those two list together? This way the parametric
list does not affect the fixed one, and it would be very easy to create a
parametric shape.

It looks Openscad language is too limited for dynamic manipulation of
lists and that only lets you do static. Maybe trying to do that in such
limited language is a bad idea and I should focus on using python scripts
instead.
Why do you think?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thank you, @nop.head that is extremely useful. El dom, 12 dic 2021 a las 23:06, nop head (<nop.head@gmail.com>) escribió: > You can join lists with concat(list1, list2); > > You can also have a list with fixed points and multiple for loops in the > same list comprehension. > > On Sun, 12 Dec 2021 at 22:00, Jose H <jose.francisco.hevia@gmail.com> > wrote: > >> Hello, >> >> My name is Jose and I want to create a library for joining rectangular >> aluminum profiles in OpenScad using 3D printed pieces. >> >> I already have those created in Freecad and CADQuerry but I find OpenSCAD >> would be easier to use for most people. >> >> I start with a 2d polygon that I extrude to create the general shape. >> This profile can be seen on the attached (freecad)screenshot and I have a >> problem creating that on Openscad. >> Then I remove some material using boolean operations but that is not >> problematic to create. >> >> My problem is this, imagine that I have a polygon created by a list of >> points: >> >> p0 = [0, 0]; >> p1 = [0, 10]; >> p2 = [10, 10]; >> p3 = [10, 0]; >> inside_point = [5, 5]; >> >> points = [p0, p1, p2, p3, inside_point]; >> polygon(points); >> >> What I want to do is create one list with four points: >> list1= [p0,p1,p2,p3]; >> another with the inside point: >> list2= [inside_point]; >> >> And then create a new list that is list2 appended to list1. list3 = >> [list1, list2] but I don't know how to do that or if that is possible. I >> tried different things and openscad compiler fails. >> >> Why I want this? >> If you see the picture there is a round corner in the polygon, that round >> corner could have ten,a hundred points or a thousand depending on the >> resolution and can be created from the tutorial using something like: >> points = [ for (t=[0:step:89.999]) [-cos(t), -sin(t)]]; >> >> Then there are 5 points of the rest of the corners that are fixed and can >> be grouped in another list. >> >> Is it possible to join those two list together? This way the parametric >> list does not affect the fixed one, and it would be very easy to create a >> parametric shape. >> >> It looks Openscad language is too limited for dynamic manipulation of >> lists and that only lets you do static. Maybe trying to do that in such >> limited language is a bad idea and I should focus on using python scripts >> instead. >> Why do you think? >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JH
Jose H
Mon, Dec 13, 2021 9:38 AM

@Raymond West.
Thank you, I thought about that, but I wanted something that warranted
specific points in order to make it super clean and controlled when I do
boolean logic in 3D so no broken faces and so on.
I had problems in the past with 3d boolean logic and wanted to be extra
careful in 2d although your solution probably works very well.

Now that I have so many alternatives I will test them all and compare and
use the cleanest.

@Raymond West. Thank you, I thought about that, but I wanted something that warranted specific points in order to make it super clean and controlled when I do boolean logic in 3D so no broken faces and so on. I had problems in the past with 3d boolean logic and wanted to be extra careful in 2d although your solution probably works very well. Now that I have so many alternatives I will test them all and compare and use the cleanest.
JH
Jose H
Mon, Dec 13, 2021 9:40 AM

@MichaelAtOz. Thank you Michael, I looked for in the documentation that but
could not find it. It turns out it was hidden in plain sight.

@MichaelAtOz. Thank you Michael, I looked for in the documentation that but could not find it. It turns out it was hidden in plain sight.
JH
Jose H
Mon, Dec 13, 2021 9:43 AM

@Torsten Paul. Very interesting, I tried it without the "each" trying to
intuitively make it work.

@Torsten Paul. Very interesting, I tried it without the "each" trying to intuitively make it work.