How to adjust this model a bit..?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to adjust this model a bit..?

ps91Rick
Hi all.. I'm new to OpenSCAD and this sort of system.  I've got an initial
model I'm toying around with that is basically an ellipse.  I want to tweak
the existing code to taper from the top to the bottom at some prescribed
angle.. I'm just not sure how to implement it.  

My existing model looks like :
<http://forum.openscad.org/file/t2804/Screen_Shot_2020-04-16_at_2.png>

Here's the code :

use <ptf/ptf_rotate.scad>;
use <sweep.scad>;

circle_degrees=180;
wall_height=150;
wall_thickness=2;

v = [10, 10, 10];

circle_radius=100;

wall_1 = circle_radius + wall_thickness;
wall_2 = (circle_radius-2) + wall_thickness;

section = [
    [wall_1,  0, 0],
    [wall_1, wall_height, 0],
    [wall_2, wall_height, 0],
    [wall_2,  0, 0]
];

// spin section1
sections = [
    for(i = [0:circle_degrees])
    [
       for(p = section)
          let(pt = ptf_rotate(p, [90, 0, i]))
            [pt[0], pt[1]/2 , pt[2]]
    ]
];

sweep(sections);

Below is more or less the effect I'm after (obviously not rendered in
OpenSCAD).. The fluting/taper is in the top of the image -- its wider at the
bottom than the top although its not completely obvious in this image.
Thanks in advance for any suggestions!!

<http://forum.openscad.org/file/t2804/IMG_0047.jpg>



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

adrianv
I couldn't run your code since I don't know where you includes came from.
But maybe you're trying to do something like this?  (Note that this version
is sloppy, not constant width, pointy corners.)  

Library at https://github.com/revarbat/BOSL2/wiki

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

circle_degrees=180;
wall_height=150;
wall_thickness=2;

bottomarc = apply(xscale(2),arc(N=30,angle=[0,circle_degrees], r=100));
bottom = concat(bottomarc, reverse(apply(back(wall_thickness), bottomarc)));

toparc = apply(xscale(1.6),arc(N=30,angle=[0,circle_degrees], r=90));
top = concat(toparc, reverse(apply(back(wall_thickness), toparc)));

skin([bottom, top], z=[0,wall_height], slices=10);

<http://forum.openscad.org/file/t2477/skin.png>



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

ps91Rick
Thanks.. Sorry for not indicating the library I was using.. I'm using the
dotSCAD library (https://github.com/JustinSDK/dotSCAD).

I did download the BOSL2 library just now, installed it and ran your code
and its pretty much looking like what I'm after! Thanks so much!  If you
don't mind me asking another question, I'm assuming that if I want to shove
another object (e.g. a 2mm thick rectangle) through one side of the object
at a particular angle, I can just use the translate() function to move it
wherever I desire?  I'm assuming that's not an issue.  

However, if I pop that rectangle completely through and want to snip off the
left-over on one side but leave the other in-tact -- what's the best way to
accomplish something like that -- perhaps using difference() or similar?
Thanks in advance!!

ps. For people using multiple libraries (e.g. BOSL2, DotSCAD, etc), how to
you manage to not adjust the library code or to go through extraneous steps
to jump from one library to another.  For instance, the Dotscad library has
implementation details hidden inside standalone files residing in deeper
directories..  If I place all the dotscad stuff in a dedicated directory
(e.g. ~/Documents/OpenSCAD/libraries/dotscad in my case), and reference
those files using something like :

use <dotscad/ptf/ptf_rotate.scad>;
use <dotscad/sweep.scad>;

If any of those files include other material from the library it barfs.
BOSL2 seems to behave pretty well.. I was just wondering how others deal
with this stuff. I'm sure I could go and edit the offending files to prefix
them with dotscad but perhaps this has already been solved.  Thanks again!!




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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

adrianv
ps91Rick wrote
> I did download the BOSL2 library just now, installed it and ran your code
> and its pretty much looking like what I'm after! Thanks so much!  If you
> don't mind me asking another question, I'm assuming that if I want to
> shove
> another object (e.g. a 2mm thick rectangle) through one side of the object
> at a particular angle, I can just use the translate() function to move it
> wherever I desire?  I'm assuming that's not an issue.  

You should be able to do whatever you want with the object.  


> However, if I pop that rectangle completely through and want to snip off
> the
> left-over on one side but leave the other in-tact -- what's the best way
> to
> accomplish something like that -- perhaps using difference() or similar?
> Thanks in advance!!

I didn't show it, but another way to do what you're trying to do would be to
make the outside object and the inside object and then take the difference.
If I understand what you mean about the rectangle, I'd say you should make
the outside object and intersect/difference it with your rectangular object
and add the result to your model.  


> ps. For people using multiple libraries (e.g. BOSL2, DotSCAD, etc), how to
> you manage to not adjust the library code or to go through extraneous
> steps
> to jump from one library to another.  For instance, the Dotscad library
> has
> implementation details hidden inside standalone files residing in deeper
> directories..  If I place all the dotscad stuff in a dedicated directory
> (e.g. ~/Documents/OpenSCAD/libraries/dotscad in my case), and reference
> those files using something like :

I have libraries in a libraries directory and have told OpenSCAD where to
find the libraries by setting the path.  If libraries have includes that
don't work with a setup like this I'd call it a bug in the library.   It
looks like dotSCAD assumes that you've got it on your path, which means
you'd have to add your libraries/dotSCAD directory to the path, which seems
like asking for trouble when there are files like sweep.scad which could
well exist in many libraries.   So dotSCAD should be fixed so that it
doesn't have to be on your path to run.  


> If any of those files include other material from the library it barfs.
> BOSL2 seems to behave pretty well.. I was just wondering how others deal
> with this stuff. I'm sure I could go and edit the offending files to
> prefix
> them with dotscad but perhaps this has already been solved.  Thanks
> again!!

This is not a solution.  You'll have to do it again and again when you
update the lib, for example.  I would suggest that you bug the author to
make it work with full relative paths.   Another observation is that if you
posted an example where you included dotSCAD/foo.scad I would have known
where to look for the file.  




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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

ps91Rick
Thanks Adrian.. I took your code, preferable to mine, and tweaked it a bit to
show you what I was looking to do.  

Here's the code as of now :

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

circle_degrees=180;
wall_height=150;
wall_thickness=2;

handle_height=130;
handle_thickness=2;
handle_width=75;

union() {

bottomarc = apply(xscale(2),arc(N=30,angle=[0,circle_degrees], r=100));
bottom = concat(bottomarc, reverse(apply(back(wall_thickness), bottomarc)));

toparc = apply(xscale(1.6),arc(N=30,angle=[0,circle_degrees], r=90));
top = concat(toparc, reverse(apply(back(wall_thickness), toparc)));

skin([bottom, top], z=[0,wall_height], slices=10);
//
translate([140,20,20])
    rotate(a=0, v=[1,1,0])
        % cube([handle_width,handle_thickness,handle_height],false);
}

Here's a pic of it :

<http://forum.openscad.org/file/t2804/Screen_Shot_2020-04-16_at_6.png>

I also need to rotate that same shape to intersect with the cone at a
different angle.  I think it's on the X axis but in playing around with the
rotate command it wasn't doing what I thought/expected.  Here's a similar
setup but using a different app.. Hopefully this makes sense.. Maybe I'm not
quite there yet with the rotate command and understanding it. Thanks again
for any direction/suggestions,etc.  

<http://forum.openscad.org/file/t2804/IMG_0048.jpg>



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

adrianv
As I noted before, my code produces a tapered shell that is 2 units thick at
the center but nowhere else: it tapers to a sharp corner at the ends.  If
you want a uniform 2 unit width you need to construct parallel curves,
either using the BOSL2 offset() function or directly.  (If your curves are
ellipses, using offset() is your best bet.  If they are circles, for
example, you can do it directly.)  

I don't know what your requirements are for the "handle".   Rotating around
[1,1,0] is going to be hard to understand.  I suggest rotating around just
the coordinate axes, and just one of them at a time.

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

circle_degrees=180;
wall_height=150;
wall_thickness=2;

handle_height=130;
handle_thickness=2;
handle_width=75;

bottomarc = apply(xscale(2),arc(N=30,angle=[0,circle_degrees], r=100));
bottom = concat(bottomarc, reverse(apply(back(wall_thickness), bottomarc)));

toparc = apply(xscale(1.6),arc(N=30,angle=[0,circle_degrees], r=90)); top =
concat(toparc, reverse(apply(back(wall_thickness), toparc)));

skin([bottom, top], z=[0,wall_height], slices=10); //
translate([140,20,20])
    rotate(30)
        % cube([handle_width,handle_thickness,handle_height],false);


If you want the handle to be perpendicular to the surface that's quite a bit
harder to do.  You could compute the normals to the bottom and top (using
path_normals()) and then use skin() again to construct a rectangle based on
those normals.   I'm not certain what that would look like.  The "rectangle"
you construct might end up twisted if the top and bottom normals aren't
coplanar.  You could add the handle to the top and bottom paths so it gets
constructed by the existing skin call.

You need to decide what your goal is.  You can also get something vaguely
perpendicular by futzing around with rotate statements until it looks "close
enough".    Raplacing the rotate(30) with zrot(32)xrot(-10) does something
like that.  This approach is not adaptive, so if you need to change your
model in some other way then this part breaks and you need to futz around
again.  





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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to adjust this model a bit..?

ps91Rick
Thanks Adrian.. I’ll play around more with this. Thanks so much for your insight and help!



Sent from myMail for iOS


Friday, April 17, 2020, 5:16 AM -0700 from [hidden email] <[hidden email]>:
As I noted before, my code produces a tapered shell that is 2 units thick at
the center but nowhere else: it tapers to a sharp corner at the ends. If
you want a uniform 2 unit width you need to construct parallel curves,
either using the BOSL2 offset() function or directly. (If your curves are
ellipses, using offset() is your best bet. If they are circles, for
example, you can do it directly.)

I don't know what your requirements are for the "handle". Rotating around
[1,1,0] is going to be hard to understand. I suggest rotating around just
the coordinate axes, and just one of them at a time.

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

circle_degrees=180;
wall_height=150;
wall_thickness=2;

handle_height=130;
handle_thickness=2;
handle_width=75;

bottomarc = apply(xscale(2),arc(N=30,angle=[0,circle_degrees], r=100));
bottom = concat(bottomarc, reverse(apply(back(wall_thickness), bottomarc)));

toparc = apply(xscale(1.6),arc(N=30,angle=[0,circle_degrees], r=90)); top =
concat(toparc, reverse(apply(back(wall_thickness), toparc)));

skin([bottom, top], z=[0,wall_height], slices=10); //
translate([140,20,20])
    rotate(30)
        % cube([handle_width,handle_thickness,handle_height],false);


If you want the handle to be perpendicular to the surface that's quite a bit
harder to do. You could compute the normals to the bottom and top (using
path_normals()) and then use skin() again to construct a rectangle based on
those normals. I'm not certain what that would look like. The "rectangle"
you construct might end up twisted if the top and bottom normals aren't
coplanar. You could add the handle to the top and bottom paths so it gets
constructed by the existing skin call.

You need to decide what your goal is. You can also get something vaguely
perpendicular by futzing around with rotate statements until it looks "close
enough". Raplacing the rotate(30) with zrot(32)xrot(-10) does something
like that. This approach is not adaptive, so if you need to change your
model in some other way then this part breaks and you need to futz around
again.





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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org