Hi,
Using the layer number should work but it has to be passed as an integer type which might have been the issue if you used layername = i.
Then it will be sent as a string type so the export engine will think it is the layer name instead of the layer number.
try using:
dxfEngine.PutElementExport(MGCPCBEngines.EEnginesElementType.eengElementTypeTraces, dxfLayerName, i, True)