Get the Xref object node sceneName instead of sourceName

Get the Xref object node sceneName instead of sourceName

bertv
Enthusiast Enthusiast
655 Views
4 Replies
Message 1 of 5

Get the Xref object node sceneName instead of sourceName

bertv
Enthusiast
Enthusiast

Hello,

 

I am creating a script using Xref objects.

 

In my scene I recorded an Xref object group with 4 primitives and made a duplicate of the object node.

So 2 group of 4 primitives are shown in the xref objects dialog

objects_002.jpg

 

When I iterate over all my Xref object nodes, in code, I want to use the scene name instead of the source name.

Because this scenename contains unique names and the sourcename references to the actual source data.

But using objectsname keeps giving the sourceName 😞

 

This is my code

RecordObjects = objXRefs.getAllXRefObjects()

for i = 1 to RecordObjects.count do
(	
	print RecordObjects[i].objectname
)

After looking in the API under Xref object node I couldn't find a proper method

http://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=GUID-8B7E81F0-AC81-4518-8D8E-B0C9C6717645

 

 

Any help would be appreciated

 

Regards

Bert

0 Likes
656 Views
4 Replies
Replies (4)
Message 2 of 5

miauuuu
Collaborator
Collaborator
for o in objects where classOf o == XRefobject do print o.name
https://miauu-maxscript.com/
0 Likes
Message 3 of 5

bertv
Enthusiast
Enthusiast

Omg miauuuu,

 

Thanks, works perfectly

0 Likes
Message 4 of 5

michaelsonbritt
Advocate
Advocate

The .objectname property is specific to XRefObject, and indicates the source name.

The .name property is more general, it's property which applies to all objects, not only xref object, and indicates the object name in the current scene.  In this case it's the more general property which you want.

To see the basic XRefObject properties on the selected object (assuming it is an xref), do this in MaxScript:
show $

 

To see some extended XRef properties and functions on the object, do this in MaxScript:
showinterfaces $

 

Some properties can return other interfaces, which you can again inspect using showinterfaces.

 

Cheers,

Michaelson Britt

0 Likes
Message 5 of 5

bertv
Enthusiast
Enthusiast

Nice,

 

show $ and showinterfaces $ are like code hinting.

Very useful

 

Regards

Bertv