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

`math_Vector.Set` have `TypeError`

Open tnakaicode opened this issue 7 months ago • 0 comments

Description:

The math_Vector.Set method throws a TypeError when attempting to set values in Python. The error message indicates that the wrong number or type of arguments is being passed to the method. This issue occurs even when the arguments appear to match the expected usage based on the C++ prototypes provided in the error message.

Environment:

  • Library: pythonocc-core
  • Version: 7.8.0
  • Platform: Windows
  • Python Version: 3.11.9

Sample Code:

from OCC.Core.math import math_Vector

# Initialize a math_Vector with a valid range
nb_variables = 3
starting_point = math_Vector(1, nb_variables, 1)

# Attempt to set values
starting_point.Set(1, 1.0)
# TypeError: Wrong number or type of arguments for overloaded function 'math_Vector_Set'.
#   Possible C/C++ prototypes are:
#     math_VectorBase< double >::Set(Standard_Integer const,Standard_Integer const,math_VectorBase< double > const &)
#     math_VectorBase< double >::operator =(math_VectorBase< double > const &)

starting_point.Set(1, 1, math_Vector(1, 1, 0))  # succese
starting_point.Set(1, 2, math_Vector(1, 1, 0)) 
# RuntimeError: Standard_RangeErrormath_VectorBase::Set() - invalid indices raised from method Set of class math_VectorBase< double >

tnakaicode avatar Apr 21 '25 02:04 tnakaicode