Stop Dynamic Components becoming unique on edit

I am trying to create a dynamic window component that has various user settable attributes such as frame thickness, window height etc.with overall size settable via the scale tool. The current version of the window as it stands is made up from four sub components - main window frame, lower larger window x 2, smaller upper window.

The larger lower windows are two separate unique components as I want these to swing on click in opposite directions. The upper smaller windows are identical with the on click to tilt at their bottom edge but in the same direction.

I have decided to add in glass to the windows just as a flat plane and then have this resize as required based on the sizes of the frame. When I try to add in the attributes to the smaller upper window x,y,z, these add fine to the window without making the sub component unique. As soon as I add LenX the component becomes unique. The same also happens if I add an equation to the x position (this is before adding the LenX attribute).

In a previous thread (on a similar problem from a while ago) that I have come across, I have seen and tried some Ruby code from @eneroth3 (below) that gives an idea of when the component, and by what, is being made unique.

class Sketchup::ComponentInstance
  unless defined?(ene_original_make_unique)
    alias_method :ene_original_make_unique, :make_unique
    private :ene_original_make_unique

  def make_unique(*args)
    puts caller

The output from this is:

0.001408 seconds to redraw
c:/users/madz/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbe:5263:in make_unique_if_needed' c:/users/madz/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbe:466:in redraw’
c:/users/madz/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbe:2436:in push_attribute' c:/users/madz/appdata/roaming/sketchup/sketchup 2021/sketchup/plugins/su_dynamiccomponents/ruby/dcclass_v1.rbe:266:in block in show_dialog’
0.0428393 seconds to redraw

In the thread in question this code came from, an extension was causing the problem, removing the extension solved the problem. From the output I am getting the extension in question is the Dynamic Component extension itself. I only have one non default extension installed su_bezier for drawing bezier curves. I have tried loading sketchup with this extension disabled and/or blocked with no change. Also whenever I drag one of the sub components in from the components browser it too becomes unique!

I have tried multiple different ways of creating this component and it still fights back, anyone have any ideas or see what I am doing wrong?

Sketchup 2021.v21.0.391 64Bit Windows 10 Home v20H2
Model file and image attached.

Any suggestions / help greatly appreciated.


window s04-v08.skp (96.9 KB)

Dynamic components are an extension, and stores its definitions as normal component definitions. All components with the same definition must be geometrically identical. This is why every time a component’s parts are scaled unequally by the DC formulas, a new definition has to be created to enable saving it.

@Anssi Thank you for your reply. I understand that about dynamic components and scaling and that in itself makes sense. The problem I am having occurs before any scaling at all is applied. This occurs as I try to edit the component to add an attribute to the component definition during creation without even changing the value of the attribute - the component is currently unfinished… This also does not explain how if I drag and drop a component in from the component browser it generates a unique version each time.