• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Definition.instances upset

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 223 Views 2 Watching
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.
  • C Offline
    chrisglasier
    last edited by 31 Dec 2010, 04:47

    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
    • T Offline
      thomthom
      last edited by 31 Dec 2010, 10:36

      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
      • C Offline
        chrisglasier
        last edited by 31 Dec 2010, 11:39

        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
        1 / 1
        • First post
          2/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement