/r/openscad

Photograph via snooOG

Share news, tips and tricks, and ask questions about how to use 3D CAD modelers for programmers, such as OpenSCAD, CoffeeSCAD, and ImplicitCAD

Quick Links

/r/openscad

6,436 Subscribers

3

How can a fully blind person use Openscad to 3D design and print something that is actually useful?

Hello everyone.

I am fully blind, and in this video, I am demonstrating how I use assistive technology to 3D design and print something that is actually useful.

I hope that you will watch it.

6 Comments
2025/02/02
09:16 UTC

2

OpenSCAD on Windows 11 freezes after startup, even empty. How to diagnose?

I upgraded my PC last fall. I now wanted to get back to some 3D printing projects. Part of the upgrade was going from Win10 to Win11. The openscad I downloaded freezes on startup ("application not responding").

This happens even if I just click "New" - ie. it is not caused by any particular file.

Could someone please guide me on diagnosing this? I cannot even find where would any logfiles for openscad be, so I don't have much to provide to help you help me. The version I have is 2021.01. Seems rather old, but that's the recommended download on the openscad homepage...

Specs: AMD Ryzen 9 7950X3D, Nvidia gtx 1060 (that's the same one I had in my old PC and openscad worked fine)

The same version works fine on my Windows 10 work laptop.

3 Comments
2025/01/31
11:48 UTC

9

csgrs is a new OpenSCAD-like CSG library for Rust built to work with Dimforge

csgrs is a little solid modeling library I've been working on, built around a Binary Space Partitioning tree, which plugs into Dimforge for physical simulation and advanced geometry functions. I'm working toward full coverage of the OpenSCAD feature set, though a few functions are still buggy or absent. I hope some folks here find it useful, and send along bug reports, feature requests, or examples of what they've done with it!

9 Comments
2025/01/30
23:07 UTC

0

Joint Holder with Cap openscad script

Please help me with my moch up design. It just does not seem to fit perfectly to the body of the joint holder.

There needs to be some fine tuning. Any help would be greatly appreciated.

// Joint Holder with a Hole Starting from the Bottom - Thinner Version

module joint_holder() {

// Parameters

height = 110; // Total height of the holder (11 cm)

outer_top_diameter = 16; // Outer diameter at the top (1.6 cm)

outer_bottom_diameter = 8; // Outer diameter at the bottom (0.8 cm)

inner_top_diameter = 14; // Inner hole diameter at the top (1.4 cm)

inner_bottom_diameter = 6; // Inner hole diameter at the bottom (0.6 cm)

wall_thickness = 0.75; // Reduced wall thickness (0.75 cm)

// Increase the resolution for smoother geometry

$fn = 200; // Add a higher value for better resolution

// Create the holder

difference() {

// Outer cone shape (holder body)

cylinder(h = height, r1 = outer_top_diameter / 2, r2 = outer_bottom_diameter / 2);

// Inner hollow cavity with smooth transition (starts from the bottom)

// This ensures a more gradual taper

translate([0, 0, wall_thickness / 2]) // Adjusted translation to maintain thickness

cylinder(h = height - wall_thickness, r1 = inner_top_diameter / 2, r2 = inner_bottom_diameter / 2);

// Ensure the inner cavity cuts through cleanly by extending it slightly downward

translate([0, 0, -1 + wall_thickness / 2]) // Adjusted translation to clean the base

cylinder(h = height - wall_thickness + 1, r1 = inner_top_diameter / 2, r2 = inner_bottom_diameter / 2);

}

}

// Call the module to generate the holder

joint_holder();

// Parameters

cap_height = 9; // Cap height in mm

cap_diameter = 13; // Cap diameter in mm (outer)

lip_depth = 2; // Inside lip depth in mm (to fit on the body)

lip_thickness = 1; // Protruding lip thickness in mm

inner_diameter = 8.8; // Inner diameter in mm (to fit snugly over the body)

round_radius = 2; // Radius of the rounded bottom part

top_grip_radius = cap_diameter / 2; // Radius of the rounded protrusion at the top (same as cap outer diameter)

top_grip_height = 3; // Height of the rounded protrusion at the top

// Main cap body with rounded bottom

difference() {

// Outer cap (cylinder) to define the outer shell of the cap

cylinder(h = cap_height, d = cap_diameter, $fn = 100);

// Inner hollow part to make the cap hollow from base to top

cylinder(h = cap_height, d = inner_diameter, $fn = 100);

// Subtract a rounded bottom from the cap

translate([0, 0, -round_radius]) {

sphere(r = round_radius);

}

}

// Protruding lip to make it easy to pop on/off

translate([0, 0, cap_height - lip_thickness]) {

cylinder(h = lip_thickness, d = cap_diameter + 2*lip_thickness, $fn = 100);

}

// Rounded top grip (flush with the cap surface)

translate([0, 0, cap_height]) {

sphere(r = top_grip_radius);

}

11 Comments
2025/01/29
10:45 UTC

22

https://www.reddit.com/r/functionalprint/comments/1ic2vrz/customizer_for_desktop_cable_management_any_size/

7 Comments
2025/01/28
14:38 UTC

17

Keycap

Making caps for a keyboard
https://imgur.com/a/M5wCQnc

$fs=.1;$fa=1;
size=[15,15];

color("skyblue")
translate([0,0,-2])difference(){
union(){
  for (i =[2:12]){
  j=i+1;
    hull(){
     translate([0,0,i])linear_extrude(.1,scale=.1)offset(i/3)offset(-i/3)square(size-[1,1]*(1-cos(i*8))*4,true);
     translate([0,0,j])linear_extrude(.1,scale=.1)offset(j/3)offset(-j/3)square(size-[1,1]*(1-cos(j*8))*4,true);
    }
  }
}

translate([0,-5,8+25])sphere(25);
}
14 Comments
2025/01/27
09:53 UTC

2

Help needed: Tracing the curve over an imported obj (details in the comments)

25 Comments
2025/01/26
23:13 UTC

13

OpenSCAD Guide: Create Files for Prusa MMU

This is an OpenSCAD guide for making Prusa MMU compatible 3D print files, allowing you to easily create multi-material objects using OpenSCAD. No special beta features here, OpenSCAD from 2021 is fine.

  1. Add this to your .scad file:

    render_color = "ALL";```
    
    ```module mmucolor(color) { if (render_color != "ALL" && render_color != color) %children(); else color(color) children(); }
  2. Design your object using mmucolor() instead of color().

  3. Render your object by setting render_color to each individual color name, and save the multiple STL files. ie: object_red.stl, object_green.stl, etc.

  4. Import the first STL to PrusaSlicer, then right-click the object and select Add Part > Load. Repeat for remaining colors.


Above is based on the work of Erik Nygren / Jeff Barr. I modified for reduced code and added the Background modifier, making unrendered colors preview as transparent.

Sources:


edit: With help from commenters, I wrote pycolorscad: One step renders from OpenSCAD to Color 3MF. No special module declarations. Just use color() normally in your .scad file. https://github.com/thatdecade/pycolorscad

edit2: Here is a no tool solution. Use the OpenSCAD nightly snapshot, design your scad using color(), export to 3MF and select color format. https://imgur.com/a/g389kEv

12 Comments
2025/01/26
18:11 UTC

12

Should BOSL2 be included in OpenSCAD?

MCAD package is distributed with OpenSCAD nowadays, but everyone says to use BOSL2 instead, because MCAD is deprecated or something (i dont know how or why, because it still works for me).

But if BOSL2 is better, why not distribute it along with OpenSCAD instead. So i can be sure that if i share .scad files with someone, they will have it preinstalled.

17 Comments
2025/01/26
15:45 UTC

3

export preview color info into slicer with .3mf

I’m using the development snapshots and Orca/Bambu slicer along with 3rd, not STL as the export option.

In the .3mf export dialog it asks about exporting color information as either color or base material. Has anyone gotten a working workflow for getting this data into a slicer? My current workaround is using lazy-union with separate parts but that’s ugly as sin.

0 Comments
2025/01/26
15:26 UTC

34

BOSL2 now has metaballs and isosurfaces

BOSL2 now supports isosurfaces and meta-balls!

Wiki page here: https://github.com/BelfrySCAD/BOSL2/wiki/isosurface.scad

This was a tremendous solo effort and I'm rather proud of it. About a third of the work was just writing the documentation.

While I've seen some OpenSCAD attempats at metaballs on Thingiverse, nobody (as far as I know) has ever done it with a polyhedron mesh. That's what this is. If you do play with it, start with a large voxel size and work your way down, being mindful of your bounding box. A small voxel size with a large bounding box can involve millions of calculations.

It's reasonably fast on my computer (5-year-old midrange Windows laptop); the first metaball example takes about 8 seconds for me, but someone reported to me that a MacBook Pro took several minutes. I tried to make it as efficient as possible, trying to minimize function calls and recursions, but when you're dealing with large 3D arrays of data, OpenSCAD isn't going to be fast.

It works with OpenSCAD 2021.01 or a recent snapshot.

21 Comments
2025/01/25
19:02 UTC

6

Trying to figure out how to parametricly add screw hole - See Reply in Post for info

8 Comments
2025/01/24
18:18 UTC

2

NEED online OpenSCAD Render website, Render--> STL download

hey guys I really need a website to r4ender my OpenSCAD code into a OpenSCAD file and be able to download or export as .STL. I was using Ochafik website last year but now they dont have the download as .STL anymore and the OpenSCAD program sucks at rendering it is so slow I have been on 999/1000 for an hour even after lowering $fn from 64 to 24 Please advise.

23 Comments
2025/01/23
22:57 UTC

1

Opportunities for Geometric Algorithm Experts (CAD kernel)

The Internet is a big place, and my favourite place to find the real deal is reddit...

Are there any mathematicians here who might be interested in a new opp to write underlying algorithms for kernels?

Europe Based, amazing time to join, amazing salaries and relocation.

Sorry to infiltrate this group, just very exiting proposition

Will understand if removed from the group (London based if helps with time zones)

1 Comment
2025/01/23
15:49 UTC

5

Not understanding why very shallow loops over static 2-element vectors are SOOOO slow

Edit: I'm on an ancient nightly, like a dodo. Latest fixed the issue.

I'm making a parametric regular dodecahedron.

With explicit generation, this renders nearly instantly:

$fn=50;

PHI = (1 + sqrt(5)) / 2;
CORNER_RADIUS = 0.1;
SCALE = 1;

scale([SCALE, SCALE, SCALE]){
  hull(){
    
    // twenty vertices; let's count 'em off!
    // (±1 , ±1 , ±1), (0, ±ϕ, ±1/ϕ), (±1/ϕ, 0, ±ϕ), (±ϕ, ±1/ϕ, 0)
    
    // base unit cube: (±1 , ±1 , ±1)
    translate([1,1,1]) sphere(CORNER_RADIUS);
    translate([1,1,-1]) sphere(CORNER_RADIUS);
    translate([1,-1,1]) sphere(CORNER_RADIUS);
    translate([1,-1,-1]) sphere(CORNER_RADIUS);
    translate([-1,1,1]) sphere(CORNER_RADIUS);
    translate([-1,1,-1]) sphere(CORNER_RADIUS);
    translate([-1,-1,1]) sphere(CORNER_RADIUS);
    translate([-1,-1,-1]) sphere(CORNER_RADIUS);
    
    // (0, ±ϕ, ±1/ϕ)
    translate([0,  PHI,  1 / PHI]) sphere(CORNER_RADIUS);
    translate([0,  PHI, -1 / PHI]) sphere(CORNER_RADIUS);
    translate([0, -PHI,  1 / PHI]) sphere(CORNER_RADIUS);
    translate([0, -PHI, -1 / PHI]) sphere(CORNER_RADIUS);
    
    // (±1/ϕ, 0, ±ϕ)
    translate([ 1 / PHI, 0,  PHI]) sphere(CORNER_RADIUS);
    translate([ 1 / PHI, 0, -PHI]) sphere(CORNER_RADIUS);
    translate([-1 / PHI, 0,  PHI]) sphere(CORNER_RADIUS);
    translate([-1 / PHI, 0, -PHI]) sphere(CORNER_RADIUS);
    
    // (±ϕ, ±1/ϕ, 0)
    translate([ PHI,  1 / PHI, 0]) sphere(CORNER_RADIUS);
    translate([ PHI, -1 / PHI, 0]) sphere(CORNER_RADIUS);
    translate([-PHI,  1 / PHI, 0]) sphere(CORNER_RADIUS);
    translate([-PHI, -1 / PHI, 0]) sphere(CORNER_RADIUS);
  }
}

However, when I vectorize it to neaten the code a bit, preview grinds along for 15 seconds before spitting out the exact same thing, functionally:

$fn=50;

PHI = (1 + sqrt(5)) / 2;
CORNER_RADIUS = 0.1;
SCALE = 1;

scale([SCALE, SCALE, SCALE]){
    hull() {
        // Base unit cube vertices
        for (x = [-1,1], y = [-1,1], z = [-1,1]) {
            translate([x,y,z]) sphere(CORNER_RADIUS);
        }
        
        // (0, ±ϕ, ±1/ϕ) vertices
        for (y = [-PHI,PHI], z = [-1/PHI,1/PHI]) {
            translate([0,y,z]) sphere(CORNER_RADIUS);
        }
        
        // (±1/ϕ, 0, ±ϕ) vertices
        for (x = [-1/PHI,1/PHI], z = [-PHI,PHI]) {
            translate([x,0,z]) sphere(CORNER_RADIUS);
        }
        
        // (±ϕ, ±1/ϕ, 0) vertices
        for (x = [-PHI,PHI], y = [-1/PHI,1/PHI]) {
            translate([x,y,0]) sphere(CORNER_RADIUS);
        }
    }
}

Even if it's, IDK, generating a stack of objects to render, it's still only 20, and n^2 is still just four??

Is there some subtlety of loops over vectors I'm missing here? Thanks!

10 Comments
2025/01/23
07:51 UTC

3

Any protip on centering an imported STL in openscad?

Whenever I remix existing STL in openscad, I always spend an annoyingly large amount of time to align shapes by "manual binary search" to find the right magic constants.

Is there are smarter way to do this? Such as auto-find the center of a STL? Or, align a plane to the X axis? Etc?

30 Comments
2025/01/23
04:32 UTC

2

Pushing string of numbers into array

Hi all! Is there a way to push a string of numbers like "20 25 30 35" or "20,25,30,35" and push it into an array of integers like [20,25,30,35]?

Thanks!

13 Comments
2025/01/23
02:21 UTC

2

How to recreate this model in openscad.

Hi, I'm trying to recreate this model in openscad. This model will be generated around a dxf file containing pcb edges.

I have successfully created the bottom rounded square extrusion , But i don't know how to continue further, it is my first time using openscad.

The cones and holes could be placed on anywhere on the model not only in the corners.

Is there any way of doing it?

Thank you

https://preview.redd.it/pvm9anmkdmee1.png?width=892&format=png&auto=webp&s=9e361f7e9c63c7398efffe0cc1e3f5245a4e4377

https://preview.redd.it/52mlivqydmee1.png?width=562&format=png&auto=webp&s=f3a52d5fd053c39694eb2f20372c5a910bf21689

10 Comments
2025/01/22
22:20 UTC

2

BOSL2

While i like the BOSL2 lib a lot, today i run into an issue with the round3d() module.

It takes me two hours to find a work around and write a bugreport on github.

From their i got the information that the issue was because of a hard coded default value. This "size=100" in the picture.

I need to ask myself why i did not just press F12 or right click 'go to definition' that would have save me time and a bug report.

Did not see any hint for this reason on the round3d() documentation but it is in the offset3d() docs.

https://preview.redd.it/k4h1oz94olee1.png?width=1005&format=png&auto=webp&s=107b9f45ae8e0532a18baee13abac5324a212aa8

17 Comments
2025/01/22
19:56 UTC

2

Incorrect VNF rendering after calling vnf_bend() twice

I have incorrect VNF rendering (open faces) and warnings thrown from inside the vnf.scad module.

Also getting a number of warnings:
WARNING: undefined operation (undefined > number) in file ../../../../../../../../Documents/OpenSCAD/libraries/BOSL2/vnf.scad, line 1134

Am I doing something incorrectly?

$fa=4;
$fs=4;

include <BOSL2/std.scad>
include <BOSL2/polyhedra.scad>
include <BOSL2/vnf.scad>

vnf_polyhedron(
vnf_bend( rot([0.0,0.0,90.0], cp=[0, 0, 0], p=move([0,0,-11.5],
vnf_bend( move([0,0,23.005000000000003],
vnf_hull( torus(d_maj=11.0, d_min=5.0))) ,
r=20.505000000000003, axis="Y" ))),
r=9, axis="Y" )
);

3 Comments
2025/01/21
23:21 UTC

1

Any way to rasterize a drawing to a set voxel size?

This is very much an edge use case, but I thought something might exist for it. What I intend to do is convert any drawing into a cubed voxel representation:

rotate([45,0,0]) cylinder(h=1, r=10);
rotate([-45,0,0]) cylinder(h=1, r=10);

Idea is that it would end up looking like this on the right, with cubes oriented the same way:

https://preview.redd.it/a1g1jjh76fee1.jpg?width=1488&format=pjpg&auto=webp&s=14f3adbf46adb314aa94ef0df083973b22212ff9

Any thoughts or suggestions would be appreciated!

Edit: forgot a critical part of what I was hoping to achieve- I'd like to extract the integer locations of the cubes afterwards. Is there an option to do that through a file export of some kind?

5 Comments
2025/01/21
22:03 UTC

1

Introducing P3Cad: A JSCAD-Based Tool for 3D Design with Dev Features, AI Assistant, and 3D Printer Slicing!

Hi everyone!

I’ve been a fan of SCAD-based design. The power of programmatic design has always intrigued me—its precision, repeatability, and ability to create complex designs from code is unmatched. I believe SCAD empowers designers and engineers to think more like developers, giving a unique control over designs.

With this belief in mind, I’ve created a tool called P3Cad to extend the possibilities of SCAD-based workflows. P3Cad builds on the foundation of JSCAD, mostly for web experience, and here’s what it offers:

  • A developer-friendly experience with features like an online editor, autocomplete, and version control.
  • Team collaboration so you can design together in real time.
  • 3D printer slicing, so you can go from design to print faster.
  • Public or Private Designs, so you can share or not.
  • An AI assistant to help generate designs or suggest improvements.

My goal is to make programmatic design more accessible and powerful while staying true to the principles of SCAD.

I’d love for you to try it and share your thoughts as this was just a crazy idea I had and few weekends of work. It's defiantly still beta product but I hope it grow into reliable CAD suit for programmers.

Here’s the link: https://www.p3cad.com/

Whether you use OpenSCAD, JSCAD, or any other tool, I’d love to hear what you think about how we can grow the SCAD ecosystem.

6 Comments
2025/01/21
20:50 UTC

17

New OpenSCAD formatter

Hi all, over the past month, I've been working on my own formatter for OpenSCAD after feeling there was a lack of good formatters out there: https://github.com/tweag/topiary/pull/845

Check it out and let me know what you think. You'll need to install cargo/rustup to get the rust toolchain (for now):

Setup

https://www.rust-lang.org/learn/get-started

Install

cargo install --git https://github.com/mkatychev/topiary topiary-cli --no-default-features --features=openscad

Format

topiary format my_openscad_file.scad

Notes

You can see the before and after inside the pull request linked above to see the stylistic choices and and edge cases covered.

Keep in mind that topiary is in active development so there are some features that are still not covered/implemented such as:

  • alternate configurations (ex: curly braces on separate line)
  • alignment of fields
  • alignment of list elements
8 Comments
2025/01/21
20:40 UTC

0

Can I commission someone here to model something until this friday for a school project??

We just need to model something, doesn't matter what it is. I have too much work to do this week and I need a good grade asap soo pleasaase 😭🙏

8 Comments
2025/01/21
08:40 UTC

1

help with rotating shapes and applying a texture

Hello! I've been following tutorials and learning and could use a hand going to a more complex shape. Take this example from the wiki, a cube with a honey comb pattern.

tex = texture("hex_grid");

linear_sweep(

rect(30,4), texture=tex, xrot=20,h=30,

tex_size=[10,10]

);

I would like to do the following, but I am struggling horribly.

  1. Instead of the rectangle extruding up 30mm (h=30), I would like for it to sweep backward following a 15 degree angle like if the y-axis were angled at -15 degrees (kind of like making more of a 3d rhombus)

  2. I would also like to core out the inside of this making it tub like. In cad I would have created and offset line pattern at like -2mm and then extrude/remove the inside, but i can seem to figure this out in scad

I have burrowed through the wiki and though I am certain the answers are there, at this moment, I can't figure it out. Any guidance would be much appreciated!

3 Comments
2025/01/21
07:01 UTC

2

Need some more help with this design someone else put together.

https://preview.redd.it/gd7lp9tn88ee1.png?width=554&format=png&auto=webp&s=830dc5c9482f8bce73f4966cbe8b6c2ff46d84e5

So I could use some help again with this same script as before. I went and printed these, the issue I'm having is the white part is only a single layer so there's essentially a hole in the back of all the designs. Can someone tell me how to alter this to fill it in with white? Script below:

// Uses Hexagonal Grid Generator by James Evans the mnmlMaker

// https://www.printables.com/model/86604-hexagonal-grid-generator-in-openscad

use <hex-grid.scad>;

// Needs "Mana" font installed to work

// https://github.com/andrewgioia/Mana

card_width = 66;

card_height = 88;

body_width = card_width + 2;

body_height = card_height + 2;

body_thickness = 1.6;

header_width = 59;

header_height = 9;

header_text_size = 7;

mana_combination = 31;

// Mana combinations in the correct order, uses Unicode symbols from "Mana" font.

ALL_MANA_COMBINATIONS = [

"", // W White

"", // U Blue

"", // B Black

"", // BB

"", // RED

"", // G Green

"", // WU Azorius

"", // UB Dimir

"", // BR Rakdos

"", // RG Gruul

"", // GW Selesnya

"", // WB Orzhov

"", // UR Izzet

"", // BG Golgari

"", // RW Boros

"", // GU Simic

"", // WUB Esper

"", // UBR Grixis

"", // BRG Jund

"", // RGW Naya

"", // GWU Bant

"", // WBG Abzan

"", // URW Jeskai

"", // BGU Sultai

"", // RWB Mardu

"", // GUR Temur

"", // WUBR Yore-Tiller

"", // UBRG Glint-Eye

"", // BRGW Dune-Brood

"", // RGWU Ink-Treader

"", // GWUB Witch-Maw

"", // Conflux/Maelstorm/whatever

"", // Colorless

];

top_text = ALL_MANA_COMBINATIONS[mana_combination];

module rounded_box(width, height, thickness) {

hull() {

x_corner = width * 0.5 - thickness;

y_corner = height * 0.5 - thickness;

height = thickness * 2;

translate([-x_corner, -y_corner, 0.0]) {

cylinder(thickness, thickness, thickness, $fn = 24);

};

translate([x_corner, -y_corner, 0.0]) {

cylinder(thickness, thickness, thickness, $fn = 24);

};

translate([x_corner, y_corner, 0.0]) {

cylinder(thickness, thickness, thickness, $fn = 24);

};

translate([-x_corner, y_corner, 0.0]) {

cylinder(thickness, thickness, thickness, $fn = 24);

};

}

}

difference() {

union() {

intersection() {

rounded_box(body_width, body_height, body_thickness);

create_grid(size=[body_width, body_height, body_thickness * 2],

SW = 20.5, wall = 2);

};

translate([0, (body_height + header_height) * 0.5, 0]) {

difference() {

translate([0, -1,0]) {

rounded_box(header_width, header_height + 2, body_thickness);

}

}

};

};

translate([1.075, (body_height + header_height) * 0.5 - 1.15, 0.2]) {

linear_extrude(body_thickness * 2) {

text(top_text , font="Mana", size=header_text_size,

valign="center", halign="center", spacing=1.25);

}

}

};

7 Comments
2025/01/20
22:46 UTC

3

Having difficulty with BOSL2 attachable difference

I'm trying to apply a diff() to a module that I made attachable. With the code below, it doesn't cut out the shape of Chip. In fact it doesn't show the shape at all even with "#" or changing the tag to "keep". However, if I use show_anchors() on the call to Chip() it shows the arrows.

diff(){
	cuboid([21.75,24.5,5.15])
	attach(TOP,TOP,inside=true)
	tag("remove")
	Chip();
}

module Chip(anchor=CENTER,spin=0,orient=UP){
	chip_size=[19.5,22.25,2.9];
	attachable(anchor,spin,orient, size=Expand(chip_size,0.25)) {
		union(){
			diff(){
				cuboid(Expand(chip_size,0.25),anchor=anchor,spin=spin,orient=orient){
					MirrorX(true){
						back(0.72)
						attach(LEFT,LEFT,align=FRONT,inside=true)
						cube([1.15,1.15,chip_size.z+0.25]);
						fwd(6.23)
						attach(LEFT,LEFT,align=BACK,inside=true)				
						cube([1.15,1.15,chip_size.z+0.25]);
					}
				}
			}
		}
		children();
	}
}
2 Comments
2025/01/20
16:02 UTC

4

45° Cut on Round Surface

Hello,

I’m using OpenSCAD for several years now and really happy with that, thanks for the great work on this tool!

Sometimes I still struggle though with things that seems “simple” at first glance. Thought I just ask for one of these cases here now. Perhaps there is a simple solution I just can’t think of myself.

Here is the code used:

$fn = 256;
e = 0.01;
 
height = 40;
radius = 22.5;
 
module sector(radius, angles) {
    r = radius / cos(180 / $fn);
    step = -360 / $fn;
 
    points = concat([[0, 0]],
        [for(a = [angles[0] : step : angles[1] - 360])
            [r * cos(a), r * sin(a)]
        ],
        [[r * cos(angles[1]), r * sin(angles[1])]]
    );
 
    difference() {
        circle(radius);
        polygon(points);
    }
}
 
module arc(radius, angles, width = 1) {
    difference() {
        sector(radius + width, angles);
       
        translate([-e, -e, 0])
            sector(radius, angles);
    }
}
 
difference() {
    translate([-radius, 0, 0])
        linear_extrude(height)
            arc(radius, [-45, 45], 5);
 
    difference() {
        translate([-15.3, 0, height / 2 - 2.5])
            linear_extrude(5)
                arc(21, [-90, 90], 2);
       
        translate([0, -8, 0])
            cube([10, 16, height]);
    }
}

This generates following simple object:

https://preview.redd.it/j6a8mko5dyde1.png?width=369&format=png&auto=webp&s=ea27b0bcb442b3c071282dea7850649ad5985fe5

I would now like to cut on both sides the rounded overhangs at a 45° angle – like illustrated with the red lines here:

https://preview.redd.it/3fbqul67dyde1.png?width=265&format=png&auto=webp&s=19787821d23744b64f926e4d27b4997d5ea34f41

What would be the best/easiest way to accomplish this with OpenCAD?

Best regards and thanks in advance
Andreas

P. S.: I tried to send this question to the OpenSCAD mailing list first, but this seems not to work for some reason.

7 Comments
2025/01/19
13:30 UTC

Back To Top