Setting up an Observer for a Dimension within a group of a group

I added in the option for plan dimensions for walls not too long ago:

I’m wondering if there is a way to setup an observer such that one could hover over a dimension, one wants to modify, and then after a couple of seconds the dimension would highlight and then one could click it, at that point an edit menu would be called and then the user could modify the wall layout/dimensions simply by editing the dimensions.

I’m not very versed in observers, in fact I think I’ve probably only used them once in almost 8 years of working with the Ruby API so I don’t even know if something like this is possibly.

The problem is that the dimensions are buried within the actual wall group/assembly and so it is not just as easy as clicking on them.

I also posted this in my Medeek Wall thread, more of an FYI than anything else. I’m posting here in this category for more technical reasons, namely to see if anyone has done something like this before and if it is even remotely feasible.

Would such an observer make SketchUp unstable or slow it down in any way?

Probably the simplest way for a user to click a nested object is with the PickHelper within a Ruby Tool.

The Select tool can only click objects within the current active_entities, so a SelectionObserver cannot help you with this.

Now, … with the addition of Overlays, there now exists the possibility to highlight items under the cursor outside of an active Ruby tool, ie for any tool, as long as the overlay is enabled. It has an onMouseMove callback which you could use along with a PickHelper to detect a dimension under the cursor for the highlight feature.

However, overlays have not been given any mouse click callbacks by design. So, you’d need to invent some other way of knowing that the user wishes to perform the edit. Perhaps selecting the parent or grandparent whilst an overlay was highlighting the dimension ? This might be where a SelectionObserver can help you.

1 Like

I pretty much know how to do this sort of thing already with the PickHelper in a Ruby Tool, in fact I’ve got a number of tools already like the opening edit tool that allow me to pick a group nested in a wall group.

The idea behind the hover over the dimension concept is to remove the one additional step of having to first click the edit dimension tool in the toolbar and then afterwards selecting your dimension to edit, but after some thought I don’t think this is such a bad thing, especially if the tool is persistent and allows one to keep picking and editing dimensions repeatedly.

I think the Tool using PickHelper is probably the easiest and best way to go, at least I’m dealing with known entities rather than stumbling around in the dark, but as you know I sometimes like to push the envelope a little and see what I can do.

This new overlay thing does intrigue me some, I will do some further reading and investigation.

Thank-you for your timely input and advice, as always you get me sorted out one way or another.

1 Like