Skip to content

Commit

Permalink
Merge pull request #4633 from nortikin/fix_4469
Browse files Browse the repository at this point in the history
1) call cut_segment from curve_segment; 2) fix u_bounds for FreeCAD curves
  • Loading branch information
portnov authored Sep 11, 2022
2 parents d762226 + ad175dc commit 492c836
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion utils/curve/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,9 @@ def split_curve(curve, splits, rescale=False):

def curve_segment(curve, new_t_min, new_t_max, rescale=False):
t_min, t_max = curve.get_u_bounds()
if hasattr(curve, 'split_at') and (new_t_min > t_min or new_t_max < t_max):
if hasattr(curve, 'cut_segment'):
return curve.cut_segment(new_t_min, new_t_max, rescale=rescale)
elif hasattr(curve, 'split_at') and (new_t_min > t_min or new_t_max < t_max):
if new_t_min > t_min:
start, curve = curve.split_at(new_t_min)
if new_t_max < t_max:
Expand Down
2 changes: 1 addition & 1 deletion utils/curve/freecad.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def derivatives_array(self, n, ts, tangent_delta=None):

def get_u_bounds(self):
if self.u_bounds is None:
return (self.curve.FirstParameter, self.curve.LastParameter)
return (self.curve.KnotSequence[0], self.curve.KnotSequence[-1])
else:
return self.u_bounds

Expand Down

0 comments on commit 492c836

Please sign in to comment.