method 2
create one side of the frame, that is the thickness, depth and the length
that is 1000 x 50 rectangle pushpull 100mm to match side of the first example
make this a group, named "side"
now draw a reference line from the center of the group, 500mm long (half of its length) then select the "side" group and use the rotate tool centered on the end of this line, press control, and copy rotate it 90degs then enter *3 to copy rotate to form the full frame
this creates groups on the boundary of the component bounding box, with their axis pointing inwards

Now delete the line, select all the sides and make them a component "frame2"

open the attribute dialog and add an attribute "thick" and expose this to the option dialog, enter 50mm (5cm) as value
expose the size attributes of the frame and label them as you like

in the LenX attribute of the "side" groups write then copy
=parent!thick
(note: parent is a general term for the parent group or component and can be used instead of the name, this is good for copies and common formula)
This component will now change as per options or scaling, to remove the lap of the groups, after a change one uses outershell on the groups
So open the frame2 component, select the groups and make them a component "outershell and explode me", create an attribute "thick" and write or copy
=parent!thick
(initially you will see the red # in the side groups, but this will go once the above formula is entered in thick)

you will now have a point to use the right click menu within the outliner to simplify the DC (dynamic component).

However this destroys the dynamic part. There is a way a DC can be reinstated via a swap with a saved file of the DC. To enable the DC to match the existing attributes we need to add "current" formulas, the current function returns the last set value in inches, so for metric one converts this to centimeters by multiplying by 2.54
=current("LenX")*2.54
=current("Leny")*2.54
=current("Lenz")*2.54
for the size attributes
then in the outershell component make the size attributes equal to the frame2 component

Now this DC must be saved (via right click menu) as a component file (folder of your choice) as changing the values via the option dialog will overwrite the current formula, this does not mater as the swapping DC to replace the simplified version still has.
have attached the working file, the DC should be right saved before changing the options for the swapping DC
frame 2.skp