Do the devices that are in each of your 'Layers' have unique parts to their names? if so you could use and update query within the Solarwinds database.
I know its not the 'Done thing', but you could create the custom property from the NPM webconsole and then run some update query similar to:
Update nodes
Set <Custom_field_name>=<Layer_Name>
where caption like'%<unique_part_of_device_name>%'
of course this relies on the fact that all of your devices in each layer have unique parts to their names, or some other field that is within the nodes table.
Usually if I'm goign to run an update script, I first run it as a select query to make sure I only see the devices that i want tot update, so the above would be:
Select * from nodes where caption like '%<unique_part_of_device_name>%'
this will allow you to check that the nodes that will be update only contain those nodes you want to update
Hope this helps, sorry If I'm telling you stuff you already know
Reagrds
Simon