B-Spline Constraints: Fully Funded! Thanks everybody!

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by abdullah »

chrisb wrote: Sat Jan 21, 2023 9:31 pm Thanks to jnxd! I rate this as another milestone in Sketcher development.
Definitely. This is the most important addition to the sketcher in years.

Please, as one prominent user who helps in the help forum, please let us know if some related issue appears.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by saso »

abdullah wrote: Sat Jan 21, 2023 8:52 pm Point on B-Spline is merged.
Very nice, Thanks! :)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by abdullah »

jnxd wrote: Sat Jan 21, 2023 9:23 pm We need to chart the future course a little.
First at all. Never ever feel "pushed"/compelled to code something you do not want to code. You choose your path.

When I prioritise, I tend to do it from the point of view of users. Where we are delivering the most value. That also has the inherent problem that it is based on my point of view. Here, I am ok if user, power users provide an opinion. At the end, I do not use FC tens of hours per day like they do.
jnxd wrote: Sat Jan 21, 2023 9:23 pm So far, you're suggesting the constraint substitution (which is simple but is also just a long chain of if-else statements)
I think constraint substitution should come first, for the sole reason that line-knot tangency fails to converge with line endpoint to knot coincidence. This is ugly (reflects poorly on the sketcher), and at the same time it is reasonably easy to overcome.

I agree that today constraint substitution is an ugly but effective if-else chain. It might be possible to implement these using a map, so that it is much more elegant. However, that would be a mini-project of its own right.
jnxd wrote: Sat Jan 21, 2023 9:23 pm and angle-via-point (which can evolve from what we're doing so far, but might need us to add more of those dreaded parameters).
Do we need more (dreaded) dependent parameters for AVP?

uh.... somehow I thought we could get away with the one that we have for the PoO...

I really think this would be another milestone. That would allow tangencies and normals to a B-Spline on any point. The user would get a lot of value IMO.
jnxd wrote: Sat Jan 21, 2023 9:23 pm Are their other things?
Nothing obvious to me at this point.
jnxd wrote: Sat Jan 21, 2023 9:23 pm Also in priority is the construction project, which I want to get done by March end. In that preferably we should have control over the nonuniformity of the B-spline, so the knots' parameters can change continuously.
I remember reading about your intention to have knot parameters change continuously. I think that will be challenging (also from the UI point of view, so that it feels natural to a user). I will look into what you produce and will try to be helpful and supportive.

This "construction project". Do you have some full list of requirements?
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by jnxd »

abdullah wrote: Sat Jan 21, 2023 10:07 pm First at all. Never ever feel "pushed"/compelled to code something you do not want to code. You choose your path.

When I prioritise, I tend to do it from the point of view of users. Where we are delivering the most value. That also has the inherent problem that it is based on my point of view. Here, I am ok if user, power users provide an opinion. At the end, I do not use FC tens of hours per day like they do.
At some point we need to "chew the fat" and make sure the stuff being merged is sufficiently polished even if it's nothing particularly new. On the other hand, taking up something new can lead to spreading resources thin. Which is why it's probably best to take some time, breathe, and then prioritize rather than chasing new features or bug reports.

Indeed it's best as power users start giving opinions.
abdullah wrote: Sat Jan 21, 2023 10:07 pm I think constraint substitution should come first, for the sole reason that line-knot tangency fails to converge with line endpoint to knot coincidence. This is ugly (reflects poorly on the sketcher), and at the same time it is reasonably easy to overcome.

I agree that today constraint substitution is an ugly but effective if-else chain. It might be possible to implement these using a map, so that it is much more elegant. However, that would be a mini-project of its own right.
Yes indeed it would be a project to make things elegant here. It's relatively simple so I'll try to get it done this week.
abdullah wrote: Sat Jan 21, 2023 10:07 pm Do we need more (dreaded) dependent parameters for AVP?

uh.... somehow I thought we could get away with the one that we have for the PoO...

I really think this would be another milestone. That would allow tangencies and normals to a B-Spline on any point. The user would get a lot of value IMO.
We might get away with it since we'll also be adding a third point (which I believe was the new thing I added). I need to both revisit the tangent-to-Bspline experiment and look into angle-via-point to make sure.
My latest (or last) project: B-spline Construction Project.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by chrisb »

abdullah wrote: Sat Jan 21, 2023 9:42 pm Please, as one prominent user who helps in the help forum, please let us know if some related issue appears.
Of course, although a test will be a bit artificial, as I don't have a current project where I can use these additions.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by jnxd »

One known issue: for periodic B-splines, dragging point on spline across the "start" point (so from first segment to the last one by looping) does not follow the B-spline. TODO: make report.
My latest (or last) project: B-spline Construction Project.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by ppemawm »

abdullah wrote: Sat Jan 21, 2023 9:42 pm chrisb wrote: ↑Sat Jan 21, 2023 5:31 pm
Thanks to jnxd! I rate this as another milestone in Sketcher development.

Definitely. This is the most important addition to the sketcher in years.
+1 and many thanks!

Here is a quick demo of an application for which I have been waiting: assembly and animation of a roller chain with an arbitrary path.

This is the sketch path of the periodic B-spline that the roller chain is to follow.  The spline is constrained by a single block constraint for this demo.<br /><br />Several line segments representing the links were constrained to the spline with the new point onto object constraint capability.<br /><br />A radial line added with a variable angle constraint is used by the Assembly4 animator to progress the line segments around the path.
This is the sketch path of the periodic B-spline that the roller chain is to follow. The spline is constrained by a single block constraint for this demo.

Several line segments representing the links were constrained to the spline with the new point onto object constraint capability.

A radial line added with a variable angle constraint is used by the Assembly4 animator to progress the line segments around the path.
Screenshot 2023-01-23 122914.jpg (275.21 KiB) Viewed 362140 times
Assembly4 LCS connectors are then added to the Model by an attachment mode Align OZX by selecting a line segment vertex first and then the line segment edge as shown in this image.  If you notice, in the video there is some LCS flipping in certain quadrants so apparently this attachment mode is not the best choice.  I also tried the Z tangent to edge mode with the same disappointing results.  This is a weakness in Sketcher that could use some development priority.<br /><br />Rollers can then be assembled to the path in the Parent Assembly with the Model LCS's and the Body default LCS.<br /><br />The links are assembled to the rollers using their respective default Body LCS.<br /><br />An Assembly4 Variable 'angle' is added for animation purposes.
Assembly4 LCS connectors are then added to the Model by an attachment mode Align OZX by selecting a line segment vertex first and then the line segment edge as shown in this image. If you notice, in the video there is some LCS flipping in certain quadrants so apparently this attachment mode is not the best choice. I also tried the Z tangent to edge mode with the same disappointing results. This is a weakness in Sketcher that could use some development priority.

Rollers can then be assembled to the path in the Parent Assembly with the Model LCS's and the Body default LCS.

The links are assembled to the rollers using their respective default Body LCS.

An Assembly4 Variable 'angle' is added for animation purposes.
Screenshot 2023-01-23 123206.jpg (215.72 KiB) Viewed 362140 times
phpBB [video]

https://www.youtube.com/watch?v=g6Fj-KaFGBs
jnxd wrote: Sun Jan 22, 2023 10:41 pm for periodic B-splines, dragging point on spline across the "start" point (so from first segment to the last one by looping) does not follow the B-spline.
This seems to be working OK at least in this simplified example?

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.31641 (Git)
Build type: Release
Branch: master
Hash: d28d63b87b60161419c6c0c532fbbfaed96926b8
Python 3.10.8, Qt 5.15.6, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly4 0.12.4
  * fasteners 0.4.15
  * freecad.gears 1.0.0
  * QuickMeasure 2022.10.28
  * Render 2022.2.0
Attachments
Animate_RollerChain2.FCStd
(37.26 KiB) Downloaded 77 times
"It is a poor workman who blames his tools..." ;)
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by jnxd »

Thanks @ppemawm for the the speed with which this was made. Do you mind if I share this on Mastodon/Twitter?
ppemawm wrote: Tue Jan 24, 2023 5:54 pm
jnxd wrote: Sun Jan 22, 2023 10:41 pm for periodic B-splines, dragging point on spline across the "start" point (so from first segment to the last one by looping) does not follow the B-spline.
This seems to be working OK at least in this simplified example?
The example is not that simple: each segment of the Bspline extrapolates differently. What I believe might be happening is that recompute is called more often.
My latest (or last) project: B-spline Construction Project.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by ppemawm »

jnxd wrote: Tue Jan 24, 2023 8:00 pm Do you mind if I share this on Mastodon/Twitter?
Yes, of course.
"It is a poor workman who blames his tools..." ;)
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: B-Spline Constraints: Fully Funded! Thanks everybody!

Post by chrisb »

I could use the new function on a user's file (https://forum.freecadweb.org/viewtopic. ... 29#p655829).

I found the following issue. To reproduce:
- edit Sketch010
- select the point and the B-spline as shown in the image (at the third line from the bottom):
SnipScreenshot-a03ee3.png
SnipScreenshot-a03ee3.png (8.81 KiB) Viewed 362001 times
- apply point on object

-> The B-spline becomes a (nearly) straight line, and the solver reports a partially redundant constraint.

Notes:
- There is already a point-on-object constraint on the spline. It worked like a charm!
- By moving the intermediate control point up and down the spline moves smoothely from left of the point to right of it. So it should be possible to move it right on the point.

@jnxd, @abdullah, do you want the issue reports here or do you want to have tickets?
Attachments
pointOnBSpline.FCStd
(10.06 KiB) Downloaded 69 times
SnipScreenshot-f0db72.png
SnipScreenshot-f0db72.png (11.98 KiB) Viewed 362001 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply