pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

free(): invalid pointer

Open sfornengo opened this issue 2 years ago • 2 comments

Here is the code:

from OCC.Core.gp import gp_Pnt
from OCC.Core.GeomAPI import GeomAPI_PointsToBSpline
from OCC.Core.TColgp import TColgp_Array1OfPnt
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
from OCC.Core.BRepAdaptor import BRepAdaptor_Curve

# the bspline
array = TColgp_Array1OfPnt(1, 5)
array.SetValue(1, gp_Pnt(0,0,1))
array.SetValue(2, gp_Pnt(0,0,2))
array.SetValue(3, gp_Pnt(0,0,3))
array.SetValue(4, gp_Pnt(0,0,4))
array.SetValue(5, gp_Pnt(0,0,5))
bspline = GeomAPI_PointsToBSpline(array).Curve()
instance = BRepBuilderAPI_MakeEdge(bspline).Edge()

adap=BRepAdaptor_Curve(instance)
crv = adap.Curve()

free(): invalid pointer Aborted (core dumped)

sfornengo avatar Feb 12 '23 21:02 sfornengo

@sfornengo points lie on a straight line, you can't use a BSpline to interpolate those points

tpaviot avatar Feb 13 '23 10:02 tpaviot

Ok thanks, those points was manually taken for isolating the bug in a reduced code, sorry for the alignment. But points not lying on a straight line lead to the same error too.

sfornengo avatar Feb 13 '23 14:02 sfornengo

Fixed by PR #1334

tpaviot avatar May 23 '24 09:05 tpaviot