Notifications
Clear all

[Closed] creating xrefs in maxscript

Hey guys,

I haven’t made anything in maxscript for a while and im trying to create a new xref object based on a file in a subdirectory, but i just cant get that function working.

the help file doesn’t have any examples of how to use it and i was wondering if anyone could post an example of how to use it?

hers what i have so far –

filename = “D:\work\research\place houses\01.max”
objectname = “test”
New_Object = xrefs.addNewXrefobject filename objectname

ps i wish autodesk would include working examples of every sript. another language i use called max/msp by cycling 74 is fatastic like that. all you have you do is right click on the function and it brings up a working example of the script. its the best way to learn!

3 Replies

Works just as expected.

You have to make sure that you know the name of the object in the scene you are xrefing.

For instance:

Say I have a scene saved that has a box named “XRefObj”.

The path to the file is “c:\ est\XrefTest.max”

The following code will work.


theXrefBox = xrefs.addNewXrefObject "c:\	est\\XrefTest.max" "XrefObj"

That might help.

-Dave

ahh right! thanks heaps. i was wanting to just import all objects from that xref file, (without it being a scene xref). im thinking the only way to do that would be to inspect the file with a script then, and return a list of all objects, and feed that to the xref creation script.

or maybe i could just group them all in the file and import the group, if that works, not sure.

btw, to get all the names of objects in a maxfile which isn’t loaded you can use this command:

myNewObjs = getMAXFileObjectNames "c:\	est.max"
Maybe that helps you.
cheers
Ulrich