Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add orient parameter to slot() shape #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kesor
Copy link

@kesor kesor commented Jan 2, 2022

The slot() documentation said there should be orient in there, but it was missing.

Copy link
Contributor

@fe60 fe60 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the orientation of the cylinders only won't work.
Simple example:
slot(r=5, h=3, l=20, orient=ORIENT_X);
Resulting solid:
BOSL_PR89_example

I think you will have to arrange the whole object using orient_and_align() as soon as
orient != undef or align != undef

@@ -2121,12 +2121,13 @@ module interior_fillet(l=1.0, r=1.0, ang=90, overlap=0.01, orient=ORIENT_X, alig
module slot(
p1=undef, p2=undef, h=10, l=undef,
r=undef, r1=undef, r2=undef,
d=undef, d1=undef, d2=undef
d=undef, d1=undef, d2=undef,
orient=undef
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
orient=undef
align=V_CENTER, orient=ORIENT_Z

) {
r1 = get_radius(r1=r1, r=r, d1=d1, d=d, dflt=5);
r2 = get_radius(r1=r2, r=r, d1=d2, d=d, dflt=5);
sides = quantup(segs(max(r1, r2)), 4);
hull() spread(p1=p1, p2=p2, l=l, n=2) cyl(l=h, r1=r1, r2=r2, center=true, $fn=sides);
hull() spread(p1=p1, p2=p2, l=l, n=2) cyl(l=h, r1=r1, r2=r2, center=true, $fn=sides, orient=orient);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hull() spread(p1=p1, p2=p2, l=l, n=2) cyl(l=h, r1=r1, r2=r2, center=true, $fn=sides, orient=orient);
if (align!=V_CENTER || orient!=ORIENT_Z) {
orient_and_align(size=[l+2*r1, 2*r1, h], orient=orient, align=align, orig_orient=ORIENT_Z, orig_align=V_CENTER)
solid();
} else {
solid();
}
module solid()
{
hull() spread(p1=p1, p2=p2, l=l, n=2) cyl(l=h, r1=r1, r2=r2, align=V_CENTER, orient=ORIENT_Z, $fn=sides);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants