discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Rotate Spoke try 2

P
Parkinbot
Thu, Nov 26, 2015 1:03 PM

in 2D you might be looking for this, e.g. a 7-gon:

in 3D you get some results with

which are mostly not satisfying. If you want do something like a
dodecahedron, you'd calculate each corner point and face and define a
polyhedron, for which you can use the "new" vector stuff. I give an example
for a 2D hexagon:

But there are also other, more combinatoric methods for defining bodies.
E.g. a dodecahedron:

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14759.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

in 2D you might be looking for this, e.g. a 7-gon: in 3D you get some results with which are mostly not satisfying. If you want do something like a dodecahedron, you'd calculate each corner point and face and define a polyhedron, for which you can use the "new" vector stuff. I give an example for a 2D hexagon: But there are also other, more combinatoric methods for defining bodies. E.g. a dodecahedron: -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14759.html Sent from the OpenSCAD mailing list archive at Nabble.com.
V
vIQleS
Thu, Nov 26, 2015 8:53 PM

Parkinbot wrote

in 2D you might be looking for this, e.g. a 7-gon:

in 3D you get some results with

Yeah I actually managed to get what I wanted with cylinder & $fa

But it doesn't do <5.

I'll have a look at the rest of that and see if i can figure anything out.
Will it work with cylinder?

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14771.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parkinbot wrote > in 2D you might be looking for this, e.g. a 7-gon: > > in 3D you get some results with > Yeah I actually managed to get what I wanted with cylinder & $fa But it doesn't do <5. I'll have a look at the rest of that and see if i can figure anything out. Will it work with cylinder? -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14771.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Thu, Nov 26, 2015 10:56 PM

vIQleS wrote

I'll have a look at the rest of that and see if i can figure anything out.
Will it work with cylinder?

What a question. Why don't you just type it in and see what happens. (Of
course it will.)

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14776.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

vIQleS wrote > I'll have a look at the rest of that and see if i can figure anything out. > Will it work with cylinder? What a question. Why don't you just type it in and see what happens. (Of course it will.) -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14776.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Fri, Nov 27, 2015 2:51 AM

Parkinbot wrote

in 2D you might be looking for this, e.g. a 7-gon:

circle(100, $fn=7);  <== *

  • note that unfortunately using More/Raw-text gets dropped when it goes thru
    the mailing list. Prob don't want to use that.

Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14779.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parkinbot wrote > in 2D you might be looking for this, e.g. a 7-gon: > > circle(100, $fn=7); <== * * note that unfortunately using More/Raw-text gets dropped when it goes thru the mailing list. Prob don't want to use that. ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14779.html Sent from the OpenSCAD mailing list archive at Nabble.com.
V
vIQleS
Fri, Nov 27, 2015 4:02 AM

OK - I figured the polygon thing out thanks to the clues. I've now learned
linear_extrude. Yay!

Now the last (hopefully) thing is the fudge factor.

I want to automatically rotate the 3D n-agon so that the corners line up
with the arms. The code below is right.

I haven't been able to figure out a ratio that works for every possible
n-agon. Is there?

--=code=--

NoArm=7; //how many 'spokes'
ArmWide=3; //width of each spoke
ArmHigh=3; //height of each spoke
ArmLong=80; //length of each spoke - from centre

fudge=5.56; //to align the indent. between 1 and 6. adjust until 'v' shows
up on each arm

Deep=1; //depth of indent
InsetRad=45; //radius of indent

Circ=0; //size of circle in middle. zero for no circle, Advised if hole or
slot

Hole=0; //size of hole in middle. zero for no hole.

SlotWide=0; //slot instead of hole. zero either to not slot. no slot if
circ>0
SlotDeep=2;

DGrees=360/NoArm;

//polygon cylinder stuff
p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k)
[cos(angle), sin(angle)]
];

difference()
{
union()
{
for (i=[0:NoArm-1])
{
//arm
rotate([0,0,DGrees*i])
translate([-ArmWide/2,0,0])
cube([ArmWide,ArmLong,ArmHigh]);
}
//circle in middle
if(Circ>0)
cylinder(ArmHigh-Deep,Circ,Circ);
}

//indent
rotate([0,0,NoArmfudge])  //THIS BIT
translate([0,0,ArmHigh-Deep])
linear_extrude(height = Deep+1+ArmHigh, center = false,
convexity = 10, twist = 0)
polygon(points = p
InsetRad);

if(Hole>0) //hole in middle
{
    translate([0,0,-ArmHigh])
        cylinder(ArmHigh*2,Hole,Hole);
}
else if(SlotWide>0&&SlotDeep>0) //slot 
{
    cube([SlotWide,SlotDeep,ArmHigh*2],center=true);
}

}

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14781.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

OK - I figured the polygon thing out thanks to the clues. I've now learned linear_extrude. Yay! Now the last (hopefully) thing is the fudge factor. I want to automatically rotate the 3D n-agon so that the corners line up with the arms. The code below is right. I haven't been able to figure out a ratio that works for every possible n-agon. Is there? --=code=-- NoArm=7; //how many 'spokes' ArmWide=3; //width of each spoke ArmHigh=3; //height of each spoke ArmLong=80; //length of each spoke - from centre fudge=5.56; //to align the indent. between 1 and 6. adjust until 'v' shows up on each arm Deep=1; //depth of indent InsetRad=45; //radius of indent Circ=0; //size of circle in middle. zero for no circle, Advised if hole or slot Hole=0; //size of hole in middle. zero for no hole. SlotWide=0; //slot instead of hole. zero either to not slot. no slot if circ>0 SlotDeep=2; DGrees=360/NoArm; //polygon cylinder stuff p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k) [cos(angle), sin(angle)] ]; difference() { union() { for (i=[0:NoArm-1]) { //arm rotate([0,0,DGrees*i]) translate([-ArmWide/2,0,0]) cube([ArmWide,ArmLong,ArmHigh]); } //circle in middle if(Circ>0) cylinder(ArmHigh-Deep,Circ,Circ); } //indent rotate([0,0,NoArm*fudge]) //THIS BIT translate([0,0,ArmHigh-Deep]) linear_extrude(height = Deep+1+ArmHigh, center = false, convexity = 10, twist = 0) polygon(points = p*InsetRad); if(Hole>0) //hole in middle { translate([0,0,-ArmHigh]) cylinder(ArmHigh*2,Hole,Hole); } else if(SlotWide>0&&SlotDeep>0) //slot { cube([SlotWide,SlotDeep,ArmHigh*2],center=true); } } -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14781.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Fri, Nov 27, 2015 11:29 AM

MichaelAtOz wrote

Parkinbot wrote

in 2D you might be looking for this, e.g. a 7-gon:

circle(100, $fn=7);  <== *

  • note that unfortunately using More/Raw-text gets dropped when it goes
    thru the mailing list. Prob don't want to use that.

In this case I could have done it, because the code is a short liner. But
generally it is not a good idea, as you get line breaks (copy & paste will
not work) and also loose code alignment. So I prefer to follow the link at
the bottom of the mail.

By the way, I guess the prob is not new, so why has it not been addressed
(or even solved) til now?

  • Rudolf

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14788.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

MichaelAtOz wrote > > Parkinbot wrote >> in 2D you might be looking for this, e.g. a 7-gon: >> >> circle(100, $fn=7); <== * > * note that unfortunately using More/Raw-text gets dropped when it goes > thru the mailing list. Prob don't want to use that. In this case I could have done it, because the code is a short liner. But generally it is not a good idea, as you get line breaks (copy & paste will not work) and also loose code alignment. So I prefer to follow the link at the bottom of the mail. By the way, I guess the prob is not new, so why has it not been addressed (or even solved) til now? - Rudolf -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14788.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Fri, Nov 27, 2015 11:44 AM

vIQleS wrote

Now the last (hopefully) thing is the fudge factor.

I want to automatically rotate the 3D n-agon so that the corners line up
with the arms. The code below is right.

I haven't been able to figure out a ratio that works for every possible
n-agon. Is there?

forget about the factor. It's not a factor. It's an angle offset of 90°
between the two objects. So the affected code lines are:

Hint: difference() (and intersection()) sometimes obscures, what's really
happening. My trick is to temporarily comment is out to see, what's going
on.

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14789.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

vIQleS wrote > Now the last (hopefully) thing is the fudge factor. > > I want to automatically rotate the 3D n-agon so that the corners line up > with the arms. The code below is right. > > I haven't been able to figure out a ratio that works for every possible > n-agon. Is there? forget about the factor. It's not a factor. It's an angle offset of 90° between the two objects. So the affected code lines are: Hint: difference() (and intersection()) sometimes obscures, what's really happening. My trick is to temporarily comment is out to see, what's going on. -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14789.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Fri, Nov 27, 2015 1:18 PM

Nathan ?
Anyway if you add a # at front of the line you can see the shape. E.g. here:

linear_extrude(height = Deep+1+ArmHigh, center = false, convexity = 10,
twist = 0)
#polygon(points = p*InsetRad);

This trick will visually show you exactly what's not working right.

I empirically determined the values for noArm=3..9 and then had a stab at
the calc. Seems to work.
My mod below.

NoArm  = 7;  //how many 'spokes'
ArmWide = 3;  //width of each spoke
ArmHigh = 3;  //height of each spoke
ArmLong = 80; //length of each spoke - from centre

Deep = 1;      //depth of indent
InsetRad = 45; //radius of indent

Circ = 0;    //size of circle in middle. zero for no circle, Advised if
hole or slot
Hole = 0;    //size of hole in middle. zero for no hole.
SlotWide = 0; //slot instead of hole. zero either to not slot. no slot if
circ>0
SlotDeep = 2; //

DGrees = 360/NoArm;

//polygon cylinder stuff
p = [for (k=[0:NoArm-1])
let (angle=360/NoArm*k)
[cos(angle), sin(angle)]
];

difference()  {
union()  {
for (i=[0:NoArm-1])  {
//arm
rotate([0,0,DGreesi])
translate([-ArmWide/2,0,0])
cube([ArmWide,ArmLong,ArmHigh]);
}
//circle in middle
if (Circ>0)
cylinder(ArmHigh-Deep,Circ,Circ);
}
//indent
//echo(NoArm=NoArm, 360/NoArm, [for (x=[3:9]) [for(i=[0:x]) 90-360/x
i]]);
rotate([0,0,90-360/NoArm])  //empirical 3=-30,90, 4=0, 5=18, 6=30,-30,
7=-13,38.5, 8=0, 9=10
translate([0,0,ArmHigh-Deep])
linear_extrude(height = Deep+1+ArmHigh, center = false, convexity = 10,
twist = 0)
// #polygon(points = pInsetRad);
#circle(InsetRad, $fn=NoArm);
//hole in middle
if(Hole>0)  {
translate([0,0,-ArmHigh])
cylinder(ArmHigh
2,Hole,Hole);
} else {
if(SlotWide>0 && SlotDeep>0)  {//slot
#cube([SlotWide,SlotDeep,ArmHigh*2],center=true);
}
}
}

--
View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14792.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Nathan ? Anyway if you add a # at front of the line you can see the shape. E.g. here: linear_extrude(height = Deep+1+ArmHigh, center = false, convexity = 10, twist = 0) #polygon(points = p*InsetRad); This trick will visually show you exactly what's not working right. I empirically determined the values for noArm=3..9 and then had a stab at the calc. Seems to work. My mod below. NoArm = 7; //how many 'spokes' ArmWide = 3; //width of each spoke ArmHigh = 3; //height of each spoke ArmLong = 80; //length of each spoke - from centre Deep = 1; //depth of indent InsetRad = 45; //radius of indent Circ = 0; //size of circle in middle. zero for no circle, Advised if hole or slot Hole = 0; //size of hole in middle. zero for no hole. SlotWide = 0; //slot instead of hole. zero either to not slot. no slot if circ>0 SlotDeep = 2; // DGrees = 360/NoArm; //polygon cylinder stuff p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k) [cos(angle), sin(angle)] ]; difference() { union() { for (i=[0:NoArm-1]) { //arm rotate([0,0,DGrees*i]) translate([-ArmWide/2,0,0]) cube([ArmWide,ArmLong,ArmHigh]); } //circle in middle if (Circ>0) cylinder(ArmHigh-Deep,Circ,Circ); } //indent //echo(NoArm=NoArm, 360/NoArm, [for (x=[3:9]) [for(i=[0:x]) 90-360/x*i]]); rotate([0,0,90-360/NoArm]) //empirical 3=-30,90, 4=0, 5=18, 6=30,-30, 7=-13,38.5, 8=0, 9=10 translate([0,0,ArmHigh-Deep]) linear_extrude(height = Deep+1+ArmHigh, center = false, convexity = 10, twist = 0) // #polygon(points = p*InsetRad); #circle(InsetRad, $fn=NoArm); //hole in middle if(Hole>0) { translate([0,0,-ArmHigh]) cylinder(ArmHigh*2,Hole,Hole); } else { if(SlotWide>0 && SlotDeep>0) {//slot #cube([SlotWide,SlotDeep,ArmHigh*2],center=true); } } } -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14792.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Nov 29, 2015 10:22 PM

Sorry for side-tracking...

MichaelAtOz wrote

  • note that unfortunately using More/Raw-text gets dropped when it goes
    thru the mailing list. Prob don't want to use that.

Parkinbot wrote

In this case I could have done it, because the code is a short liner. But
generally it is not a good idea, as you get line breaks (copy & paste will
not work) and also loose code alignment. So I prefer to follow the link at
the bottom of the mail.

By the way, I guess the prob is not new, so why has it not been addressed
(or even solved) til now?

I've been looking thru Nabble to try to figure out what's going on.
I've now got to the code minus one step (which is a binary I have not, yet,
had access to the source)
I'm thinking that it is a security setting, as theoretically, you could put
malicious html which then gets placed in an email.

If the 'message is in HTML Format' is ticked, Raw works, but the plaintext
you type is then 'formatted' so you loose spacing etc.

I'm hoping to get some combo of the HTML format, but with it preserving
basic layout, but it is slow learning Nabble. Or alternatively an equivalent
of Raw, but say 'Code' which addresses it somehow.

"So I prefer to follow the link at the bottom of the mail"

As long as you realise that a majority of people here seem to rely on the
mailing list and will not see Raw. In case you don't see your own emailed
posts, this is what your post looked like:


in 2D you might be looking for this, e.g. a 7-gon:

in 3D you get some results with

which are mostly not satisfying. If you want do something like a
dodecahedron, you'd calculate each corner point and face and define a
polyhedron, for which you can use the "new" vector stuff. I give an example
for a 2D hexagon:

But there are also other, more combinatoric methods for defining bodies.
E.g. a dodecahedron:


I suggest marking code as,

/itallics, /

or inside

quotes, using the %lt quote %gt markup. But don't use the 'Quote' button -
it will replace your text with the prev. post.

It may depend on mailman setting tho. Unfortunately I don't have a test
mailman to play with. So the below is part of the test.
Y'all let me know of you don't get the two identical code bits in your mail,
(italics and then quoted), and I can check mailman settings.

/fudge=0; // this factor is dispensible
//polygon cylinder stuff
p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90)
[cos(angle), sin(angle)]
]; /

fudge=0; // this factor is dispensible
//polygon cylinder stuff
p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90)
[cos(angle), sin(angle)]
];


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14821.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Sorry for side-tracking... MichaelAtOz wrote > * note that unfortunately using More/Raw-text gets dropped when it goes > thru the mailing list. Prob don't want to use that. Parkinbot wrote > In this case I could have done it, because the code is a short liner. But > generally it is not a good idea, as you get line breaks (copy & paste will > not work) and also loose code alignment. So I prefer to follow the link at > the bottom of the mail. > > By the way, I guess the prob is not new, so why has it not been addressed > (or even solved) til now? I've been looking thru Nabble to try to figure out what's going on. I've now got to the code minus one step (which is a binary I have not, yet, had access to the source) I'm thinking that it is a security setting, as theoretically, you could put malicious html which then gets placed in an email. If the 'message is in HTML Format' is ticked, Raw works, but the plaintext you type is then 'formatted' so you loose spacing etc. I'm hoping to get some combo of the HTML format, but with it preserving basic layout, but it is slow learning Nabble. Or alternatively an equivalent of Raw, but say 'Code' which addresses it somehow. > "So I prefer to follow the link at the bottom of the mail" As long as you realise that a majority of people here seem to rely on the mailing list and will not see Raw. In case you don't see your own emailed posts, this is what your post looked like: ----------------------------------------------- in 2D you might be looking for this, e.g. a 7-gon: in 3D you get some results with which are mostly not satisfying. If you want do something like a dodecahedron, you'd calculate each corner point and face and define a polyhedron, for which you can use the "new" vector stuff. I give an example for a 2D hexagon: But there are also other, more combinatoric methods for defining bodies. E.g. a dodecahedron: ------------------------------------------------ I suggest marking code as, /itallics, / or inside > quotes, using the %lt quote %gt markup. But don't use the 'Quote' button - > it will replace your text with the prev. post. It may depend on mailman setting tho. Unfortunately I don't have a test mailman to play with. So the below is part of the test. Y'all let me know of you don't get the two identical code bits in your mail, (italics and then quoted), and I can check mailman settings. /fudge=0; // this factor is dispensible //polygon cylinder stuff p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90) [cos(angle), sin(angle)] ]; / > fudge=0; // this factor is dispensible > //polygon cylinder stuff > p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90) > [cos(angle), sin(angle)] > ]; ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14821.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Nov 29, 2015 10:34 PM

OK, for my mailman settings, itallics was a flop, but the quote method
worked.

Changed my settings. Was MIME, now Plaintext. Retesting... (itallics, quote)

/fudge=0; // this factor is dispensible
//polygon cylinder stuff
p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90)
[cos(angle), sin(angle)]
];/

fudge=0; // this factor is dispensible
//polygon cylinder stuff
p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90)
[cos(angle), sin(angle)]
];


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14822.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

OK, for my mailman settings, itallics was a flop, but the quote method worked. Changed my settings. Was MIME, now Plaintext. Retesting... (itallics, quote) /fudge=0; // this factor is dispensible //polygon cylinder stuff p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90) [cos(angle), sin(angle)] ];/ > fudge=0; // this factor is dispensible > //polygon cylinder stuff > p = [for (k=[0:NoArm-1]) let (angle=360/NoArm*k + 90) > [cos(angle), sin(angle)] > ]; ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Rotate-Spoke-try-2-tp14747p14822.html Sent from the OpenSCAD mailing list archive at Nabble.com.