There are more simple way to grab all the shapes with layer rather than using cv~>shapes. A better propose is using setof(x cv~>lpps x~>layerName == "METAL1"). This will save time and less steps needed instead of running on all shapes in the cell view.
I did some modication on your code. Please try it.
procedure( delLayer( libName )
count = 0
lib = ddGetObj( libName)
foreach( cell lib~>cells
if( setof( the_view cell~>views the_view~>name == "layout") then
cv = dbOpenCellViewByType( libName cell~>name "layout")
foreach( shape car(setof(x cv~>lpps x~>layerName == "MET1"))~>shapes
;; if( layer == "MET1" then
;; **** need help in this area ***
;;I've tried dbDeleteObject() but i just can't seems to get it right
;; count++ );if
;; );foreach layer
BTW, there is a lot of space to improve in your script such as in checking for layout view. You can check whether the cell view is layout or not by checking its cell view type (eg: cv~>cellViewType == "maskLayout")