Hi,

Guest

D

disruptivesolutionsnl@gmail.com

Fri, Jul 2, 2021 2:26 PM

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle

of each corner, so the lengths of the "lines" between them is not

equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

Hello,
I am new to his forum/mailing list, so thank you for having me!
I want to make an octagonal shape (8 sides) where I could change the angle
of each corner, so the lengths of the "lines" between them is not
equivalent. How could I do this?
I hope my question is clear enough without presenting an example picture.
With kind regards,
Ben

MM

Michael Möller

Fri, Jul 2, 2021 2:30 PM

That is just a regular polyhedron, with 8 points.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#polygon

You just need the list of xy points. This is a 2D shape, so remember to

extrude it.

Msquare

On Fri, 2 Jul 2021 at 16:26, disruptivesolutionsnl@gmail.com wrote:

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle

of each corner, so the lengths of the “lines” between them is not

equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

OpenSCAD mailing list

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

That is just a regular polyhedron, with 8 points.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#polygon
You just need the list of xy points. This is a 2D shape, so remember to
extrude it.
Msquare
On Fri, 2 Jul 2021 at 16:26, <disruptivesolutionsnl@gmail.com> wrote:
> Hello,
>
>
>
> I am new to his forum/mailing list, so thank you for having me!
>
>
>
> I want to make an octagonal shape (8 sides) where I could change the angle
> of each corner, so the lengths of the “lines” between them is not
> equivalent. How could I do this?
>
>
>
> I hope my question is clear enough without presenting an example picture.
>
>
>
> With kind regards,
>
> Ben
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>

NH

nop head

Fri, Jul 2, 2021 2:33 PM

You can make an arbitrary 8 sided shape by giving a list of vertices to

polygon(). If you want to specify the angles you would need to use some

trigonometry to work out the vertex positions, or perhaps use a library

with turtle mode paths.

On Fri, 2 Jul 2021 at 15:26, disruptivesolutionsnl@gmail.com wrote:

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle

of each corner, so the lengths of the “lines” between them is not

equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

OpenSCAD mailing list

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

You can make an arbitrary 8 sided shape by giving a list of vertices to
polygon(). If you want to specify the angles you would need to use some
trigonometry to work out the vertex positions, or perhaps use a library
with turtle mode paths.
On Fri, 2 Jul 2021 at 15:26, <disruptivesolutionsnl@gmail.com> wrote:
> Hello,
>
>
>
> I am new to his forum/mailing list, so thank you for having me!
>
>
>
> I want to make an octagonal shape (8 sides) where I could change the angle
> of each corner, so the lengths of the “lines” between them is not
> equivalent. How could I do this?
>
>
>
> I hope my question is clear enough without presenting an example picture.
>
>
>
> With kind regards,
>
> Ben
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>

T

Terry

Fri, Jul 2, 2021 7:26 PM

On Fri, 2 Jul 2021 16:26:09 +0200, you wrote:

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle

of each corner, so the lengths of the "lines" between them is not

equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

On Fri, 2 Jul 2021 16:26:09 +0200, you wrote:

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle

of each corner, so the lengths of the "lines" between them is not

equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

Hi Ben,

I'm newish here too, and an OS novice, but one of the books I've bought

has some examples from which I've extracted the following. Although it's

not a close match, with a revised function it might be a start.

function cartesian(radius,angle)=

[radius*cos(angle),radius*sin(angle)];

module triangle(p1,p2,p3) {

polygon([p1,p2,p3]);

}

module regular_polygon(poly_edges,poly_radius) {

for(n=[0:poly_edges-1]) {

p1 = cartesian(poly_radius,n*360/poly_edges);

p2 = cartesian(poly_radius,(n+1)*360/poly_edges);

triangle([0,0],p1,p2);

}

}

// Octagon example

poly_edges = 8;

poly_radius = 20;

poly_height = 3;

linear_extrude(poly_height)

regular_polygon(poly_edges,poly_radius);

On Fri, 2 Jul 2021 16:26:09 +0200, you wrote:
>Hello,
>
>
>
>I am new to his forum/mailing list, so thank you for having me!
>
>
>
>I want to make an octagonal shape (8 sides) where I could change the angle
>of each corner, so the lengths of the "lines" between them is not
>equivalent. How could I do this?
>
>
>
>I hope my question is clear enough without presenting an example picture.
>
>
>
>With kind regards,
>
>Ben
On Fri, 2 Jul 2021 16:26:09 +0200, you wrote:
>Hello,
>
>
>
>I am new to his forum/mailing list, so thank you for having me!
>
>
>
>I want to make an octagonal shape (8 sides) where I could change the angle
>of each corner, so the lengths of the "lines" between them is not
>equivalent. How could I do this?
>
>
>
>I hope my question is clear enough without presenting an example picture.
>
>
>
>With kind regards,
>
>Ben
Hi Ben,
I'm newish here too, and an OS novice, but one of the books I've bought
has some examples from which I've extracted the following. Although it's
not a close match, with a revised function it might be a start.
function cartesian(radius,angle)=
[radius*cos(angle),radius*sin(angle)];
module triangle(p1,p2,p3) {
polygon([p1,p2,p3]);
}
module regular_polygon(poly_edges,poly_radius) {
for(n=[0:poly_edges-1]) {
p1 = cartesian(poly_radius,n*360/poly_edges);
p2 = cartesian(poly_radius,(n+1)*360/poly_edges);
triangle([0,0],p1,p2);
}
}
// Octagon example
poly_edges = 8;
poly_radius = 20;
poly_height = 3;
linear_extrude(poly_height)
regular_polygon(poly_edges,poly_radius);

T

Terry

Fri, Jul 2, 2021 7:36 PM

It's odd that my post is accessible in the forum but I haven't yet

received it as an email. Anyway, in the forum somehow the pasted code

has been corrupted (as you see from the accompanying screenshot.

Hopefully the email will be correct. Here's another paste:

function cartesian(radius,angle)=

[radius*cos(angle),radius*sin(angle)];

module triangle(p1,p2,p3) {

polygon([p1,p2,p3]);

}

module regular_polygon(poly_edges,poly_radius) {

for(n=[0:poly_edges-1]) {

p1 = cartesian(poly_radius,n*360/poly_edges);

p2 = cartesian(poly_radius,(n+1)*360/poly_edges);

triangle([0,0],p1,p2);

}

}

// Octagon example

poly_edges = 8;

poly_radius = 20;

poly_height = 3;

linear_extrude(poly_height)

regular_polygon(poly_edges,poly_radius);

It's odd that my post is accessible in the forum but I haven't yet
received it as an email. Anyway, in the forum somehow the pasted code
has been corrupted (as you see from the accompanying screenshot.
Hopefully the email will be correct. Here's another paste:
function cartesian(radius,angle)=
[radius*cos(angle),radius*sin(angle)];
module triangle(p1,p2,p3) {
polygon([p1,p2,p3]);
}
module regular_polygon(poly_edges,poly_radius) {
for(n=[0:poly_edges-1]) {
p1 = cartesian(poly_radius,n*360/poly_edges);
p2 = cartesian(poly_radius,(n+1)*360/poly_edges);
triangle([0,0],p1,p2);
}
}
// Octagon example
poly_edges = 8;
poly_radius = 20;
poly_height = 3;
linear_extrude(poly_height)
regular_polygon(poly_edges,poly_radius);

JB

Jordan Brown

Fri, Jul 2, 2021 8:10 PM

module regular_polygon(poly_edges,poly_radius) {

It's not super-obvious, but OpenSCAD has a built-in way to do this:

```
circle(r=poly_radius, $fn=poly_edges);
```

Additional regular polygon tips:

Note that OpenSCAD measures the "radius" of the polygon from the center

to the vertices.

```
function adjustr(r, n) = r / cos(360/n/2);
```

will give you an "adjusted" radius, such that circle(r=adjustr(r, n),

$fn=n) will give you a polygon where "r" is the distance from the center

to the middle of the edges.

Also note that OpenSCAD circle() behavior puts one vertex at [r, 0], so

that a square ends up diamond-oriented. That's not wrong, but sometimes

it's more convenient to have an edge there. For that, you want

```
rotate(360/n/2) circle(...);
```

If you combine those:

```
rotate(360/n/2) circle(r=adjustr(r, n), $fn=n);
```

then you end up with a polygon where one edge is aligned with the Y axis

and has its center at [r, 0]. If the number of sides is even, another

Y-aligned edge is at [-r,0], and if it's divisible by four then there

will be X-aligned edges at [0,r] and [0,-r].

> module regular_polygon(poly_edges,poly_radius) {
It's not super-obvious, but OpenSCAD has a built-in way to do this:
circle(r=poly_radius, $fn=poly_edges);
Additional regular polygon tips:
Note that OpenSCAD measures the "radius" of the polygon from the center
to the vertices.
function adjustr(r, n) = r / cos(360/n/2);
will give you an "adjusted" radius, such that circle(r=adjustr(r, n),
$fn=n) will give you a polygon where "r" is the distance from the center
to the middle of the edges.
Also note that OpenSCAD circle() behavior puts one vertex at [r, 0], so
that a square ends up diamond-oriented. That's not wrong, but sometimes
it's more convenient to have an edge there. For that, you want
rotate(360/n/2) circle(...);
If you combine those:
rotate(360/n/2) circle(r=adjustr(r, n), $fn=n);
then you end up with a polygon where one edge is aligned with the Y axis
and has its center at [r, 0]. If the number of sides is even, another
Y-aligned edge is at [-r,0], and if it's divisible by four then there
will be X-aligned edges at [0,r] and [0,-r].

JB

Jordan Brown

Fri, Jul 2, 2021 8:24 PM

On 7/2/2021 1:10 PM, Jordan Brown wrote:

```
rotate(360/n/2) circle(r=adjustr(r, n), $fn=n);
```

Perhaps circle (and cylinder and sphere) should get additional options

so that these adjustments are built in, rather than everybody needing to

layer adjustments on top.

For the radius adjustment, there could be "ir", "or", "id", and "od"

parameters. "or" and "od" would be aliases for the current "r" and "d"

and specify to-vertex dimensions, while "ir" and "id" would specify

to-edge dimensions.

I don't know about the rotation adjustment, but perhaps it would be a

boolean or perhaps it would be an "align" parameter with options

"vertex" and "edge".

It's hard to tell when adding these small tweaks to the base (thus

cluttering the base more) is a win over having people or libraries

invent new names for new operations that are almost the same as the

existing operations.

On 7/2/2021 1:10 PM, Jordan Brown wrote:
>
> rotate(360/n/2) circle(r=adjustr(r, n), $fn=n);
>
Perhaps circle (and cylinder and sphere) should get additional options
so that these adjustments are built in, rather than everybody needing to
layer adjustments on top.
For the radius adjustment, there could be "ir", "or", "id", and "od"
parameters. "or" and "od" would be aliases for the current "r" and "d"
and specify to-vertex dimensions, while "ir" and "id" would specify
to-edge dimensions.
I don't know about the rotation adjustment, but perhaps it would be a
boolean or perhaps it would be an "align" parameter with options
"vertex" and "edge".
It's hard to tell when adding these small tweaks to the base (thus
cluttering the base more) is a win over having people or libraries
invent new names for new operations that are almost the same as the
existing operations.

DG

David Gustavson

Fri, Jul 2, 2021 8:36 PM

It’s because you use Gmail.

Gmail has a policy that it will never show you an email that it can tell was sent by yourself.

Makes me crazy when testing groups.

I guess they think it would insult your memory?

--

David Gustavson

dbg@SCIzzL.com

On Fri, Jul 2, 2021, at 12:36 PM, Terry wrote:

It's odd that my post is accessible in the forum but I haven't yet

received it as an email. Anyway, in the forum somehow the pasted code

has been corrupted (as you see from the accompanying screenshot.

Hopefully the email will be correct. Here's another paste:

function cartesian(radius,angle)=

[radius*cos(angle),radius*sin(angle)];

module triangle(p1,p2,p3) {

polygon([p1,p2,p3]);

}

module regular_polygon(poly_edges,poly_radius) {

for(n=[0:poly_edges-1]) {

p1 = cartesian(poly_radius,n*360/poly_edges);

p2 = cartesian(poly_radius,(n+1)*360/poly_edges);

triangle([0,0],p1,p2);

}

}

// Octagon example

poly_edges = 8;

poly_radius = 20;

poly_height = 3;

linear_extrude(poly_height)

regular_polygon(poly_edges,poly_radius);

OpenSCAD mailing list

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

It’s because you use Gmail.
Gmail has a policy that it will never show you an email that it can tell was sent by yourself.
Makes me crazy when testing groups.
I guess they think it would insult your memory?
--
David Gustavson
dbg@SCIzzL.com
On Fri, Jul 2, 2021, at 12:36 PM, Terry wrote:
> It's odd that my post is accessible in the forum but I haven't yet
> received it as an email. Anyway, in the forum somehow the pasted code
> has been corrupted (as you see from the accompanying screenshot.
> Hopefully the email will be correct. Here's another paste:
>
>
> function cartesian(radius,angle)=
> [radius*cos(angle),radius*sin(angle)];
>
> module triangle(p1,p2,p3) {
> polygon([p1,p2,p3]);
> }
>
>
> module regular_polygon(poly_edges,poly_radius) {
> for(n=[0:poly_edges-1]) {
> p1 = cartesian(poly_radius,n*360/poly_edges);
> p2 = cartesian(poly_radius,(n+1)*360/poly_edges);
> triangle([0,0],p1,p2);
> }
> }
>
> // Octagon example
> poly_edges = 8;
> poly_radius = 20;
> poly_height = 3;
> linear_extrude(poly_height)
> regular_polygon(poly_edges,poly_radius);
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>

RD

Revar Desmera

Fri, Jul 2, 2021 10:58 PM

Something like this?

r=50; sides=8; small_ang=30;

poly = [

for (a=[0:90:359],b=[-0.5,0.5])

let(ang=a+b*small_ang)
r*[cos(ang), sin(ang)]

]

polygon(poly);

Or do you need specific interior angles on the polygon?

- Revar

On Jul 2, 2021, at 7:26 AM, disruptivesolutionsnl@gmail.com disruptivesolutionsnl@gmail.com wrote:

Hello,

I am new to his forum/mailing list, so thank you for having me!

I want to make an octagonal shape (8 sides) where I could change the angle of each corner, so the lengths of the “lines” between them is not equivalent. How could I do this?

I hope my question is clear enough without presenting an example picture.

With kind regards,

Ben

OpenSCAD mailing list

To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org

Something like this?
r=50; sides=8; small_ang=30;
poly = [
for (a=[0:90:359],b=[-0.5,0.5])
let(ang=a+b*small_ang)
r*[cos(ang), sin(ang)]
]
polygon(poly);
Or do you need specific interior angles on the polygon?
- Revar
> On Jul 2, 2021, at 7:26 AM, <disruptivesolutionsnl@gmail.com> <disruptivesolutionsnl@gmail.com> wrote:
>
> Hello,
>
> I am new to his forum/mailing list, so thank you for having me!
>
> I want to make an octagonal shape (8 sides) where I could change the angle of each corner, so the lengths of the “lines” between them is not equivalent. How could I do this?
>
> I hope my question is clear enough without presenting an example picture.
>
> With kind regards,
> Ben
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org>

MM

Michael Marx

Sat, Jul 3, 2021 12:49 AM

-----Original Message-----

From: Terry [mailto:terrypingm@gmail.com]

Sent: Sat, 3 Jul 2021 05:26

I'm newish here too, and an OS novice, but one of the books I've bought

has some examples

Terry,

Firstly we do not use OS as an abbreviation for OpenSCAD it gets confused for Operating System,

which is a more common term. What version of the OS are you running?

So what books??

BTW, people have missed the subtlety of the original request; different angles/lengths.

of each corner, so the lengths of the "lines" between them is not

equivalent. How could I do this?

--

This email has been checked for viruses by AVG.

https://www.avg.com

> -----Original Message-----
> From: Terry [mailto:terrypingm@gmail.com]
> Sent: Sat, 3 Jul 2021 05:26
> I'm newish here too, and an OS novice, but one of the books I've bought
> has some examples
Terry,
Firstly we do not use OS as an abbreviation for OpenSCAD it gets confused for Operating System,
which is a more common term. What version of the OS are you running?
So what books??
BTW, people have missed the subtlety of the original request; different angles/lengths.
> >I want to make an octagonal shape (8 sides) where I could change the angle
> >of each corner, so the lengths of the "lines" between them is not
> >equivalent. How could I do this?
--
This email has been checked for viruses by AVG.
https://www.avg.com

Replying to:

Empathy v1.0
2021 ©Harmonylists.com