ansys/pymotorcad

Bug when setting parallel paths variable and corresponding winding pattern

itsToggle opened this issue ยท 1 comments

๐Ÿ” Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

๐Ÿž Description of the bug

When changing the parallel paths variable (ParallelPaths) of a custom winding and then trying to set the appropriate winding pattern, Im getting the error:
SetWindingCoil failed - Path index too high. Check number of paths.

What Ive already tried:

  • Appropriately updating the undocumented CoilsPerPath_Array variable before trying to set information on the new path does not have an effect on the outcome either
  • Trying to run "create_winding_pattern()" before attempting to set information on the new path changes the error to a similar error: RPC Communication Error: Range check error without further information.
  • Its definitely possible to create a second path in the models im working with through the MotorCAD GUI.

๐Ÿ“ Steps to reproduce

# Open a model with a custom winding pattern and ParallelPaths == 1
# Increse the paths to 2
mcad.set_variable('ParallelPaths', 2)

# optionally update the CoilsPerPath_Array variable or run "create_winding_pattern()"

# Try to set some property on the second path
mcad.set_winding_coil(1, 2, 1, 19, 'C', 28, 'C', 53)

# Will throw the error: SetWindingCoil failed - Path index too high. Check number of paths.

๐Ÿ’ป Which operating system are you using?

Windows

๐Ÿ“€ Which ANSYS version are you using?

2024.1.2

๐Ÿ Which Python version are you using?

3.11

๐Ÿ“ฆ Installed packages

not of interest

Okay it seems the bug can be circumvented when performing these steps:

# Open a model with a custom winding pattern and ParallelPaths == 1
# Increse the paths to 2
mcad.set_variable('ParallelPaths', 2)

# Change the winding type to anything not custom, preferably "0" as this seemingly keeps the custom pattern intact for my cases
mcad.set_variable("MagneticWindingType", 0) 

# Create the winding pattern here, doesnt throw the range check error like it would for the custom winding type
mcad.create_winding_pattern()

# Change the winding type back to custom
mcad.set_variable("MagneticWindingType", 2) 

# Set some property on the second path
mcad.set_winding_coil(1, 2, 1, 19, 'C', 28, 'C', 53)

# Will not throw any errors

Ill leave the issue open since this cant be the intended behavior and does require entering the entire custom pattern again, to ensure it hasnt changed.