Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Make Reference

Make Reference

GeoffKornfeld
Advocate Advocate
518 Views
2 Replies
Message 1 of 3

Make Reference

GeoffKornfeld
Advocate
Advocate

Just wondering what I can type to turn a couple hundred selected instances in to references. The listener doesn't seem to record that action. Thanks.

0 Likes
519 Views
2 Replies
Replies (2)
Message 2 of 3

mbreathes
Participant
Participant

fn InstToRef instArray =
(
instancemgr.makeobjectsunique instArray #individual
tmpNode = copy instArray[1]
referencereplace instArray tmpNode
delete tmpNode
)

 

myArray = selection as array

InstToRef myArray

 

 

 

0 Likes
Message 3 of 3

mbreathes
Participant
Participant

There's an unexpected issue when the code above is run.

If the instances have a modifier stack, Max will duplicate those modifiers on top of the reference.

Here's an update to that code that works around it.

I'm not certain if there is a more elegant solution, but this gets the job done.

 

(
theMods = #()
myArray = #()

fn InstToRef instArray =
(
instancemgr.makeobjectsunique instArray #individual
tmpNode = copy instArray[1]
referencereplace instArray tmpNode
for i in 1 to theMods.count do
(
addModifier tmpNode theMods[i]
)
delete tmpNode
)

myArray = selection as array

for i = myArray[1].modifiers.count to 1 by -1 do
(
append theMods myArray[1].modifiers[i]
deleteModifier myArray[1] i
)

InstToRef myArray
)

 

 

 

0 Likes