Isotropix Forums

Finding elements

Clarisse Scripting related topics

Finding elements

Unread postby netisfred » Wed Aug 04, 2021 8:08 pm

Hello, once again, I would need some help with this, I can't figure out nor find the information to this :

Is there a way to find a element or a context in the project using the * star in the name ?

For example trying to find :
----- if exists context "MyContext1_asset" or MyContext2_asset" etc.
- Using the var "MyContext" + "*" + "_asset"
For now it doesn't seem to work as simply as this.

----- Then if exists create another "MyContext" (result +1) + "_asset"

I hope it's not too confuse.
Thanks a lot !
Posts: 4
Joined: Fri Sep 14, 2018 1:13 am

Re: Finding elements

Unread postby anemoff » Thu Aug 05, 2021 4:36 pm


You have various search methods `get_matching_objects` in the AppObject API, accessible in Python through `ix.application`.

Here is a simple example (for 5.0) that searches for all contexts (recursively) that contain "foo" under "project://":

python code

results = ix.api.OfContextSet()
filter = "*foo*"
base_context = ix.get_item("build://project/")
if ix.application.get_matching_contexts(results, filter, base_context):
print("Found {} matches:".format(results.get_count()))
for i in range(results.get_count()):

Hope this helps.
Anthony Nemoff
R&D Engineer
User avatar
Posts: 482
Joined: Wed Jan 13, 2016 10:10 am

Re: Finding elements

Unread postby netisfred » Thu Aug 05, 2021 9:53 pm

Hello !
Thanks a lot for this, I will dig into this and the doc. In any case thanks to take the time showing me that. It will help a lot.
Posts: 4
Joined: Fri Sep 14, 2018 1:13 am

Return to Scripting