Setting material properties to close slot#

This script applies the adaptive templates functionality to change the air region in the slot opening to steel, to model a closed slot.

import sys

import ansys.motorcad.core as pymotorcad
import ansys.motorcad.core.geometry as geo

# Connect to Motor-CAD, using existing instance
# Alternatively, we could open a new instance and load a file with mc.load_from_file()
mc = pymotorcad.MotorCAD()


# Reset geometry to default
mc.reset_adaptive_geometry()

# Try to replace the StatorAir region properties, so it behaves like steel
stator_air = mc.get_region("StatorAir")
stator = mc.get_region("Stator")
stator_air.material = stator.material
stator_air.colour = stator.colour

# Set to laminated region type
# (setting as adaptive region type will not be necessary in the future)
stator_air._region_type = geo.RegionType.adaptive
stator_air.lamination_type = "Laminated"
mc.set_region(stator_air)

# If we're running this externally, load adaptive template script into Motor-CAD
if not pymotorcad.is_running_in_internal_scripting():
    mc.set_variable("GeometryTemplateType", 1)
    mc.load_adaptive_script(sys.argv[0])

Total running time of the script: (0 minutes 14.922 seconds)

Gallery generated by Sphinx-Gallery