Bug: Model with duplicate Definition Names


#1

Here’s a model that has 2 definitions with the same name.

All I did was import some models from the 3D Warehouse. It’s repeatable for me. The 3D Warehouse model ID’s are:

bc9d17f218c8d67ba570c6c691c987a8
1c232d96ef95e1e4286651ecc4e57463

Import the using the Components dialog (1 ):

Model .zipped for size.
dup-defs.zip (1.5 MB)

SketchUp 15.3.331 64bit


#2

Where is the problem?
Then the definition names are not unique identifiers anymore (but the object it is).


#3

The SketchUp UI seems to enforce that only unique names can be given (replace existing definition with same name by this new definition or abort).

The API doesn’t explicitely state that the name must be a unique identifier, but it mentions a GUID.
But when you rename a definition to an existing name, it doesn’t apply the new name. Instead the API docs say it returns “the name assigned to the component definition if successful”, but actually it always returns the passed in parameter because that’s Ruby’s default behavior for assignments.

So there is a documentation bug and a component definition import bug. Interesting would be whether the bug occurs also when importing the definitions as skp file, or only when importing from 3D Warehouse.


#4

Why are we not allowed to create components with the same name via the user interface? It’s an inconsistency at best or a bug.


#5

SketchUp has been forcing unique component names for about 15 years now. As a result, there are a lot of assumptions both in the product, our API’s and even in extensions which rely on that fact. Changing SU to allow duplicate definition names proved to be very complex.


#6

Then it’s probably a bug that component import lets duplicate names slip through.


#7

Aerilius you’re correct. We’ll be fixing that loophole for the next major release. We’ll also keep examining ways to allow duplicate definition names but that is a much longer term effort.

~Bryce
Product Manager SketchUp