What's confusing is the world "block" which may mean BlockReference or BlockTableRecord.
As you say: "a block which is name "blk" and it;s layer is "my Layer" " I suppose you're talking about a block reference (a BlockTableRecord, aka block definition, does not 'have' a Layer).
As said upper, if you 'WBlockClone' (i.e. deep cloning) a block reference, you also clone the Layer the block reference is inserted on.
Here's a little example:
private static ObjectId ImportBlockReference(Database targetDb, string fileName, string blockName)
{
using (var sourceDb = new Database(false, true))
{
sourceDb.ReadDwgFile(fileName, FileOpenMode.OpenForReadAndAllShare, false, null);
using (var tr = sourceDb.TransactionManager.StartOpenCloseTransaction())
{
var ms = (BlockTableRecord)tr.GetObject(
SymbolUtilityServices.GetBlockModelSpaceId(sourceDb), OpenMode.ForRead);
ObjectId brId = ObjectId.Null;
foreach (ObjectId id in ms)
{
if (id.ObjectClass.DxfName == "INSERT")
{
var br = (BlockReference)tr.GetObject(id, OpenMode.ForRead);
if (br.Name == blockName)
brId = id;
}
}
if (!brId.IsNull)
{
var ids = new ObjectIdCollection();
ids.Add(brId);
var targetId = SymbolUtilityServices.GetBlockModelSpaceId(targetDb);
var mapping = new IdMapping();
sourceDb.WblockCloneObjects(ids, targetId, mapping, DuplicateRecordCloning.Ignore, false);
if (mapping[brId].IsCloned)
return mapping[brId].Value;
}
}
return ObjectId.Null;
}
}
Running:
var id = ImportBlockReference(databaseOfDrawingB, @"A.dwg", "blk");
Will return the ObjectId of the cloned block reference in drawing B if a reference of "blk" have been found in drawing "A" model space.