sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Get one specific entity out of all entities: method?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 744 Views 3 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.
    • P Offline
      Pout
      last edited by

      It's a speed question.

      For example.
      From all Sketchup entities i want that entity which has a certain entity-id

      Off course i can do this by looping all model entities and comparing the entity-id of each with the supplied entity-id. If those match then i have the solution.

      But is it not possible to let Sketchup just pick that one without looping through all of them?

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

        AFAIK there isn't such a mechanism. 😞 I'd sure be in handy.

        why are you dealing with entity IDs? Webdialog<->Ruby communication?

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

        1 Reply Last reply Reply Quote 0
        • P Offline
          Pout
          last edited by

          shame there is none, would speeds up some processes.

          It was just an example. It is close to impossible to use the entity-ids as an identifier for an entity since they can change each time you open the file.

          In our case we use the (self-defined) entity-id's as a unique identifier of the entity in a database.

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

            A separate entity ID system using attribute dictionaries?

            This whole entity ID is a pain. When I was working on DoubleCut, trying to pair up two components I was trying all kinds of methods to keep track of the entities. Outright pain and suffering! 😞

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

            1 Reply Last reply Reply Quote 0
            • P Offline
              Pout
              last edited by

              @thomthom said:

              A separate entity ID system using attribute dictionaries?

              This whole entity ID is a pain. When I was working on DoubleCut, trying to pair up two components I was trying all kinds of methods to keep track of the entities. Outright pain and suffering! 😞

              Indeed, a unique entity id is created by the plugin and stored in the attribute dictionary of that entity.
              Seems to be the only good and controlable way to identify Sketchup objects.

              Did you use the same method for your problem or did you find a work-arround?

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

                I shelved the project due to a number of SU Observer bugs made it impossible to accomplish my task. 😞

                I was using an Hash to keep track of the entities and the ID for quick run time lookup. But I'm not sure if this is safe - as I'm not sure how well SU deals with entity references once an entity is deleted.
                And it still mean that upon loading a model I'd have to scan the model to rebuild my hash index. In my case I could just scan the definition list and not every single entity, but still not a pretty solution.
                That whole project was nothing but trouble in pretty much every aspect of it.

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

                1 Reply Last reply Reply Quote 0
                • T Offline
                  todd burch
                  last edited by

                  I probably have 50+ projects that ended this way - due to bugs, holes in the API, cross platform issues, etc. Very frustrating.

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

                    DoubleCut makes me huddle up in a corner and cry....

                    My wish for SU in the future is for it to be developed further as a platform. Sorting out the bugs in the existing API and filling in the gaps.

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

                    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