carlopav wrote: ↑Wed Apr 03, 2019 5:58 am
Exactly:
the draft bezier creation tool works with these arguments:
Code: Select all
Draft.makeBezCurve(pointslist,closed=False,placement=None,face=None,support=None,Degree=None):
but the Drafttools.bezCurve just give him this:
Code: Select all
Draft.makeBezCurve(points,closed='+str(closed)+',support='+sup+')
OK, I think I understand now.
Draft.makeBezCurve() in
Draft.py is the low level code that creates a Bezier curve by calling the even more primitive
Part.BezierCurve() function.
Then, the class
BezCurve in
DraftTools.py is the higher level code (user interface, button) that calls
Draft.makeBezCurve().
without the Degree, Draft just create a single bezier segment, aumenting the degree with every node added. And i think this is not good and counterintuitive.
I also found this behavior a bit strange at the beginning, but actually... I think it's not that bad. I don't have a lot of experience using Bezier curves, but I think in most cases a user will use a curve to smooth or round a corner made of two other straight lines. In this case, what the user wants is to produce a smooth curve by clicking many intermediate points. So the more he or she clicks, the smoother the curve gets because the degree becomes larger. This is similar to how
Draft BSpline works.
The degree of the Bezier is one less than the number of points, so if the user clicks 5 times, he or she will get a curve of degree 4, which is two end points and three intermediate points. I think in most cases, the user would not need degrees larger than 4, which is why quadratic (2nd degree, 3 points) and cubic (3rd degree, 4 points) Beziers are so popular in most drawing programs.
In this picture, from top to bottom, the two lines are tied with Beziers of degrees 4 (quartic), 3 (cubic) and 2 (quadratic).

- Draft_BezCurve_smooth.png (10.55 KiB) Viewed 990 times
Instead the user should set the curve degree before starting the creation and it should remain fixed for the whole curve.
I also find this comment on the code:
# not quite right. draws 1 big bez. sb segmented
Do you agree?
I do think that having an option in the Task panel (
DraftGui.py) to lock the degree of the Bezier would be good, as it gives more possibilities to the user. But how would the user use the tool, just a start point and end point? It would need two points?
If the order is three, and I put two points, the code would have to automatically create the two intermediate control points at an arbitrary location without regards for my preferred curvature. Then I would have to go back into edit mode to modify the control points to suit my needs. If the tool stays as it is now, I can more or less direct the curvature of the Bezier by how I place the points along a path.
What I wouldn't like is to click many times on the 3D view, and that it creates multiple curves; that would be surprising. A single use of the tool should create a single object, not multiple objects. For example, if I use the
Draft Wire, I want to get a single wire object, not many individual line objects; that'd just get messy in the tree view, you'd end with many, many objects in a short time.
Now, Draft already has a "continuation mode" to create multiple objects, one after the other. You activate this mode by pressing T in the keyboard (or checking the "continue" checkbox) after you enter the Task panel. That means that when you finish one object, it immediately starts creating a new object from the last point selected. So, basically, a
Draft Wire is the same as a
Draft Line with continuation mode on. It just creates line segments one after the other.
In your case, it would be like choosing (locking) the degree of the curve to 3, using continuation mode, then clicking two points; after the second point it would start creating a second curve, also of 3rd degree, and so on.
I think locking the degree of the curve is fine (with a checkbox and spinbox to choose the degree), but not breaking a high order curve into many objects, if the user doesn't want to.