Code Monkey home page Code Monkey logo

round-anything's People

Contributors

damienmg avatar irev-dev avatar jamespbryan avatar nfedyashev avatar nickcoutsos avatar tlc123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

round-anything's Issues

query about beamChain.

Greetings,

Apologies for the elementary question about PolyRound. Sometimes when I call beamChain I get warnings "Tan() parameter could not be converted...".

Typically, either a portion of the curve is not rendered (the first vertex or last), or sometimes the entire curve is not rendered.

Is there some guidance on how do avoid these sorts of problems?

Here is a sample codeblock that causes such a problem:

R = 1.6;
PTL = [ [20,0,R], [19,2,R], [12,2,R], [10,4,R], [1,4,R], [0,3,R], [0,0,R] ];

polygon(polyRound(beamChain(PTL, offset1=0.4, offset2=0, mode=1), 20));

As a side-note, if I call it without "mode=1", OpenSCAD does not render anything.

I'm running OpenSCAD 2019.05, in case this is relevant.

Your sample code works fine, so I imagine the problem must be in the geometry I'm submitting to beamChain.

edit: after a little fiddling around it seems the last coordinate [0,0,R] is the one causing the trouble. If I change it to [0.1,0,R] the code runs as I would expect. Perhaps the code can't handle points at the origin?

beamChain breaks on horizontal/vertical segments

Hi,
I've found that beamChain breaks on horizontal and vertical segments of polyline:

When eps is non-zero, it does work:

a=10;
eps=1e-6;
points=[[0, 0, 0], [0+eps, a, 0], [a, a+eps, 0]];
polygon(polyRound( beamChain(points, offset1=1, offset2=-1), 30));

but when eps=0 it breaks (doesn't show anything and sometimes - not always throw a undef error):

a=10;
eps=0;
points=[[0, 0, 0], [0+eps, a, 0], [a, a+eps, 0]];
polygon(polyRound( beamChain(points, offset1=1, offset2=-1), 30));

PS: Thanks for the great library I'm starting with OpenSCAD and I like polyRound very much.

unionRoundMask can cause first layer problems

Under some circumstances unionRoundMask requires re-flattening of the bottom of the model before slicing.

Consider:

`use <Round-Anything-1.0.4/unionRoundMask.scad>
$fn = 36;
unionRoundMask( r = 1 , detail = $preview ? 3 : 10 , q= $preview ? 30 : 70, showMask = true ) {
cylinder (h=5, r=15);
cylinder (h=10, r=10);

}

translate([40,0,0])
union(){
cylinder (h=5, r=15);
cylinder (h=10, r=10);
}`

Examine the bottoms of both objects. Not a big problem, but does require attention if the fillet in near the base of the object.

Add support and/or example for rounding text

I want to round/filet some 3d text. Is that feature currently supported?

If yes, can you give an example and I'll add it to the example docs.

If no, what is required to implement that? Is it extremely difficult?

Minkowski Round faster

Hi, not sure if you've noticed, but newer development snapshots of openscad have a new renderer called "manifold". This one renders orders of magnitude faster, even Minkowski is not slow anymore.

So, please don't remove the minkowski round function, it has been sped up greatly :)

polyRoundExtrude with internal holes

Is there a way to use polyRoundExtrude on a polygon set with internal holes (e.g., a doughnut)?

If not, is there a way to achieve a similar effect of top+bottom chamfers (rounding X/Y/Z) and rounded edges (X/Y)? polyRound smooths in (X/Y), but then extruding it doesn't have a convient way to chamfer, and polyRoundExtrude can't take in the output of polyRound...

I may source-dive and cobble something together later, if I have the time...

shell2d makes a circle look low-poly

Given this code, I get the following preview/render/stl/print. I thought it might just be a rendering issue, so, I've tracked it at each step including printing, and I'm unsure how to resolve it. Any guidance?

include <../OpenSCAD-Round-Anything/polyround.scad>
$fn=1000;

circle(2);

translate([0, 0, 3])shell2d(-0.5)circle(2);

image

polyRoundRotate/rotate_extrudeWithRadius functionality

If I want to round the corners on a rotated solid polygon as is done with extrudeWithRadius(), is that possible with the library as-is?

I tried to illustrate what I'm looking for with this image and code-- I'd like the x=400 column to round the start,stop, and intermediate corners of the revolved solid in the X=300 column. Is this what beamChains can do?

image

use <Round-Anything/polyround.scad> // https://github.com/Irev-Dev/Round-Anything


function makeRadiiPoints(r1, r2)=[[0,0,0],[0,20,r1],[20,20,r1],[20,0,0]];

// radii are too large again and are reduced to fit, but keep their ratios.
// r1 will go from 10 to 4 and r2 will go from 40 to 16




translate([0,100,0])x0(); //initial shape
translate([100,100,0])x1(); // $fn=3 extrudeWithRadius polygon
translate([200,100,0])x2(); //  rotate_extrude polygon
translate([300,100,0])x3();

translate([0,200,0])c0(); // $fn=3 rotated circle
translate([100,200,0])c1(); // $fn=3 rotated circle
translate([200,200,0])c2(); // $fn=3 rotated circle
translate([300,200,0])c3(); // $fn=3 rotated circle

module x0(){
    polygon(polyRound(makeRadiiPoints(10,40),50));
}

module x1(){
    // from     https://learn.cadhub.xyz/docs/round-anything/api-reference/
    translate([25,0,0])x0();
}
module x2(){
    // 
    extrudeWithRadius(10,-2,2)x0();
}
module x3(){
    // 
    rotate_extrude(angle=180,$fn=8)x0();
}

module x4(){
    // 
    //rotate_extrudeWithRadius(angle=180,2,-2,2,$fn=8)x0();
}


module x5(){
    // 
    rotate_extrude($fn=3)x0();
}

module c0(){
    translate([25,0,0])circle(10);
}

module c1(){
    linear_extrude(10)c0();
}
module c2(){
    extrudeWithRadius(10,-2,2)c0();
}

module c3(){
    rotate_extrude(angle=180,$fn=8)c0();
}


module c4(){
   // rotate_extrudeWithRadius(angle=180,2,-2,2,$fn=8)c0();
}


extrudeWithRadius rounds top and bottom differently

If you specify the same radius for top and bottom, the rendered shape is different for the top and the bottom. The top and bottom layers seem to be shifted by 1 layer. Example (see picture):

extrudeWithRadius(5,r1=2,r2=2,fn=10)
  offset(r = 5) 
    offset(delta = -5)  
      polygon([[0,0],[20,0],[20,20]]);


module extrudeWithRadius(length,r1=0,r2=0,fn=30){
  n1=sign(r1);n2=sign(r2);
  r1=abs(r1);r2=abs(r2);
 # translate([0,0,r1]){
    linear_extrude(length-r1-r2){
      children();
    }
  }
  for(i=[0:fn-1]){
    translate([0,0,i/fn*r1]){
      linear_extrude(r1/fn+0.01){
        offset(n1*sqrt(sq(r1)-sq(r1-i/fn*r1))-n1*r1){
          children();
        }
      }
    }
    translate([0,0,length-r2+i/fn*r2]){
      linear_extrude(r2/fn+0.01){
        offset(n2*sqrt(sq(r2)-sq(i/fn*r2))-n2*r2){
          children();
        }
      }
    }
  }

}

function sq(x)=x*x;

extrudeWithRadius-rounds-top-and-bottom-differently

Helpers for converting [x, y] tuples to [x, y, r] tuples and back

One of the consistent API pain points I have is moving between an [x, y] and [x, y, r] coordinate lists. I frequently find I want to start with a polygon in [x, y] space while developing iteratively, and only later move it to an [x, y, r] polygon. Additionally, I've wanted to use translateRadiiPoints for regular [x, y] polygons before. Here are two (dumb, simple) helper functions that I frequently use; I think Round-Anything could benefit from similar (better-named) functions.

function rless(list) = [for (i=[0:len(list)-1]) [list[i][0], list[i][1]]] ;
function rish(list, r) = [for (i=[0:len(list)-1]) [list[i][0], list[i][1], r]] ;

Example where rless is helpful:

portWidth = 5;
portHeight = 12.50;
points = [
    [0,         0,           2],
    [0,         portHeight,  2],
    [portWidth, portHeight,  2],
    [portWidth, 0,           2],
];

polygon(rless(points));

And for rish:

portWidth = 5;
portHeight = 12.50;
points = [
    [0,         0],
    [0,         portHeight],
    [portWidth, portHeight],
    [portWidth, 0],
];

polygon(rless(translateRadiiPoints(rish(points, 0)));

polyRoundExtrude can run unboundedly

use <Round-Anything/polyround.scad>
polyRoundExtrude([], 20, 1, 1);

Bad input frequently leaves polyRoundExtrude rendering indefinitely. Is this a problem where the rules for valid/invalid input are easy enough to validate? If not, is it possible to put a max on the # of iterations run (possibly as an argument to the method or read from a constant the user can extend)? I'm unsure how to get out of this state besides killing the openSCAD process.

Example beamChain-1.scad Appears to be Broken

It appears that example beamChain-1.scad is broken. I get the following error:

Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
WARNING: Unable to convert translate(undef) parameter to a vec3 or vec2 of numbers in file beamChain-1.scad, line 16
TRACE: called by 'translate' in file beamChain-1.scad, line 16
TRACE: called by 'linear_extrude' in file beamChain-1.scad, line 13
Execution aborted

I am running OpenSCAD daily OpenSCAD-2024.03.23-x86-64.

WARNING: undefined operation (undefined + number) in file polyround.scad, line 174 when using polyRoundExtrude()

Hi Kurt, let me first thank you for this great library that helps me make my humble designs look a little less angular.

Now that I use the polyRoundExtrude() more often, I always get this four warnings that also comes with the polyRoundExtrudeExample() in your roundAnythingExamples.scad:

Loaded design '/home/fex/3D-Druck/OpenSCAD/Round-Anything/roundAnythingExamples.scad'.
Compiling design (CSG Tree generation)...
WARNING: undefined operation (undefined + number) in file polyround.scad, line 174
WARNING: undefined operation (undefined + number) in file polyround.scad, line 174
WARNING: undefined operation (undefined + number) in file polyround.scad, line 174
WARNING: undefined operation (undefined + number) in file polyround.scad, line 174

The warning is annoying and should not happen. Is there a way to avoid this?

polyRoundExtrude cannot be used in difference

I cannot use polyRoundExtrude within difference(). I have OpenSCAD version 2019.05.

To reproduce it, here are some definitions first:

use <polyround.scad>;

base_outer_points = [
    [-10.5,  10,  1],
    [ 10.5,  10,  1],
    [ 10.5, -10,  1],
    [-10.5, -10,  1],
];
base_outer_height = 6;

base_inner_points = [
    [-9.5, -9, .5],
    [-9.5,  9, .5],
    [ 9.5,  9, .5],
    [ 9.5, -9, .5]
];  
base_inner_height = 4;

When I append the following:

difference() {
        polyRoundExtrude(base_outer_points, base_outer_height, 0.7, 0);
        translate([0, 0, -.1])
            polyRoundExtrude(base_inner_points, base_inner_height+.1, 0.7, 0);
}

I get the following errors:

 ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/Nef_S2/SM_const_decorator.h Line: 330
 ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/Nef_S2/SM_const_decorator.h Line: 330

and the following output:

`polyRoundExtrude-difference-result

Attachment Point Conundrum

I suspect there is no easy answer to this, but it's been more than half a century since my last math class and I wanted to check in case I missed something really obvious.

Given the code below is there a way calculate the location of the point on the curve closest to the black dot ( [20,25] ) for various rounding values?

`use <Round-Anything-1.0.4/polyround.scad>

points = [
[0, 0, 0],
[10, 0, 0],
[10, 10, 20],
[20, 25, 10],
[0, 15, 20]
];

$fn = 18;
polyline(points, 0.5);
translate([20,25,0]) color("black") circle(0.5);

translate([20,0,0]) {
polyline(polyRound(points), 0.5);
translate([20,25,0]) color("black") circle(0.5);
}`

Screen Shot 2022-04-28 at 3 33 51 PM

Add individual examples

Having one example per file will make for a integration and there live demo links with CadHub.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.