Advertisement
churchx

forced render instead of preview?

May 22nd, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | Source Code | 0 0
  1. module roundedSquareNotMinkowski(height=1, x=squareSide, y=squareSide, cornerRad=baseCornerRadius) {
  2. // forces render instead of preview on open, if using this instead of minkowsky one
  3. actualCornerRadius = min(x/2, y/2, cornerRad);
  4. xx=max(smidge, x/2-actualCornerRadius); yy=max(smidge, y/2-actualCornerRadius);
  5. if (cornerRad > 0.01) { ch=height+smidge;
  6. hull() {
  7. for(i=[-1:2:1]) { for(j=[-1:2:1]) {
  8. translate([i*xx,j*yy,0]) cylinder(h = ch, r=actualCornerRadius, center=true, $fn=circFnCalc(actualCornerRadius));
  9. } } }
  10. } else { sm3=smidge*3;
  11. hull() {
  12. for(i=[-1:2:1]) { for(j=[-1:2:1]) {
  13. translate([i*xx,j*yy,0]) cube([smidge,smidge,sm3], center=true);
  14. } } }
  15. }
  16. }
  17.  
  18. module roundedSquare(height=1, x=squareSide, y=squareSide, cornerRad=baseCornerRadius) {
  19. actualCornerRadius = min(x/2, y/2, cornerRad);
  20. minkowski() {
  21. cube(size=[max(smidge, x-(2*actualCornerRadius)), max(smidge, y-(2*actualCornerRadius)), height], center=true);
  22. if (cornerRad > 0.01) { cylinder(r1=actualCornerRadius, r2=actualCornerRadius, h=smidge, center=true, $fn=circFnCalc(actualCornerRadius));
  23. } else { cube([smidge, smidge, smidge]); }
  24. }
  25. }
Tags: OpenSCAD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement