Ruby Architecture concerning Deleted Entities
-
Sketchup deletes and replaces entities as it desires - sometime from one ruby line to the next.
I am trying to build fast routines avoiding to to manipulations which would necessarily lead to new entities (however - if SU decides to do so I obviously can't stop it from doing so).
sumod = load_skp_entities_from_file("xxx.skp")
lets assume, ents is loaded as a Sketchup::ComponentInstance, then the reference to its entities is:
ents = sumod.definition.entities
now I need to work with those entities in order to make changes to the loaded model.
at one point in the code I run into the following part:
return if ents.deleted? # ents.deleted? is false
puts ents.lengthand sketchup breaks with "undefined method `length' for #<Deleted Entity:0xef91fd8>"
in THE VERY NEXT LINE after having checked that it is NOT deleted.
and there is no chance to get information on how why when or how to avoid thisthe only comments I found were: "why work with entities, create new ones right away as you need them". this is not how my code works for many good reasons (like not having to model and especially correctly texturize from scratch). It really needs to load entities and work with them.
Are there any guidelines, help on how to keep entity references (or meta references) valid in a fast and efficient way?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement