dbLayerOr takes a list of database ID's and merges them without affecting the original data objects. We had a discussion on finding the shapes on a layer in a previous post:
myLPP = setof( lpp cvId~>lpps lpp~>layerName == "myMetal")
myLppShapes = myLPP~>shapes
dbLayerOr( cvId list( "myMergedMetal" "drawing") myLppShapes))
You would then delete the original objects. If you wanted to merge through the hierarchy, you would use dbGetOvelaps on the bounding box and transform any object which is at a lower level of hierarchy. Here the use of a scratch cell or the dbPointArrayOr commands may be useful.
The layer Booleans and the Point Array functions are defined in the Virutoso Design Environment SKILL Reference.