.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "samples\adaptive_template\ClosedSlot.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_samples_adaptive_template_ClosedSlot.py: 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. .. GENERATED FROM PYTHON SOURCE LINES 30-60 .. code-block:: Python 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]) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 14.922 seconds) .. _sphx_glr_download_samples_adaptive_template_ClosedSlot.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ClosedSlot.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ClosedSlot.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ClosedSlot.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_