oskarlinde / scad-utils Goto Github PK
View Code? Open in Web Editor NEWUtility libraries for OpenSCAD
License: MIT License
Utility libraries for OpenSCAD
License: MIT License
Hi, I found this example from 2014 which looks like something I've been after, except there is an 'r' parameter in linear_extrude which gets thrown up as a warning as it doesn't exist. Images of the example rendered from here: http://forum.openscad.org/Experiment-with-rounded-extrusions-td7928.html and my render which has only half of the round edges. Can anyone explain where the 'r' parameter in linear_extrude might be found?
use <scad-utils/morphology.scad>
eps = 0.01;
$fn=64;
module base() {
union() {
rounding(2) fillet(2) difference() {
square([50,40]);
translate([(50-25)/2,40-15]) square([25,20]);
}
rounding(0.25) square([50,10]);
}
}
difference() {
linear_extrude(height=10,r=0.25,convexity=3)
base();
translate([0,0,-eps]) linear_extrude(height=10 + 2*eps,r=-1,convexity=3)
translate([(50-30)/2,5])
rounding(2) square([30,15]);
rotate([90,0,0])
translate([5,2.5,-1])
linear_extrude(height=1+eps,r=[0.25,-0.25])
rounding(1) square([40,5]);
}
for (x = [6.25, 50-6.25])
translate([x, 40-6.25, 10])
linear_extrude(height=5,r=[-.25,.25],chamfer=[0,1])
circle(r=2);
Hi, the latest OpenSCAD version produces the warning above, for example when running the list-comprehension-demos/toothed-belt.scad
I thought that to be be trivially fixable, but I have found the following behavior hard to grasp:
vec_is_undef([1,2,3,undef], index_=3) == true
vec_is_undef([1,2,3,undef,4], index_=3) == false
What is the rationale behind that? Do we actually need it?
In shapes.scad, the winding order of the shapes are inconsistent.
This causes trouble when sweep()-ing (as in https://github.com/openscad/list-comprehension-demos/blob/master/sweep.scad) circle(), as the normals of the resulting polygon end up pointing inwards instead of outwards.
It would probably make sense to make all of the shapes have anti-clockwise winding order, to match the OpenSCAD polyhedron expectations.
(btw, I'm happy to submit a pull request to fix it if you agree)
Sorry, maybe I'm a dump guy.. please can you help me:
There is a Readme.md and there are the files. But there is almost NO connection between the two.
Readme shows a lot examples with "shape", but there is no "shape" in the files. And all the other files (except mirror) are not mentioned in the readme..? How can I use it (of course I can read the scad files and experiment, but is that expected)?
The library has lots of nice code which is generally useful, but without a clear license, it's basically not possible to distribute the code along with OpenSCAD or as separate package in Linux distributions. I hope you would like to see it included / distributed, so please add a license to make it possible.
I'm trying to use the scad-utils as described by mathgrl at https://mathgrrl.com/hacktastic/2018/11/knots-in-openscad-with-sweeper/
use <sweep.scad>
use <scad-utils/shapes.scad>
function f(a,b,t) = // rolling knot
[ a * cos (3 * t) / (1 - b* sin (2 t)),
a * sin( 3 * t) / (1 - b sin (2 t)),
1.8 * b * cos (2 * t) /(1 - b sin (2 *t))
];
a = 0.8;
b = sqrt (1 - a * a);
function shape() = circle(60, $fn=48);
step = 0.005;
path = [for (t=[0:step:1-step]) 200 * f(a,b,t*360)];
path_transforms = construct_transform_path(path);
sweep(shape(), path_transforms, true);
Lots of the code in sweeper seems to rely on scad-utils and includes something called shapes.scad from there.
Anyone know where to find that as its no longer here it seems ?
Sorry if this is a dull question
All help much appreciated.
Hi Oskar,
I don't remember when exactly cross() was added into OpenSCAD - it's been several years since my initial add of linear algebra support and Marius' full re-write - but it makes this (re)definition obsolete:
Line 3 in 484d39b
See docs: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#cross
Andrew.
Example producing emptiness:
rounding(r=1) shell(d=-1) square(10);
It appears that pull request #1 should have included the lists.scad file as well, as it adds the remove() function that is required by the spline() function.
is this supposed to work ?
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/hull.scad>
use <list-comprehension-demos\skin.scad>
fn=32;
$fn=60;
r1 = 25;
r2 = 10;
R = 40;
th = 2;
function rhull(r)=[for(i=hull(r))r[i]];
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(
rotation([0,180/fn*i,0])*translation([-R,0,0]),
rhull(concat(circle(r1+(r1-r2)/fn*i),square((r1+2.5*r1/2))))
)
]);
// echo( concat(circle(r1+(r1-r2)/2),square((r1+r2)*2)));
// echo(rhull(concat(circle(r1+(r1-r2)/2),square((r1+r2)*2))));
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0,180/fn*i,0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
}
}
tube();
modified from here:
http://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
This module seems to be what I'm looking for but I don't quite grasp how to control it. Is there some documentation about it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.