We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

get objects containing specific string

Home Forums Puzzles get objects containing specific string

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #60580
    loam48
    Participant

    Hello,

    I am new to puzzles and would like to select only objects having a specific set of string in its name.

    Example: I have 4 object named square1; square2; sphere1; and sphere2.
    I would like to select all the objects that have “square” in their name.
    It is important to note that I don’t want to group them together since square1 and sphere1, and square2 and sphere2 are already grouped in their respective groups “1” and “2”.

    Is it possible?

    Thanks!

    #60582
    kdv
    Participant

    How do you want to select objects? To make them outlined or just add their names to a list? You can use this puzzle to compare names

    The puzzle will return -1 if the search word is not found.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #60584
    loam48
    Participant

    At first I want to Hide/Show all objects that have a specific word in their name.

    But then I want to be able to Hide/show only the object containing the specific word that is currently showing:

    Exemple:

    I have 3 objects on the scene, collection 2 is selected so I have:

    • Ball1 (hidden)
    • Ball2 (showing)
    • Ball3 (hidden)

    I want to be able memorise which ball is currently showing, then hide it by clicking on a HTLM button, then show it by clicking again.

    Then I select collection 3 and I have:

    • Ball1 (hidden)
    • Ball2 (hidden)
    • Ball3 (showing)

    So when I click on the HTML button, I want to hide/show Ball3

    I hope that make sense.

    Cheers, thanks for your help!

    #60588
    kdv
    Participant

    Use variables, conditions, loops, logic and the browser’s console log (F12). They are the basis )))


    Finds and hides all meshes with names containing “cube”.

    This little piece of JS code will do the same

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.