sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    How does Sketchup assign persistent ids?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 7.0k 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.
    • L Offline
      Lance_Uppercut
      last edited by

      I was wondering if anyone knows what rule or process Sketchup follows to assign persistent ids to the various entities that support them? From inspecting a new file with a couple of new objects as well as components from the sampler set, they are all 5 digit integers and seem to be sequential where basic geometry is concerned, but ids are definitely skipped for a new group (#find_entity_by_persistent_id comes up null for the skipped integers).

      What I'm trying to do is write a scene graph that can keep track of relationships between a set of custom object instances, and normal Sketchup objects, (groups and component instances). Working entirely with integers is both efficient and easy to serialize for storage between sessions, but I need to avoid collisions between my object IDs and the Sketchup persistent IDs. I would prefer not to maintain a separate set of IDs for custom objects - they all need to be part of one pool.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        I would not make any assumption on the form of persistent ids, simply that they are persistent.

        For your custom objects, the best is to assign them an attribute with your own ID scheme. This way

        • you would make the difference between your custom objects and other objects,
        • you can reuse the same custom ID if your custom object is regenerated as a new group or new instance
        • there would be no clash of id.
        1 Reply Last reply Reply Quote 0
        • G Offline
          Griffin121 Newcomers
          last edited by

          Sketchup assigns persistent IDs by giving each object a unique identifier that does not change when the object is modified.

          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