ansys / pymotorcad

https://motorcad.docs.pyansys.com
MIT License
13 stars 1 forks source link

Bug when setting parallel paths variable and corresponding winding pattern #326

Open itsToggle opened 1 month ago

itsToggle commented 1 month ago

🔍 Before submitting the issue

🐞 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:

📝 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
itsToggle commented 1 month ago

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.