Returns the currently selected simulation object, if multiple objects are selected, the first one in the list returned.
Syntax
outputObject = lumapi.getObjectBySelection()
Parameters
None
Returns
Field |
Type |
Description |
---|---|---|
outputObject |
Object obtained by function. |
Example
fdtd = lumapi.FDTD() z_placements = [0, 1e-6, 2e-6, 3e-6] for i,position in enumerate(z_placements): fdtd.addrect(name = f"Rect{i}", z=position) fdtd.selectpartial("Rect") #Selects all objects with “Rect” as a part of its name obj = fdtd.getObjectBySelection() #Only the first one out of the objects that are selected is returned here print(f"Rectangle name: {obj['name']}, z position: {obj['z']}
Returns
Rectangle name: Rect0, z position: 0.0
See Also
Python API overview – Ansys Optics, Lumerical Python API Reference, lumapi.getObjectbyId, lumapi.getAllSelectedObjects