Python: generate code list from selection?


is there a possibility to write a list in python code from the selected objects in OM?

For example I select Null_01, Null_02 and Null_03 and I somehow can generate a python list with the names as string? = [“Null_01” ,“Null_02” ,“Null_03”]



names = [o.GetName() for o in doc.GetSelection()]

doc.GetSelection() returns the selected objects as BaseObject references. From there we’re using python list comprehension to build a list with the name of each object.


Thank you so much! And so easy…