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

    Access to Dimension Line text?

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 4 Posters 881 Views 4 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.
    • thomthomT Offline
      thomthom
      last edited by

      @august said:

      Maybe I could add an attribute to a Text Entity that would save the Object ID of the Contour Line. Save all of those special Text Entities in a List.

      What did you have in mind for "Object ID"? Entity.entityID is not persistent between sessions.

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

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        @august said:

        Maybe I could add an attribute to a Text Entity that would save the Object ID of the Contour Line. Save all of those special Text Entities in a List.

        @unknownuser said:

        ](http://code.google.com/apis/sketchup/docs/ourdoc/entity.html#entityID)":1pgf4c48]The entityID is not persistent between sessions.

        Object.object_id is assigned by Ruby, and also is not persistent between sessions.

        "%10.6f" % Time.now.to_f returns a Float (converted to a String,) value of seconds (to 6 decimal places,) since the epoch began.

        If you do not call Time.now.to_f twice in the same statement, it should always return a unique numerical string. If you are creating these "ids" in a loop, you can always be sure, the next iteration gives a new value by inserting a sleep statement within the loop's block, OR keep track of the last "id" created, and compare them. If they are the same.. create another, until the new one is different.

        Keep in mind String compares are slow.. so you may wish to keep the "id" as a Float, for speedier compares.

        Perhaps compares may be faster for Integer (and less memory, because there is only 1 of each ordinal for the entire set of integers in Ruby,) so you could multiply by 1_000_000 and use .to_i then store the "id" as a usec integer.

        Or maybe an Array id:
        %(#BF0000)[t = Time.now
        id = [ t.to_i, t.usec ]]

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • A Offline
          August
          last edited by

          I had forgotten that Entity or Object IDs are not persistent. Neither are Arrays.

          Right now TIG's Add Height from Datum seems to handle the basic idea for contour lines. But it is self-contained, referencing the hight of the Text Element point itself. To display data in a Text Element about another object means linking the entities, which is, of course, where the Unique Identifiers come in.

          Thanks, Dan, for a great idea on where to get unique identifiers to add to an object's attributes.

          It would probably require building a Lookup table, and rather than do that when you open the file, and thus do it for every file, it would be better to it when you manually access a menu item that updates the Text Entity Tags.

          I'm going to let this one percolate for a while. If most of the substructure had to be created to do the contour lines and extending it was the simpler part, that's one thing. But since the contour lines is solved and extending it is not really extending anything, it's creating a whole new methodology, that's another thing.

          Thanks again to all.

          August

          “An idea, like a ghost, must be spoken to a little before it will explain itself.”
          [floatr:v1mcbde2]-- Charles Dickens[/floatr:v1mcbde2]

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @august said:

            I had forgotten that Entity or Object IDs are not persistent. Neither are Arrays.
            ...
            It would probably require building a Lookup table, ...

            The normal way is to attach an attribute dictionary to the items you wish to "link" and save the "linking id" into each dictionary.

            %(#BF0000)[t = Time.now
            object1.set_attribute('DictName','Link',[t.to_i,t.usec])
            object2.set_attribute('DictName','Link',[t.to_i,t.usec])]
            Saving the file, saves the attributes.

            The next time the file is opened, you can iterate the entities, and build a temporary session lookup table (an Array or Hash,) by comparing the timestamp array attributes of certain types of entities, that have the specific named dictionary.
            During the session you CAN use the entityID or object_id methods.

            I'm not here much anymore.

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

              @dan rathbun said:

              The next time the file is opened, you can iterate the entities, and build a temporary session lookup table

              Doing that automatically for each entity would probably make SketchUp crawl to sludge when loading large models. 😞

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

              1 Reply Last reply Reply Quote 0
              • A Offline
                August
                last edited by

                @thomthom said:

                Doing that automatically for each entity would probably make SketchUp crawl to sludge when loading large models. 😞

                That is what I was alluding to when I wrote:

                @august said:

                It would probably require building a Lookup table, and rather than do that when you open the file, and thus do it for every file, it would be better to it when you manually access a menu item that updates the Text Entity Tags.

                My thought is that you should manually trigger the updating and table-building process, maybe with a progress bar, so that at least it only happens when you are prepared for it happening, and most especially it does not happen on every file, whether the tool is used or not, just because the Plugin happens to be loaded.

                It might be a timesaver to have the option of scanning the whole file, or just the selected part of the file.

                “An idea, like a ghost, must be spoken to a little before it will explain itself.”
                [floatr:v1mcbde2]-- Charles Dickens[/floatr:v1mcbde2]

                1 Reply Last reply Reply Quote 0
                • A Offline
                  August
                  last edited by

                  FYI, for anyone following this, now or later, here is the link to TIG's plugin:
                  [Plugin] Add Height from Datum v1.3

                  “An idea, like a ghost, must be spoken to a little before it will explain itself.”
                  [floatr:v1mcbde2]-- Charles Dickens[/floatr:v1mcbde2]

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    @thomthom said:

                    @dan rathbun said:

                    The next time the file is opened, you can iterate the entities, and build a temporary session lookup table

                    Doing that automatically for each entitywould probably make SketchUp crawl to sludge when loading large models. 😞

                    For the record, I never said each entity, I said ...
                    @dan rathbun said:

                    certain types of entities, that have the specific named dictionary

                    .. which is similar to how the Dynamic Components extension operates. But it uses observers to know when to "update' or redraw the entites it is concerned with.

                    It would be nice to have a "when_idle" block to do work like this when nothing else "heavy" is going on.

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      August
                      last edited by

                      @dan rathbun said:

                      For the record, I never said each entity, I said ...
                      @dan rathbun said:

                      certain types of entities, that have the specific named dictionary

                      Thanks for keeping that key concept on the table after I skipped over it.

                      “An idea, like a ghost, must be spoken to a little before it will explain itself.”
                      [floatr:v1mcbde2]-- Charles Dickens[/floatr:v1mcbde2]

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        post removed. (Too tired, low confidence in what I wrote.)

                        I'm not here much anymore.

                        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