Skip to content

Commit

Permalink
1) call cut_segment from curve_segment; 2) fix u_bounds for FreeCAD c…
Browse files Browse the repository at this point in the history
…urves.

refs #4469.
  • Loading branch information
portnov committed Aug 30, 2022
1 parent c247fa5 commit ad175dc
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 ad175dc

Please sign in to comment.