Component Inserts automatically unique every time?

I use Trustile Door components and I really like them. They have an odd behavior which I do not like. Each time you insert one of their doors it automatically makes it unique and adds the #1 suffix. Even if you if you make it unique and rename it. Once it’s been inserted if you insert another it keeps adding the suffix. I find this annoying. Does anyone know where this behavior originates and how to stop it?

I think that’s because each instance of a DC can have its attributes set independently and that can cause it to have different geometry than other instances (e.g. number of steps in the classic stairs example). As a result, DC’s behave more like Groups than Components.

And what Steve said goes especially for complex DCs with nested components that change such as their scale. Since all instances of a definition share the same entities, if one subcomponent gets scaled then it is scaled the same in all instances of that component.

But if the parent door DC is expected to change size dynamically when it is inserted, the DC code “uniques” it because it expects it’s internal mullins, stiles, panels, etc. to be changed or scaled to fit the particular insertion.

However once it is sized as a normal interior door, we’d expect that we could use multiple instances of it, but (for some reason recently) users are reporting that the copy process is uniqifying each and every instance which is bloating the “In Model” definition collection.

1 Like

Precisely. This brings to mind the FlexTools function which makes a component and all it’s sub components unique. I’m not sure if this works on non-FlexTools components. This would allow me to insert the component take advantage of all the options and then render it completely unique and give it a new name.

I have that feature in my cabmaker plugin. The unique script is pretty tiny. This can be easily extend to work with components as well as groups.

class Make_Unique
def initialize()
model = Sketchup.active_model
sel = model.selection.grep(Sketchup::Group)
sel.each{ |ent| fix_ents(ent) }
model.selection.clear()
end

def fix_ents(ent)
  ent.make_unique
  ents = ent.entities.grep(Sketchup::Group)

  ents.each{ |ent| fix_ents(ent) }
end

end

So it’s work around city for me…again. I’m just letting it do it’s worst and when I’m done I isolate the offending components in a scene select them in the outliner and go to the component window to right click on the first insertion with no suffix and hit replace selected. All #1 etc. are replaced and then I just purge unused.

Ok that turned out to be an awful P.I.T.A.

What does work is
1 Place the component.
2 Adjust the options.
3 Use FlexTools to Zap the DC out of it.
4 Rename and insert as many as needed from the component browser.

It kinda stinks that you have to de-DCify it.
Eneroth also has a dedcify plugin, BTW.

1 Like

As these DCs have internal copy functions, they will become unique on redraw. They are very large files with a lot of hidden options. So simply de-DCify does not reduce the file, besides Eneroth’s removes the parent data as well and does not appear to work on a sub level. If one simplifies the contents and leaves the parent DC intact, (one level DCs do not become unique unless forced) they can be swapped with their original definition (from an appropriate folder) and reactivate.
The solution could be to have a script that removes all hidden elements and de-DCify (thanks for the term Julia ) the subs

the script is only concept, made from some borrowed code, @john_drivenupthewall it requires the polish of a real developer, I am still figuring this ruby stuff.

    children = instance.definition.entities.select { |e| e.respond_to?(:definition) }
    children.each { |c| remove_hidden(c);
    
     if c.definition.attribute_dictionaries
          c.definition.attribute_dictionaries.delete('dynamic_attributes')
          c.attribute_dictionaries.delete('dynamic_attributes') if c.attribute_dictionaries
        end
 c.erase! if c.hidden?   }
    end
    
   
    remove_hidden(Sketchup.active_model.selection.first)
    
    [Sketchup.active_model.definitions].each{|a| a.purge_unused}

This can be further extended to simplify the option dialog, input changed to view only, and option dropdowns to current choice (I tried view only. but values have little meaning to an observer, like “1”, “2” for a color choice)

Another problem is we loose the animation as well, like the door swing,
So for doors may be the swing be included in the jamb, the proxy door can then be replaced with the choice.

I tried the script on

2MB down to 200KB
door test.skp (203.3 KB)