3ds Max Copy And Paste Script
Before diving into the script, we must understand the limitation of the native system. In 3ds Max, when you select an object and press Ctrl+C, you are copying a reference pointer to the object's location in the current scene's memory. When you press Ctrl+V, Max creates an instance or copy of that object within the same .max file.
This works fine for duplicating a chair leg ten times. However, try to open File A (a character model) and File B (a new scene), copy the character in File A, switch to File B, and paste it. It won't work. The clipboard empties the moment you close or switch the active document.
The workaround? File > Import > Merge. While functional, merging is slow. It requires navigating through dialog boxes, searching through object lists, and manually selecting what you need. If you need to copy-paste thirty times in an hour, Merge kills your creative flow. 3ds max copy and paste script
Enter the Copy and Paste Script. This script hijacks the Windows clipboard or creates a persistent memory buffer that survives session changes.
try
(
clip = dotNetClass "System.Windows.Forms.Clipboard".GetText()
json = dotNetObject "System.Web.Script.Serialization.JavaScriptSerializer"
arr = json.DeserializeObject clip
if arr.count != selection.count then
format "Warning: copied % objects, but selection has % objects. Will apply in order.\n" arr.count selection.count
for i = 1 to (min arr.count selection.count) do
(
src = arr.get_Item (i-1)
tgt = selection[i]
if src.transform != undefined then
tgt.transform = arrayToMatrix3 (for v in src.transform collect v)
if src.mods != undefined then
(
for sm in src.mods do
(
try
addModifier tgt (execute sm.class) -- may fail
catch()
)
)
)
format "Pasted onto % objects.\n" (min arr.count selection.count)
)
catch e
(
format "Error: %\n" e
)
-- Global storage for clipboard data global copiedObjectsData = #()fn copySelectedObjects copyMode transformOnly:false = ( if selection.count == 0 do ( messageBox "No objects selected." title:"Copy Error" return false ) Before diving into the script, we must understand
copiedObjectsData = #() for obj in selection do ( local objData = #() -- Store name and class append objData #name (obj.name) append objData #class (classof obj) -- Store transform (position, rotation, scale) if transformOnly == false or copyMode != #transformOnly do ( append objData #transform (obj.transform) ) -- Store geometry (if copying mesh) if copyMode == #full or copyMode == #instance do ( if isKindOf obj GeometryClass do ( append objData #mesh (copy obj.mesh) ) ) -- Store modifier stack if copyMode == #full do ( local mods = #() for m in obj.modifiers do append mods (copy m) append objData #modifiers mods ) -- Store material if obj.material != undefined do append objData #material (copy obj.material) -- Store wirecolor append objData #wirecolor obj.wirecolor append copiedObjectsData objData ) -- Optional: write to external file for cross-session local file = openFile "$temp/max_clipboard.json" mode:"wt" format (copiedObjectsData as string) to:file close file format "Copied % object(s)\n" selection.count return true
)
fn getModifierData m =
(
md = #()
for p in m.parameters where p != undefined do ()
for prop in (getProperties m) do ()
-- simpler: capture name and public properties via snapshoth
try
(
props = dotNetClass "System.Collections.Generic.Dictionary`2[System.String,System.Object]"
for pn in (getPropNames m) do
props.Add pn (m[pn] as string)
)
catch()
append md (name:m.name class:(classof m) props:props)
md
)
data = #()
for o in selection do
(
obj = #()
obj.name = o.name
obj.transform = (matrix3ToArray o.transform)
mods = #()
for m in o.modifiers do
(
modProps = #()
for pn in getPropNames m do
append modProps #(pn, (m[pn] as string))
append mods #(class=(classof m).name name:m.name props:modProps)
)
obj.mods = mods
append data obj
)
json = dotNetObject "System.Web.Script.Serialization.JavaScriptSerializer"
clipText = json.Serialize (dotNetObject "System.Collections.ArrayList" data)
dotNetClass "System.Windows.Forms.Clipboard".SetText clipText
format "Copied % objects to clipboard.\n" selection.count
While 3ds Max has built-in Copy (Ctrl+C) and Paste (Ctrl+V) for objects, it doesn’t allow you to copy and paste transform values (position, rotation, scale) or modifier stacks between different objects. The following scripts solve this.
┌─────────────────────────────────────────────┐
│ Enhanced Copy/Paste Tool v1.0 [X] │
├─────────────────────────────────────────────┤
│ Copy Options │
│ ☑ Transform (PRS) │
│ ☑ Geometry (mesh/spline) │
│ ☑ Modifier Stack │
│ ☑ Material │
│ ☑ Animation Controllers │
│ │
│ Copy Mode: ○ Copy ○ Instance ○ Reference│
│ │
│ [ Copy Selected ] [ Paste to Scene ] │
│ │
│ Paste Options │
│ ○ At Original Position │
│ ○ At 3D Cursor / Grid Click │
│ ○ Offset by [0,0,0] │
│ │
│ ☑ Match object names (append _copy) │
│ ☑ Preserve hierarchy │
│ │
│ Status: Ready │
└─────────────────────────────────────────────┘