TAGGED: #python-#ironpython, maxwell
-
-
October 14, 2023 at 7:07 am
Evka
SubscriberHello, Ansys Maxwell community,
I hope you are all doing well. I'm facing an issue while trying to create and edit materials in Ansys Maxwell using IronPython scripting. I have encountered the error message "The definition name cannot be blank" and despite multiple attempts to resolve it, I have been unsuccessful. I'm seeking the expertise of this community to help me identify and solve this problem.
Here's my code:
import ScriptEnv
# Initialize the environment
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")# Restore the window
oDesktop.RestoreWindow()# Set the active project
oProject = oDesktop.SetActiveProject("PS_without_shunt_litz")# Get the definition manager
oDefinitionManager = oProject.GetDefinitionManager()# Common material properties
material_properties = [
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=", 1,
["NAME:PhysicsTypes", "set:=", ["Electromagnetic"]],
"permittivity:=", "1",
"permeability:=", "1",
"conductivity:=", "56818181.818182",
["NAME:stacking_type", "property_type:=", "ChoiceProperty", "Choice:=", "Litz Wire"],
["NAME:wire_type", "property_type:=", "ChoiceProperty", "Choice:=", "Round"],
"strand_number:=", "200",
"wire_diameter:=", "0.1mm"
]# Material names
material_names = ["CondMat2_1", "CondMat2_2", "CondMat2_3", "CondMat2_4", "CondMat2_5", "CondMat2_6", "CondMat1_6"]# Create and edit materials in a loop
for material_name in material_names:
# Clone the material properties to avoid modifying the original list
material_properties_copy = list(material_properties)
# Update the material name in the cloned properties using .format
material_properties_copy[0] = '"NAME:{}"'.format(material_name)
material_name_1 = '"{}"'.format(material_name)
# Call EditMaterial with the updated properties list
oDefinitionManager.EditMaterial(material_name_1, material_properties_copy)Despite my efforts to correct the code, I still receive the error "The definition name cannot be blank." I have also tried various formatting methods for
material_name
, but the issue persists.If anyone has experience with this error or suggestions on resolving it, your assistance would be greatly appreciated.
Thank you in advance for your help.
-
October 19, 2023 at 12:50 pm
HDLI
Ansys EmployeeHello Evka,
Please record py scripting to find correct ironpyhon format for Maxwell or find it in the Maxwell scripting help manual.
I think you should use "oDefinitionManager.AddMaterial()" to add new material. Thanks.
HDLI
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- simulation completed with execution error on server
- Maxwell, HFSS or Q3D?
- Unable to assign correctly the excitations in a coil
- Intersect errors with model with complex structure
- How to export Ansys Maxwell simulation results for post-processing in matlab or in .csv file
- Process ‘3dtds’ terminated abnormally
- Running ANSYS HFSS on the HPC (it runs on Linux only)
- Error while solving Optimetrics
- Concept of Interpolation Sweep in HFSS
- Error
-
8740
-
4658
-
3151
-
1678
-
1452
© 2023 Copyright ANSYS, Inc. All rights reserved.