Last active
August 3, 2021 00:55
-
-
Save CGLion/1bda4bb03f49cdd6ae287dbc62a3eefd to your computer and use it in GitHub Desktop.
Python for 3ds max - Replace selected objects with objects from an external file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from MaxPlus import FileManager | |
from MaxPlus import SelectionManager | |
model_path = r"D:\Models\Some_model.max" | |
place_holders = [] | |
for o in SelectionManager.Nodes: | |
place_holders.append(o) | |
FileManager.Merge(model_path,True,True) | |
model = SelectionManager.GetNode(0) | |
for i in range(len(place_holders)): | |
place_holders[i].SetObject(model.GetObject()) | |
place_holders[i].SetMaterial(model.GetMaterial()) | |
place_holders[i].SetName(model.Name + "_" + str(i)) | |
model.Delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment