Sketcher angle constraint feature request

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Sketcher angle constraint feature request

Post by Joel_graff »

It would be helpful to have an equal-angle constraint, which ensures the angle between one pair of lines is equal to the angle between another pair.

The easiest way to implement it would simply be to create a reference constraint between one pair, and use it in an expression to create a locking constraint between the other pair. But, of course, that functionality was removed a version or two back, it seems.

Otherwise, it's complicated by two key issues:

1. Four lines have to be selected which form coincidentally-constrained pairs (point-to-point or point-to-object).

2. Control over the constraint must be provided to ensure the correct angles are being matched (i.e., determine which side of the line the angle is applied). This is an issue only if the controlling angle is on a pair of lines which have point-object coincidence (not point-to-point). Otherwise, defaulting to the inside angle where the line endpoints are coincident is probably the best way to go.

That actually leads me to another feature request. :)

There should be a way, when constraining two lines that intersect each other, which angle should be considered constraining. To that end, I would suggest the following:

1. User selects the lines which are to be constrained
2. User selects the angle constraint
3. User may then:
a. right-click - the angle constraint does what it currently does with no change
b. left click on two end points (one on each line) to determine the angle which is constrained, and the constraint is applied
c. mouse over the two lines and have the UI highlight the angle in the quadrant where the mouse lies. User left-clicks once to apply the constraint to the highlighted angle.

Sorry for the length / complexity of the post (with no pictures). I can try to provide a more visual and detailed explanation of what I'm thinking (in a separate post) , assuming this isn't something that's already been addressed.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
dbecad
Posts: 80
Joined: Fri Mar 16, 2018 11:10 pm

Re: Sketcher angle constraint feature request

Post by dbecad »

Regarding the second point the description looks much more complex than the usage, if you are thinking about a fusion like angle choice then this has a great usability.
angle.gif
angle.gif (486.98 KiB) Viewed 1394 times
Cheers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Sketcher angle constraint feature request

Post by Joel_graff »

dbecad wrote: Mon Apr 30, 2018 12:34 am Regarding the second point the description looks much more complex than the usage, if you are thinking about a fusion like angle choice then this has a great usability.
That's exactly what I'm after. Without something to reference, I had to invent something that seemed reasonable.

If what you show can be done in FreeCAD, I like that a lot. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
paddle
Veteran
Posts: 1413
Joined: Mon Feb 03, 2020 4:47 pm

Re: Sketcher angle constraint feature request

Post by paddle »

With sketcher_dimension, the above gif is now possible. Now the question is, is there a way to ask for the small angle or the big angle in the command?

Code: Select all

  Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Angle',%d,%d,%d,%d,%f)) ",
  GeoId1, static_cast<int>(PosId1), GeoId2, static_cast<int>(PosId2), ActAngle);
I tried playing with the command arguments but the resulting angle does not seem to depend on that. It seems to mostly depend on the lines initial directions. @abdullah do you have any input on that ? Do you know where it is determined which angle is going to be used ?

Edit: Well actually I found a way to get one or the other angle :

Code: Select all

    App.getDocument('part3').getObject('Sketch').addConstraint(Sketcher.Constraint('Angle', 0, 1, 1, 2, 2.0))
    App.getDocument('part3').getObject('Sketch').addConstraint(Sketcher.Constraint('Angle', 0, 2, 1, 1, 2.0))
    App.getDocument('part3').getObject('Sketch').addConstraint(Sketcher.Constraint('Angle', 1, 1, 0, 1, 1.14))
    App.getDocument('part3').getObject('Sketch').addConstraint(Sketcher.Constraint('Angle', 1, 2, 0, 2, 1.14))
So if you swap the geoId, and reverse one posId it seems to change of angle.

Github issue : https://github.com/FreeCAD/FreeCAD/issues/10603
Other related topic: viewtopic.php?t=62205&start=20
User avatar
paddle
Veteran
Posts: 1413
Joined: Mon Feb 03, 2020 4:47 pm

Re: Sketcher angle constraint feature request

Post by paddle »

Post Reply