Notifications
Clear all

[Closed] Replacing Objects

Spot on! Thank you very much Denis

Sorry if this question seems stupid with all the information received so far,
if I wanted to do the same as above with a few objects but instead of simpling merging and replacing what if I replaced the object with an xref?

i’ve tried the following with the resulting xref being placed at 0,0,0

xrefs.addNewXRefObject file #(name) #proxy #merge #merge #useMergedMtlDups quiet:on

Any ideas, or should I be writing a different looking function specifically for the xrefs?

Thank you in advance!

EDIT:
I’ve realized I had an issue with my xref object code as it is – in that I wasn’t specifying an object or node to xref. so I have the done just fine however I can’t get rid of the duplicate material popup which sucks nor can I figure out any way to move/rotate each xref to the original objects location. I’ve got it to the point where I can get the correct number of xrefs but just can’t figure out how to manipulate each one. Any ideas?

EDIT2: I have figured out how to do what I want… I think. Everything seems to be ok, still the issue of the popup for duplicate materials so if anyone has an idea about that I’d love to hear it. anywho, my code for it.


xrefs.addNewXRefObject "C:\\Users\\ahosking\\Desktop\\13 - Furniture Catalogue 2.0\\Rendering Furniture\\2x2 Reception Table.max" "2x2 Reception Table" #xref #xref #useMergedMtlDups quiet:on
for o in originalA do (
i = instance $'xref furniture' pos: o.pos
delete o
)

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

if you are working with max 2010 you can call xrefs.addNewXRefObject with dupMtlNameAction:#useXRefed option (see MXS help XRefObject : Node)

with this option the function will not pop up material replace dialog.

if your max’s version is lower then max 2010 you can use objXRefMgr.AddXRefItemsFromFile with option xrefOptions:#(#mergeMaterials)
(see MXS help Interface: objXRefMgr)

to set origin transforms
you can use[color=Yellow] instanceReplace [color=Yellow]the same way as in my previous sample for the merged object[/color][/color]

Ah Denis, thank you once again!
Your knowledge is fantastic. I’ve scoured that damn MaxScript reference and didn’t ever come upon objxrefmgr so thank you for that. Things make a whole lot more sense for xref management now.
Thanks a tonne!

Page 2 / 2