discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BelfrySCAD

RV
Roel Vanhout
Sat, Oct 24, 2026 2:38 PM

On Fri, Oct 23, 2026 at 7:51 PM Revar Desmera via Discuss
discuss@lists.openscad.org wrote:

While the WYSIWYG editing idea was one of the reasons I started writing BelfrySCAD, it is also one of the least well developed features so far. Mostly because figuring out how the code should be handled is somewhat complicated. You can move, scale, or rotate objects you select, but there is currently no support for doing anything with edges or corners of objects.
If would have ideas on how this interface can be improved, please file a feature request at https://github.com/BelfrySCAD/BelfrySCAD/issues

A few years ago I was interviewed for the PhD research of Johann
Felipe Gonzalez, on exactly this topic. Some of that work has been
ported back into OpenSCAD but it seems that that was mostly
foundational work and the real 'meat' didn't make it (yet?). This is
in PRs 5279 and and #5778. I'm hoping this gains some traction again,
what I worked with when I was interviewed was amazing.

I am also very much interested in such functionality, I have a few
ideas for OpenSCAD that I have implemented like inserting a
'component' at a specific location. So, say, you select a corner of a
cube; then you press shift-A; that opens a menu that lets you select
'parts' which I currently derive from BOSL2 and BOLTS, but there could
be any library of 'parts'; these could be real 'objects' like a washer
or a screw but also negative parts like a screw hole or chamfer. You
can then select a component and it adds the module call in the 'right'
location in the source, and it shows a non-modal dialog where you can
change the parameters. Of course, what is the 'right' location depends
on what you're trying to do so it needs to be easy to change in the
editor as well. There are many problems to be solved before this
becomes a robust feature, some very obvious like how do you deal with
external editors and non-saved state. But so far, there are several
ways to make OpenSCAD more interactive while still making it suitable
for a real code-first workflow that are unexplored. I also have an
'annotation' system that lets you mark parts as modules and
assemblies, for interactively (in the viewport) configuring (exploded)
assemblies. That is something that requires language extensions, of
course.

cheers

Roel

On Fri, Oct 23, 2026 at 7:51 PM Revar Desmera via Discuss <discuss@lists.openscad.org> wrote: > While the WYSIWYG editing idea was one of the reasons I started writing BelfrySCAD, it is also one of the least well developed features so far. Mostly because figuring out how the code should be handled is somewhat complicated. You can move, scale, or rotate objects you select, but there is currently no support for doing anything with edges or corners of objects. > If would have ideas on how this interface can be improved, please file a feature request at https://github.com/BelfrySCAD/BelfrySCAD/issues A few years ago I was interviewed for the PhD research of Johann Felipe Gonzalez, on exactly this topic. Some of that work has been ported back into OpenSCAD but it seems that that was mostly foundational work and the real 'meat' didn't make it (yet?). This is in PRs 5279 and and #5778. I'm hoping this gains some traction again, what I worked with when I was interviewed was amazing. I am also very much interested in such functionality, I have a few ideas for OpenSCAD that I have implemented like inserting a 'component' at a specific location. So, say, you select a corner of a cube; then you press shift-A; that opens a menu that lets you select 'parts' which I currently derive from BOSL2 and BOLTS, but there could be any library of 'parts'; these could be real 'objects' like a washer or a screw but also negative parts like a screw hole or chamfer. You can then select a component and it adds the module call in the 'right' location in the source, and it shows a non-modal dialog where you can change the parameters. Of course, what is the 'right' location depends on what you're trying to do so it needs to be easy to change in the editor as well. There are many problems to be solved before this becomes a robust feature, some very obvious like how do you deal with external editors and non-saved state. But so far, there are several ways to make OpenSCAD more interactive while still making it suitable for a real code-first workflow that are unexplored. I also have an 'annotation' system that lets you mark parts as modules and assemblies, for interactively (in the viewport) configuring (exploded) assemblies. That is something that requires language extensions, of course. cheers Roel
TA
Todd Allen
Sat, Oct 24, 2026 5:03 PM

You never cease to amaze me.  Yes, when I tossed this idea out with rather
minimal thought I was thinking in terms of BOSL2 style scripted CAD where
there are powerful features such as path_sweep() and skin() versus
implementing this for use with module based CAD.  My other half baked
thought of why constraint based 2D sketching would be desirable is that I
could then create sketches that transform exactly as desired in response to
changing one or more parameters such as the size or spacing between holes.
From there I'd expect it would be a small step to use these sketches with
path_sweep() and skin() and a function driving parameter changes of the
constrained sketch to create a new class of 3d models that I'd be hesitant
to attempt to make now.  I think WYSIWYG works well for developing
constraint based sketches as it facilitates a sort of trial and error learn
as you go approach to see how multiple constraints interact to produce the
desire response to changing inputs.

On Sat, Oct 24, 2026 at 4:32 AM Revar Desmera via Discuss <
discuss@lists.openscad.org> wrote:

Okay, it looks like it is possible to make a pure user-space OpenSCAD
constraints system.  Not sure how fast it'd be.
It'd look something like this:

res = constraint_solve(
object(  // Initial guesses
cp=[4,3],  // center point of circle
r=2,      // radius of circle
a=[0,0],  // Point A of triangle
b=[1,0],  // Point B of triangle
c=[0,1]    // Point C of triangle
),
function(o) [  // Constraints
// A.y == B.y
constraint_horizontal(o.a, o.b),
// norm(A-B) == 20
constraint_length(o.a, o.b, 20),
// norm(C-midpt(B,C)) == 15
constraint_length(o.c, (o.a+o.b)/2, 15),
// norm(A-C) == norm(B-C)
constraint_equal_length(o.a, o.c, o.b, o.c),
// Circle is tangent to AB
constraint_circle_tangent_to_line(o.cp, o.r, o.a, o.b),
// Circle is tangent to AC
constraint_circle_tangent_to_line(o.cp, o.r, o.a, o.c),
// Circle is tangent to BC
constraint_circle_tangent_to_line(o.cp, o.r, o.b, o.c),
// Circle is centered at [0,1]
constraint_coincident(o.cp, [0,1])
]
);

draw_line(res.a, res.b);
draw_line(res.b, res.c);
draw_line(res.c, res.a);
translate(rec.cp) circle(r=rec.r);

Kind of ugly, and unnecessarily verbose.  I have got all the functions
undefined above written out, but it's a few hundred lines long.

Honestly, I don't really know how often I'd want to go to all the trouble
of formalizing constraints like this.

  • Revar

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You never cease to amaze me. Yes, when I tossed this idea out with rather minimal thought I was thinking in terms of BOSL2 style scripted CAD where there are powerful features such as path_sweep() and skin() versus implementing this for use with module based CAD. My other half baked thought of why constraint based 2D sketching would be desirable is that I could then create sketches that transform exactly as desired in response to changing one or more parameters such as the size or spacing between holes. From there I'd expect it would be a small step to use these sketches with path_sweep() and skin() and a function driving parameter changes of the constrained sketch to create a new class of 3d models that I'd be hesitant to attempt to make now. I think WYSIWYG works well for developing constraint based sketches as it facilitates a sort of trial and error learn as you go approach to see how multiple constraints interact to produce the desire response to changing inputs. On Sat, Oct 24, 2026 at 4:32 AM Revar Desmera via Discuss < discuss@lists.openscad.org> wrote: > Okay, it looks like it *is* possible to make a pure user-space OpenSCAD > constraints system. Not sure how fast it'd be. > It'd look something like this: > > res = constraint_solve( > object( // Initial guesses > cp=[4,3], // center point of circle > r=2, // radius of circle > a=[0,0], // Point A of triangle > b=[1,0], // Point B of triangle > c=[0,1] // Point C of triangle > ), > function(o) [ // Constraints > // A.y == B.y > constraint_horizontal(o.a, o.b), > // norm(A-B) == 20 > constraint_length(o.a, o.b, 20), > // norm(C-midpt(B,C)) == 15 > constraint_length(o.c, (o.a+o.b)/2, 15), > // norm(A-C) == norm(B-C) > constraint_equal_length(o.a, o.c, o.b, o.c), > // Circle is tangent to AB > constraint_circle_tangent_to_line(o.cp, o.r, o.a, o.b), > // Circle is tangent to AC > constraint_circle_tangent_to_line(o.cp, o.r, o.a, o.c), > // Circle is tangent to BC > constraint_circle_tangent_to_line(o.cp, o.r, o.b, o.c), > // Circle is centered at [0,1] > constraint_coincident(o.cp, [0,1]) > ] > ); > > draw_line(res.a, res.b); > draw_line(res.b, res.c); > draw_line(res.c, res.a); > translate(rec.cp) circle(r=rec.r); > > > > Kind of ugly, and unnecessarily verbose. I *have* got all the functions > undefined above written out, but it's a few hundred lines long. > > Honestly, I don't really know how often I'd want to go to all the trouble > of formalizing constraints like this. > > - Revar > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
GS
Guenther Sohler
Sat, Oct 24, 2026 7:12 PM

Hi Revar,

That “how should the code be handled” part was exactly what I struggled
with too. I’ve been working on this for PythonSCAD lately, so in case some
of it is useful for BelfrySCAD, here’s what ended up working for me:

1. Let the user opt in per value. Only numbers the user marks are
editable, written as "10" or marked(10). That avoids guessing which literal
to change and keeps computed values untouched. Usually you mark the
variable definition at the top (ARM1 = "130"), and the drag updates that
definition.

2. Let the node decide, not the GUI. Every node type has a virtual
dragPoint(). A cube knows that its far corner maps to size[i]. A cylinder
knows that the top ring means r2 and the top face means h. A polyhedron
knows that vertex i is points[i]. Transforms pass the drag down to their
children in local coordinates, and the innermost draggable node wins.
That’s how corners and edges work, not just whole objects.

3. Constrain the motion, don’t use the screen plane. I pass the mouse
ray down the tree. Each parameter intersects it with the line, plane or
circle along which the grabbed point can actually move. For rotate this is
the circle around the axis, with the angle measured absolutely from the
zero position, so nothing drifts and you can drag past 180°.

4. Patch the source as text, but know where to look. Each node remembers
the script line it was created on. The patcher goes to that call, finds the
argument (named or positional, nested lists, method or function form),
follows plain variables back to their assignment, and only touches the
marked number. All changes from one drag are applied in a single pass,
rounded to a grid.

It’s still text-based, so values from loops or function arguments can’t be
written back. In practice that covers a lot, though. Here’s a short video
with a little desk lamp:

https://www.youtube.com/watch?v=rNgcj9Xju3U
Check out
https://www.reddit.com/r/OpenPythonSCAD/comments/1xeguhu/coming_soon_to_pythonscad_drag_your_model_and/

Happy to compare notes if you want to go a similar way in BelfrySCAD.

On Sat, Oct 24, 2026 at 4:39 PM Roel Vanhout via Discuss <
discuss@lists.openscad.org> wrote:

On Fri, Oct 23, 2026 at 7:51 PM Revar Desmera via Discuss
discuss@lists.openscad.org wrote:

While the WYSIWYG editing idea was one of the reasons I started writing

BelfrySCAD, it is also one of the least well developed features so far.
Mostly because figuring out how the code should be handled is somewhat
complicated. You can move, scale, or rotate objects you select, but there
is currently no support for doing anything with edges or corners of objects.

If would have ideas on how this interface can be improved, please file a

feature request at https://github.com/BelfrySCAD/BelfrySCAD/issues

A few years ago I was interviewed for the PhD research of Johann
Felipe Gonzalez, on exactly this topic. Some of that work has been
ported back into OpenSCAD but it seems that that was mostly
foundational work and the real 'meat' didn't make it (yet?). This is
in PRs 5279 and and #5778. I'm hoping this gains some traction again,
what I worked with when I was interviewed was amazing.

I am also very much interested in such functionality, I have a few
ideas for OpenSCAD that I have implemented like inserting a
'component' at a specific location. So, say, you select a corner of a
cube; then you press shift-A; that opens a menu that lets you select
'parts' which I currently derive from BOSL2 and BOLTS, but there could
be any library of 'parts'; these could be real 'objects' like a washer
or a screw but also negative parts like a screw hole or chamfer. You
can then select a component and it adds the module call in the 'right'
location in the source, and it shows a non-modal dialog where you can
change the parameters. Of course, what is the 'right' location depends
on what you're trying to do so it needs to be easy to change in the
editor as well. There are many problems to be solved before this
becomes a robust feature, some very obvious like how do you deal with
external editors and non-saved state. But so far, there are several
ways to make OpenSCAD more interactive while still making it suitable
for a real code-first workflow that are unexplored. I also have an
'annotation' system that lets you mark parts as modules and
assemblies, for interactively (in the viewport) configuring (exploded)
assemblies. That is something that requires language extensions, of
course.

cheers

Roel


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hi Revar, That “how should the code be handled” part was exactly what I struggled with too. I’ve been working on this for PythonSCAD lately, so in case some of it is useful for BelfrySCAD, here’s what ended up working for me: *1. Let the user opt in per value.* Only numbers the user marks are editable, written as "10" or marked(10). That avoids guessing which literal to change and keeps computed values untouched. Usually you mark the variable definition at the top (ARM1 = "130"), and the drag updates that definition. *2. Let the node decide, not the GUI.* Every node type has a virtual dragPoint(). A cube knows that its far corner maps to size[i]. A cylinder knows that the top ring means r2 and the top face means h. A polyhedron knows that vertex *i* is points[i]. Transforms pass the drag down to their children in local coordinates, and the innermost draggable node wins. That’s how corners and edges work, not just whole objects. *3. Constrain the motion, don’t use the screen plane.* I pass the mouse *ray* down the tree. Each parameter intersects it with the line, plane or circle along which the grabbed point can actually move. For rotate this is the circle around the axis, with the angle measured absolutely from the zero position, so nothing drifts and you can drag past 180°. *4. Patch the source as text, but know where to look.* Each node remembers the script line it was created on. The patcher goes to that call, finds the argument (named or positional, nested lists, method or function form), follows plain variables back to their assignment, and only touches the marked number. All changes from one drag are applied in a single pass, rounded to a grid. It’s still text-based, so values from loops or function arguments can’t be written back. In practice that covers a lot, though. Here’s a short video with a little desk lamp: https://www.youtube.com/watch?v=rNgcj9Xju3U Check out https://www.reddit.com/r/OpenPythonSCAD/comments/1xeguhu/coming_soon_to_pythonscad_drag_your_model_and/ Happy to compare notes if you want to go a similar way in BelfrySCAD. On Sat, Oct 24, 2026 at 4:39 PM Roel Vanhout via Discuss < discuss@lists.openscad.org> wrote: > On Fri, Oct 23, 2026 at 7:51 PM Revar Desmera via Discuss > <discuss@lists.openscad.org> wrote: > > While the WYSIWYG editing idea was one of the reasons I started writing > BelfrySCAD, it is also one of the least well developed features so far. > Mostly because figuring out how the code should be handled is somewhat > complicated. You can move, scale, or rotate objects you select, but there > is currently no support for doing anything with edges or corners of objects. > > If would have ideas on how this interface can be improved, please file a > feature request at https://github.com/BelfrySCAD/BelfrySCAD/issues > > A few years ago I was interviewed for the PhD research of Johann > Felipe Gonzalez, on exactly this topic. Some of that work has been > ported back into OpenSCAD but it seems that that was mostly > foundational work and the real 'meat' didn't make it (yet?). This is > in PRs 5279 and and #5778. I'm hoping this gains some traction again, > what I worked with when I was interviewed was amazing. > > I am also very much interested in such functionality, I have a few > ideas for OpenSCAD that I have implemented like inserting a > 'component' at a specific location. So, say, you select a corner of a > cube; then you press shift-A; that opens a menu that lets you select > 'parts' which I currently derive from BOSL2 and BOLTS, but there could > be any library of 'parts'; these could be real 'objects' like a washer > or a screw but also negative parts like a screw hole or chamfer. You > can then select a component and it adds the module call in the 'right' > location in the source, and it shows a non-modal dialog where you can > change the parameters. Of course, what is the 'right' location depends > on what you're trying to do so it needs to be easy to change in the > editor as well. There are many problems to be solved before this > becomes a robust feature, some very obvious like how do you deal with > external editors and non-saved state. But so far, there are several > ways to make OpenSCAD more interactive while still making it suitable > for a real code-first workflow that are unexplored. I also have an > 'annotation' system that lets you mark parts as modules and > assemblies, for interactively (in the viewport) configuring (exploded) > assemblies. That is something that requires language extensions, of > course. > > cheers > > Roel > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org