Duplicate definitions?


We have been developing/maintaining a ruby plugin for the past couple of years. Recently, one of the users using our plugin got an error. On investigating it, it turns out that Sketchup.active_model.definitions has 3 definitions with the same exact name.

My question to the forum is, under what condition does Sketchup allow a duplicate definition object to be created with the same name ? This was causing an error in our script as def[name] was returning the wrong object because of the duplicates.

Sketchup 2015 Pro 64 bit


It shouldn’t allow that to happen.

Can you reproduce it?

Do you know what SketchUp version the user was using - was it SU2015, or is that the version you use?

Can you share this model with multiple definitions of the same name?


Yes, that is what I figured. Unable to duplicate it as the user tried a series of actions and then sent us the skp file, I tried various actions. Let me check within my company if it is OK to share the skp file (no infosec issues). However, the reason i posted this, was actually based on your feature line item in TT_Clean which cleans up duplicate definitions. wanted to know why you did that feature and how users got into that issue for you to add that in TT_Clean.

Some background on the tool. It is a PV design tool (for internal use only) and when the user creates some 3d components thru our plugin and does the PV design using those components.

Good point on the sketchup version the user was using. I use sk2015. The user most probably was on Sk2014 Pro version.


If you don’t want to share publicly, but privately to us for debugging, PM me.

Oh, right! Yes, I’d completely forgotten about this. So that was to address some buggy models I came across which I believe is the result of some bug in some very old SketchUp versions, like version 6 or older than that. So it could be that you’ve inherited some bug from back then.
(I wonder if Fix Model now fixes that…?)
I’ve actually not run into this for many years - I’ve certainly not coded for the possibility of this scenario in any other extension I’ve written - it’s that rare.

If the duplicate names occur from use of your extension, and the user is using SU2015 or SU2014 or something new like that then I’d really like to figure out what’s going on - because that’s bad!
As I mentioned, contact me via PM if you want to share anything confidentially that might help us reproduce this on our end.


Sent you a PM with the SKP file