Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WebWeaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fxk8y
WebWeaver
Commits
bbf826ed
Commit
bbf826ed
authored
3 years ago
by
fxk8y
Browse files
Options
Downloads
Patches
Plain Diff
Add more specific centering options to roundRect(…)
parent
984cd48c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scad/piping/pipes.scad
+12
-12
12 additions, 12 deletions
scad/piping/pipes.scad
scad/util/common.scad
+10
-9
10 additions, 9 deletions
scad/util/common.scad
with
22 additions
and
21 deletions
scad/piping/pipes.scad
+
12
−
12
View file @
bbf826ed
...
...
@@ -13,8 +13,8 @@ module straightPipe(width, height, length, radius, strength, center=false) {
tz = center ? -l/2 : 0;
translate([0, 0, tz]) linear_extrude(l) difference() {
roundRect(w, h, r);
roundRect(w - _str*2, h - _str*2, r - _str);
roundRect(w, h, r
, center=true
);
roundRect(w - _str*2, h - _str*2, r - _str
, center=true
);
}
}
...
...
@@ -34,8 +34,8 @@ module cornerPipe(width, height, diameter, angle, radius, strength, center=false
tz = center ? 0 : h/2;
translate([0, 0, tz]) rotate_extrude(angle=a, convexity=8) translate([w/2 + d/2, 0, 0]) difference() {
roundRect(w, h, r);
roundRect(w - _str*2, h - _str*2, r - _str);
roundRect(w, h, r
, center=true
);
roundRect(w - _str*2, h - _str*2, r - _str
, center=true
);
}
}
...
...
@@ -64,8 +64,8 @@ module helixPipe(width, height, length, diameter, angle, radius, strength, cente
tz = center ? 0 : h/2;
translate([0, 0, tz]) linear_extrude(l, twist=a, convexity=8) translate([0, 0, 0]) difference() {
roundRect(w, h, r);
roundRect(w - _str*2, h - _str*2, r - _str);
roundRect(w, h, r
, center=true
);
roundRect(w - _str*2, h - _str*2, r - _str
, center=true
);
}
}
...
...
@@ -85,14 +85,14 @@ module adapterPipe(
difference() {
// outer shell
hull() {
linear_extrude(epsilon) roundRect(w0, h0, r0);
translate([x_off, y_off, l - epsilon]) linear_extrude(epsilon) roundRect(w1, h1, r1);
linear_extrude(epsilon) roundRect(w0, h0, r0
, center=true
);
translate([x_off, y_off, l - epsilon]) linear_extrude(epsilon) roundRect(w1, h1, r1
, center=true
);
}
// inner hole
hull() {
linear_extrude(epsilon) roundRect(w0 - str0*2, h0 - str0*2, r0 - str0);
translate([x_off, y_off, l - epsilon]) linear_extrude(epsilon) roundRect(w1 - str1*2, h1 - str1*2, r1 - str1);
linear_extrude(epsilon) roundRect(w0 - str0*2, h0 - str0*2, r0 - str0
, center=true
);
translate([x_off, y_off, l - epsilon]) linear_extrude(epsilon) roundRect(w1 - str1*2, h1 - str1*2, r1 - str1
, center=true
);
}
}
}
...
...
@@ -115,11 +115,11 @@ module crossNPipe(width, height, length, radius, strength, N, center=false) {
translate([0, 0, tz]) difference() {
for (rz=[0:360/N:360]) rotate([-90, 0, rz]) linear_extrude(l) {
roundRect(w, h, r);
roundRect(w, h, r
, center=true
);
}
for (rz=[0:360/N:360]) rotate([-90, 0, rz]) linear_extrude(l + epsilon) {
roundRect(w - _str*2, h - _str*2, r - _str);
roundRect(w - _str*2, h - _str*2, r - _str
, center=true
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
scad/util/common.scad
+
10
−
9
View file @
bbf826ed
...
...
@@ -28,15 +28,16 @@ module roundTri(w, h, r, style="inner") {
* TODO: Moar documentation!
*
*/
module roundRect(w, h, r) {
if (r > 0) {
_dw2 = (w - 2*r) / 2;
_dh2 = (h - 2*r) / 2;
hull() for (tx=[-_dw2, _dw2], ty=[-_dh2, _dh2]) translate([tx, ty, 0]) circle(r=r);
} else {
square([w, h], center=true);
}
module roundRect(w, h, r, center=false, centerX=false, centerY=false) {
tx = center || centerX ? -w/2 : 0;
ty = center || centerY ? -h/2 : 0;
translate([tx, ty, 0])
if (r > 0)
hull() for (_tx=[r, w-r], _ty=[r, h-r]) translate([_tx, _ty, 0]) circle(r=r);
else
square([w, h]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment