assign_material#
- Maxwell3d.assign_material(assignment, material)[source]#
Assign a material to one or more objects.
- Parameters:
- Returns:
- bool
True
when successful,False
when failed.
References
>>> oEditor.AssignMaterial
Examples
The method
assign_material()
is used to assign a material to a list of objects.Open a design and create the objects.
>>> from ansys.aedt.core import Hfss >>> hfss = Hfss() >>> box1 = hfss.modeler.create_box([10, 10, 10],[4, 5, 5]) >>> box2 = hfss.modeler.create_box([0, 0, 0],[2, 3, 4]) >>> cylinder1 = hfss.modeler.create_cylinder(orientation="X",origin=[5, 0, 0],radius=1,height=20) >>> cylinder2 = hfss.modeler.create_cylinder(orientation="Z",origin=[0, 0, 5],radius=1,height=10)
Assign the material
"copper"
to all the objects.>>> objects_list = [box1, box2, cylinder1, cylinder2] >>> hfss.assign_material(objects_list,"copper")
The method also accepts a list of object names.
>>> obj_names_list = [box1.name, box2.name, cylinder1.name, cylinder2.name] >>> hfss.assign_material(obj_names_list,"aluminum")