[OpenSCAD] Not understanding things
Dan Shriver
tabbydan at gmail.com
Fri Jan 26 18:22:59 EST 2018
I'm having trouble understanding how I should tackle a problem.
I think I should be using skin() for my problem but I am confused how it
works and how I should present things to it.
I was trying to look at some examples like:
https://github.com/openscad/list-comprehension-demos/issues/3
*atartanian <https://github.com/atartanian> gave a good example but I don't
see how it works*
myLen = len(path)-1;
trans = [ for (i=[0:len(path)-1]) transform(path[i],
rounded_rectangle_profile([4,4], i/myLen*2)) ];
translate([0,10,0])
skin(trans);
so I see in the code and the picture that it ends with a
rounded_rectangle_profile; but I don't understand why it starts with a
square one since that isn't specified in the skin example (it is in the
sweep example)
---------------
Basically I want to alter from one shape to another over a path (which I
think is what skin is for). I'm a bit confused how I should do this.
I'll include a picture and some code.
[image: Inline image 1]
On the picture the central figure is "basically" the "path" I want in the
x/y plane, along that path I want to gradually change from an ogee (similar
to one third of the central figure) to a roman arch (pictured below the
central figure). I say "basically" the "path" because really those three
ogees would seem to be bulging out periodically (like two sine waves out of
synch 90 degrees) owing to the fact that the roman arch is wider.
I'm not quite sure how I should be making things to present this info to
skin().
An alternative approach would be to make functions that generate points and
use these as vertices for polygons.
I'm attaching the code I used to generate these shapes (the code uses stuff
like pie_slice() which I got from hints on this list)
-------------
//roman arch type
module romanArchHalf(angle, size, thickness) {
difference () {
translate([(-(cos(angle)*size)),0,0]) {
pie_slice(size, 0, angle);
}
translate([-(cos(angle)*size),0,0]) {
pie_slice((size - thickness), 0, angle);
}
translate([-size*2, 0, 0]) {
square([size*2,size*2],false);
}
}
}
translate([0,-(sin(70)*30),0]) {
mirror([0,1,0]) {
romanArchHalf(70,15,1);
mirror([1,0,0])
romanArchHalf(70,15,1);
}
}
Ogee(15,15,1,100,0,0,0,45);
rotate([0,0,120]) {
Ogee(15,15,1,100,0,0,0,45);
}
rotate([0,0,240]) {
Ogee(15,15,1,100,0,0,0,45);
}
module Ogee(r1,r2,width,fnNum,yoffset=0,elongate=0, xoffset=0,angle=45) {
hpOgee(r1,r2,width,fnNum,yoffset,elongate,xoffset,angle);
mirror(0,1,0) {
hpOgee(r1,r2,width,fnNum,yoffset,elongate,xoffset,angle);
}
}
module hpOgee(r1,r2,width,fnNum,yoffset,elongate,xoffset,angle) {
difference() {
halfPieOgee(r1,r2,width,fnNum,yoffset,elongate,xoffset,angle);
translate([(-0.5*width),0,0]) {
square([width,r2],center=true);
square([width,r1],center=true);
}
}
}
module halfPieOgee(r1,r2,width,fnNum,offset,elongate,xoffset,firstAngle=45)
{
r1a = r1 + elongate;
translate([0,offset,0]) {
translate([((r2)-((r2)*cos(45)))-width,(r2*(sin(45))),0]) {
rotate( [0,0,-firstAngle] ){
difference() {
translate([(-r1a+width+xoffset),0,0]) {
pie_slice(r1a,0,firstAngle,fnNum);
}
translate([-r1a+xoffset,0,0]) {
pie_slice(r1a,0,firstAngle,fnNum);
}
}
translate([r2,0,0]) {
mirror( [0,1,0]) mirror( [1,0,0]) {
difference() {
pie_slice(r2,0,45,fnNum);
pie_slice((r2-width),0,45,fnNum);
}
}
}
}
}
}
}
module point(x,y) translate([x,y]) circle(0.01);
module pie_slice(r, a0, a1, fnNum) {
//$fa = 5;
R = r * sqrt(2) + 1;
intersection() {
circle(r, $fn=fnNum);
hull() {
point(0,0);
for(i = [0:4])
//a = (((4 - i) * a0 + i * a1) / 4);
point(R * cos((((4 - i) * a0 + i * a1) / 4)), R *
sin((((4 - i) * a0 + i * a1) / 4)));
}
}
}
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180126/1621f9c5/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 14874 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180126/1621f9c5/attachment.png>
More information about the Discuss
mailing list