sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Definition.instances upset

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 223 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      I hope someone can see what is wrong here. I can add all the definition instances to the selection but I can only return half of them as shown in the console. Sorry it's rather messy, made worst by the impossibility to indent.

      Thanks and Happy New Year.

      Quin 301210.gif

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        It's because you have instances of a definitions which exists in multiple instances of another definition.

        Example:

        Definition "lower_arm"
        lower_arm_definition.count_instances == 1 (because it only has one instance, placed in the lower_arm_combo definition.)
        lower_arm_definition.instances will return only that instance. Because you add it to the selection, that instance will be highlighted everywhere it occurs in the model. But you have not iterated over any more instances.

        What you need to do, is travel back the paths of an instance's parents and if it's contained in another group or component, then you must work out how many copies there is of that - and continue that all the way back.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          Takk!

          Now you have said it I feel somewhat foolish ... oh well ... time to go to the pub. Maybe next year I can do better.

          Happy New Year to you and all the other members.

          Chris

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement