Skip To Content

DocFeatureLayer.Copy (.NET)

The DocFeatureLayer.Copy method copies an existing document feature layer definition to the specified name or a unique name in the current drawing. If the supplied new feature layer name, newFLName, already exists or is omitted, a new unique name is generated. The resulting new feature layer has the same feature layer query and attribute definitions. No entities are copied.

Declaration

public string Esri.ArcGISForAutoCAD.DocFeatureLayer.Copy(Document doc, string flName, string newFLName = null)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing document feature layer name in the drawing.

required

string

newFLName

The new document feature layer name.

optional

Returns

TypeDescription

string

The new document feature layer name.

Remarks on error conditions

This method may throw an exception or return an empty string or null if a parameter is invalid.

Example

Create a copy of the Streets document feature layer definition with the new name Roads, and print the new document feature layer name.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;

// Copy the document feature layer
var copyName  = Esri.ArcGISForAutoCAD.DocFeatureLayer.Copy(doc, "Streets", "Roads");

// Print the name of the new document feature layer copy
doc.Editor.WriteMessage(copyName);

/* Example output
Roads
*/

See also

DocFeatureLayer.Rename—A .NET method that renames a document feature layer.

esri_docfeaturelayer_copy—An AutoLISP function that copies an existing document feature layer definition to the specified name or a unique name in the current drawing