Access to Dimension Line text?
-
If that's ALL you want... then find my 'Height Datum Coords' tool...
Just pick the contour to add the height above your [preset] datum...
If you move the text up/down then the value shown changes... -
@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.
-
@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 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
-
@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. -
@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.
-
@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.
-
FYI, for anyone following this, now or later, here is the link to TIG's plugin:
[Plugin] Add Height from Datum v1.3 -
@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.
-
-
post removed. (Too tired, low confidence in what I wrote.)
Advertisement