Get one specific entity out of all entities: method?
-
It's a speed question.
For example.
From all Sketchup entities i want that entity which has a certain entity-idOff 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?
-
AFAIK there isn't such a mechanism. I'd sure be in handy.
why are you dealing with entity IDs? Webdialog<->Ruby communication?
-
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.
-
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!
-
@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?
-
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. -
I probably have 50+ projects that ended this way - due to bugs, holes in the API, cross platform issues, etc. Very frustrating.
-
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.
Advertisement