[BUG] limitation of the Beizer curve creation in geom max N of vertex hard coded

Hello,
I think there is a bug/hard coded maximum value for the number of vertexes used in a MakeBezier function. which is 27 (including the initial and last point). PLEASE could this be addressed in next version of Salome? it should remove the hard coded value. to test this easily:

#!/usr/bin/env python
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'/home/franco/Desktop')
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
for i in range(1,50):
  vertexes=[geompy.MakeVertex(j, 0, 0) for j in range(1+i)]
  Curve_1 = geompy.MakeBezier(vertexes, False)
  geompy.addToStudy( Curve_1, 'Curve '+str(i+1)+' points' )

the MakeBezier function will fail when the len(vertexes)==27 (or more). this is completely limiting my application and is a simple hardcoded value.
please if the developers could address this it would be super appreciated.
thanks in advance.

Hi Franco,
this limit is actually hard-coded in OCCT and not in SALOME.
You would need to change it there and recompile it for SALOME.

The MaxDegree value is defined in BSplCLib.lxx (Line 28) and used in the constructor of Geom_BezierCurve (Line 71).
There is also another hard-coded value in BSplCLib.cxx (Line 4370 ff) related to the MaxDegree of a BezierCurve.

1 Like

I changed all hard-coded values in the BSplCLib in OCCT to 50 and was able to run your script successfully, but the maximum number of points for a Bezier curve is still limited and hard-coded!!

1 Like

Hello Bernhard,
thanks for your answer and the explanation, I will not go that route as I am developing a code that the idea is that the user can use it out of the box from salome, therefore re compiling part of the OCCT would be too much to ask to them. what I did was to order the points in a list where the poles are ordered and re sample them so I only use 26 points with the largest and equal separation between points. this proved to be a good compromise.