Feature request: equality constraint between lines and arcs in the Sketcher

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
DeepSOIC
Posts: 4422
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Feature request: equality constraint between lines and arcs in the Sketcher

Postby DeepSOIC » Thu Mar 02, 2017 6:50 pm

I had a master plan on this. It included:
* reference-dimension constraints (thanks to Abdullah, we have them, and I nudged him to the right direction for supporting the next pieces of the plan)
* expression constraint. It is to define an expression using reference dimensions as variables. This can be replaced by a few math constraints, like ratio, sum, maybe something else to avoid messing with expression parsing... but expressions is the preferred way to go.

This should be some massive power. Things like length ratios, belts, angle equality become easily possible. Problem is, I'm not coding it yet :lol: .

I remember someone (I think it was ickby) pointed out there is some expression toolkit in OpenCascade, with support of derivatives. That sounds very promising, but I haven't looked into it yet, and it's unlikely to happen any time soon I'm afraid.

Length constraint is still a necessity, though, and there is no reason for not implementing it now :mrgreen: .
chrili_rakete
Posts: 11
Joined: Thu May 15, 2014 11:51 am

Re: Feature request: equality constraint between lines and arcs in the Sketcher

Postby chrili_rakete » Thu Mar 02, 2017 7:08 pm

DeepSOIC wrote:Length constraint is still a necessity, though, and there is no reason for not implementing it now :mrgreen: .


8-) Thanks!
chrili_rakete
Posts: 11
Joined: Thu May 15, 2014 11:51 am

Re: Feature request: equality constraint between lines and arcs in the Sketcher

Postby chrili_rakete » Thu Mar 02, 2017 8:42 pm

triplus wrote:P.S. I am wondering if expressions could be used in combination with existing constraints. I guess it depends on the use case.


This was the hint! You actually can constrain the length of a line to the length of an arc in the same sketch via the expression:

Code: Select all

Sketch.Shape.Edge1.Length
where Edge1 is the arc in the sketch.

This is what I was looking for, thank you!
triplus
Posts: 4833
Joined: Mon Dec 12, 2011 4:45 pm

Re: Feature request: equality constraint between lines and arcs in the Sketcher

Postby triplus » Thu Mar 02, 2017 8:50 pm

chrili_rakete wrote:This is what I was looking for, thank you!


You're welcome.
eivindkvedalen
Posts: 484
Joined: Tue Jan 29, 2013 10:35 pm

Re: Feature request: equality constraint between lines and arcs in the Sketcher

Postby eivindkvedalen » Sun Mar 05, 2017 3:29 pm

chrili_rakete wrote:This was the hint! You actually can constrain the length of a line to the length of an arc in the same sketch via the expression:

Code: Select all

Sketch.Shape.Edge1.Length
where Edge1 is the arc in the sketch.

This is what I was looking for, thank you!


My gut feeling (as I have not tested this) is that this is not going to be stable, as the geometry is updated after the solver has finished its computations.

(I think you just found a loop-hole in the dependency tracking in freecad's expression system, and I'd consider that a bug...)

Eivind