Skip to documentation
DocumentationAll documentsEnglish

COPY(nged)

NAME

copy, cp - copy a database object to a new name

On this page

SYNOPSIS

copy from to
cp from to

DESCRIPTION

The copy command (also available as cp) duplicates the database object named from and stores the copy under the name to. The copy is an exact binary duplicate of the source object, preserving its type, geometry, and all attributes.

Exactly two arguments are required. The source object from must exist in the database. The destination name to must not already exist — attempting to copy to an existing name returns an error.

All object types can be copied: primitive shapes, combinations, regions, and external objects.

Note
copy performs a shallow copy. If from is a combination, the copy has the same tree structure and references the same member objects. Members themselves are not duplicated. Use xpush or manual reconstruction to deep-copy a hierarchy.

EXAMPLES

Example 1. Copy a primitive shape

mged> copy sph.s sph_copy.s

Creates an exact duplicate of sph.s named sph_copy.s.

Example 2. Copy a combination

mged> cp vehicle.c vehicle_backup.c

Duplicates the combination vehicle.c as vehicle_backup.c. The new combination references the same member objects as the original.

Example 3. Copy then modify the copy

mged> copy hull.r hull_modified.r mged> sed hull_modified.r

Copies hull.r to hull_modified.r, then opens the copy in the solid editor for modification without affecting the original.

SEE ALSO

move(nged), rename(nged), xpush(nged)

AUTHOR

BRL-CAD Team

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org