Skip to content

Commit

Permalink
Merge pull request #28 from Irev-Dev/kurt/polyRoundExtrude-unbounded-26
Browse files Browse the repository at this point in the history
Add error message when there are not enough polyRoundExtrude points
  • Loading branch information
Irev-Dev authored May 30, 2021
2 parents f9928e3 + 66f30be commit 8ead00a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions polyround.scad
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,15 @@ let(
];

module polyRoundExtrude(radiiPoints,length=5,r1=1,r2=1,fn=10,convexity=10) {
orderedRadiiPoints = CWorCCW(radiiPoints) == 1
? reverseList(radiiPoints)
: radiiPoints;

polyhedronPointsNFaces=extrudePolygonWithRadius(orderedRadiiPoints,length,r1,r2,fn);
polyhedron(points=polyhedronPointsNFaces[0], faces=polyhedronPointsNFaces[1], convexity=convexity);
assert(len(radiiPoints) > 2, str("There must be at least 3 radii points for polyRoundExtrude. ", radiiPoints, " is not long enough, you need ", 3 - len(radiiPoints), " more point/s. Example: polyRoundExtrude([[11,0,1],[20,20,1.1],[8,7,0.5]],2,0.5,-0.8,fn=8);"));
if(len(radiiPoints) > 2) {
orderedRadiiPoints = CWorCCW(radiiPoints) == 1
? reverseList(radiiPoints)
: radiiPoints;

polyhedronPointsNFaces=extrudePolygonWithRadius(orderedRadiiPoints,length,r1,r2,fn);
polyhedron(points=polyhedronPointsNFaces[0], faces=polyhedronPointsNFaces[1], convexity=convexity);
}
}


Expand Down

0 comments on commit 8ead00a

Please sign in to comment.