sebitimewaster / chamfers-for-openscad Goto Github PK
View Code? Open in Web Editor NEWCreate OpenSCAD primitives with 45° chamfers
License: Other
Create OpenSCAD primitives with 45° chamfers
License: Other
Purpose to have a possibility to define the number of segments.
Useful to create an hexagon (nut) for example.
By mofifying the circleSegments:
function circleSegments(r, q = -1.0) = ($fn>0) ? $fn : ((r * PI * 4 + 40) * ((q >= 0.0) ? q : globalCircleQuality));
Example to use:
chamferCylinder(r=8,h=8,$fn=8,ch2=0);
I'm loving your library so far! Thank you so much.
I've only used chamferCube
so far. Therefore I don't know if the following concept would apply well elsewhere.
I'm thinking of modifying the chamferCube
to add an additional option param similar to:
* @param chamfers Which chamfers to render along the [x, y, z] axis,
* example: [[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]
* X axis: 4 values in clockwise order starting from
* the zero point, as seen from "Left view" (Ctrl + 6)
* Y axis: 4 values in clockwise order starting from
* the zero point, as seen from "Front view" (Ctrl + 8)
* Z axis: 4 values in clockwise order starting from
* the zero point, as seen from "Bottom view" (Ctrl + 5)
The param would take an oct/hex representation of the chamfers
2D vector. The conversion would be very similar to the way Unix file permissions read
, write
, executeare represented as
1,
2,
4and any combination can be represented by the range 1-7. But in the case of 4 corners for a square, you need to use
1,
2,
4,
8`.
[1, 0, 1, 0] = 5
[0, 0, 1, 1] = 12
[0, 1, 1, 1] = 14
While the example above could be represented as 5CE
, I don't favor it for a few reasons:
I would like to get your input before I start coding something up. I'd like to do it in a way that you might consider accepting as a PR.
A few questions I have:
ch0
)[5, 12, 14]
or "5 12 14"
?)This file demonstrates the issue:
$fn = 120;
include <Chamfers-for-OpenSCAD/Chamfer.scad>;
difference() {
cube( [ 20, 20, 10 ] );
translate( [ 10, 10, -1 ] ) chamferCylinder( r = 5, h = 12, ch = - 2, ch2 = - 2 );
translate( [ -1, -1, -1 ] ) cube( [ 22, 11, 12 ] );
}
translate( [ 30, 10, -1 ] ) chamferCylinder( r = 5, h = 12, ch = - 2, ch2 = - 2 );
Although I've made the chamferedCylinder a bit higher than the cube, the preview (F5) shows a hole that does not go through.
Suggestion for a fix:
Edit:
I just realized that my suggested fix works only for negative chamfers. This is the one that works for both:
117c117
< translate([0, 0, abs(chamferHeight)]) cylinder(height - abs(chamferHeight2) - abs(chamferHeight), r1 = radius, r2 = radius2, $fn = circleSegments(max(radius, radius2), quality));
---
> translate([0, 0, chamferHeight > 0 ? chamferHeight : 0]) cylinder(height - (chamferHeight2 > 0 ? chamferHeight2 : 0) - (chamferHeight > 0 ? chamferHeight : 0), r1 = radius, r2 = radius2, $fn = circleSegments(max(radius, radius2), quality));
First off, great library! Just wanted to say it would be a nice to be able to specify whether the produced object is to be centered, or not, as in the vanilla OpenSCAD primitives, by specifying center=true. Similiarly being able to specify diameter rather than radius, so that chamferCylinder can be used as a drop-in replacement for cylinder, etc.
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.