Isotropix Forums

Multi selection

Clarisse Scripting related topics

Multi selection

Unread postby xc278260759 » Fri Jul 27, 2018 1:02 pm

Code: Select all
objAll = ix.api.OfObjectVector()
objType = ["TextureMapFile", "TextureStreamedMapFile"]

for i in objType:
    ix.application.get_matching_objects(objAll, "./*", ix.application.get_working_context(), i)#

selObj = []

if len(objAll):
    for obj in objAll:
        tex_path = obj.get_attribute("filename").get_string()
        file = tex_path.split("/")[-1]#
        ext = file.split(".")[0]#
        #print str(obj)

        if str(ext) == "desert3":
            selObj.append(str(obj))

    if len(selObj):
        print len(selObj)
        ix.selection.select(ix.get_item(str(selObj)))


ix.selection.select(ix.get_item(str(selObj))) Report errors!
xc278260759
 
Posts: 24
Joined: Sat Aug 19, 2017 7:57 am

Re: Multi selection

Unread postby xc278260759 » Sat Jul 28, 2018 10:35 am

sel = ['project://scene/RDT_collection_one_smap', 'project://scene/RDT_collection_one_map']
ix.application.set_selection(str(sel))

What is the right choice?
xc278260759
 
Posts: 24
Joined: Sat Aug 19, 2017 7:57 am

Re: Multi selection

Unread postby bvaldes » Mon Jul 30, 2018 8:37 am

Hello,

The ix.selection class has several method. One of them is select() and set the selection on the item we set as argument. If you want to have several objects in you selection you can use the method add(). This will ad objects (one by one) to the selection.

python code

ix.selection.select(ix.get_item("project://scene/box")) # will replace the current selection by the box
ix.selection.add(ix.get_item("project://scene/box")) # will add to the current selection the box if it doesn't inside of the selection


Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 283
Joined: Mon Sep 26, 2016 10:44 am

Re: Multi selection

Unread postby xc278260759 » Fri Aug 03, 2018 4:50 pm

bvaldes wrote:Hello,

The ix.selection class has several method. One of them is select() and set the selection on the item we set as argument. If you want to have several objects in you selection you can use the method add(). This will ad objects (one by one) to the selection.

python code

ix.selection.select(ix.get_item("project://scene/box")) # will replace the current selection by the box
ix.selection.add(ix.get_item("project://scene/box")) # will add to the current selection the box if it doesn't inside of the selection


Regards

Thanks yous reply.
xc278260759
 
Posts: 24
Joined: Sat Aug 19, 2017 7:57 am


Return to Scripting