You'll have to first cycle the entire part file (using the 'NEXTE/' statement) and creating a list of all the objects on the layer of interest (using the '&LAYER' EDA statement) and then once you have that list, you can export them to a specified part file (using the 'CPATT/' statement).
John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA