[Sketcher] allow equality constraint between arc and line

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Workshop_Notes
Posts: 591
Joined: Wed Sep 29, 2021 8:35 am

[Sketcher] allow equality constraint between arc and line

Post by Workshop_Notes »

Frequently, in stuff I sketch, I would like a line to be the same length as the radius of an arc.

I know how to do this with expressions. I also know how to make the line equal to the arc's length, again using expressions.

I am wondering if the equality constraint could be extended (overloaded/coerced) to automate this process.

I think it might be possible by putting a macro behind the button so to speak.

In the simplest unidirectional case, if the entities selected are the same type (two lines or two arcs), the macro itself does nothing and sets equality as current behaviour. It would thus be transparent when using equality in the standard way.

If the two entities are different types (one arc, one line), the macro kicks in, a radio button box pops up to ask if I want line length and arc radius equality or line length and arc length equality. The macro will then add an appropriate expression-driven length constraint to the line and exit in a way that bypasses the 'normal' equality constraint (because the equality constraint does not accept different entity types).

There are a couple of opportunities for feature enhancement on this basic idea: have the toolbar button drop down in the same way as the radius/diameter constraint and make it work bidirectionality (either the line or the arc has a length-determining constraint on it, the macro to set the missing one).

The issue has been discussed before, in 2017. Would it be correct to say that we are in the position of knowing how to achieve the goal manually but have not yet automated it?

viewtopic.php?t=20240

Thanks for reading.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: [Sketcher] allow equality constraint between arc and line

Post by chrisb »

Workshop_Notes wrote: Sun Apr 30, 2023 8:00 am Would it be correct to say that we are in the position of knowing how to achieve the goal manually but have not yet automated it?
There are two aspects: 1) Giving a length to an arc. This can be done manually via an expression, and hasn't been automated yet. 2) Equality of arc length or arc/linie. This can be done manually unidirectional, i.e. making an arc depend on the length of an arc or a line by an expression (or vice versa). But it is not possible to relate them truly to each other like equality normally does.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply