Notifications
Clear all

[Closed] Custom Attributes on XRef Scenes

i’m trying to assign custom attributes to xref scenes which I can do BUT each def is not unique… I tried searched the forum and found this thread but it doesn’t seem to work for xrefs.
Here’s my example code:

(
  for i = 1 to (xrefs.getXRefFileCount()) do
  (
  	caExe  = "attributes controls
"
  	caExe += "(
"
  	caExe += "	parameters xrefParams
"
  	caExe += "	(
"
  	caExe += "		param1 type:#float
"
  	caExe += "		param2 type:#float
"
  	caExe += "	)
"
  	caExe +=")
"
  	
  	ca = execute caExe
  	
  	x = xrefs.getXRefFile i
  	
  	custAttributes.add x ca
  	custAttributes.makeUnique x ca
  )
 -- i have 2 xrefs in my test scene
 for i = 1 to (xrefs.getXRefFileCount()) do (xrefs.getXRefFile i).param1 = random 1 100
 for i = 1 to (xrefs.getXRefFileCount()) do print (xrefs.getXRefFile i).finger_bend
  )

I’m using 2009 design x64 with service pack 1

4 Replies

can someone at least confirm this please.

Also assigning a custom attribute to the rootNode appears to assign it to any xrefs as well.

Yup… they react different…

(
 caExe  = "attributes controls
 (
 	parameters xrefParams
 		(
 		param1 type:#float
 		param2 type:#float
 		)
 )
"
 ca = (execute caExe)
 
 for i = 1 to (xrefs.getXRefFileCount()) do
   (
 	  x = xrefs.getXRefFile i
 	x.parent = Box()
 	  custAttributes.add x ca
 	  custAttributes.add x.parent ca	
 	  custAttributes.makeUnique x ca baseObject:true
 	  custAttributes.makeUnique x.parent ca baseObject:true
   )
 -- i have 2 xrefs in my test scene
 for i = 1 to (xrefs.getXRefFileCount()) do
 	 (
 	(xrefs.getXRefFile i).param1 = i*10
 	(xrefs.getXRefFile i).parent.param1 = i*10
 	)
 for i = 1 to (xrefs.getXRefFileCount()) do
 	(
 	print ("Xref:"+(xrefs.getXRefFile i).param1 as string)
 	print ("Parent:"+(xrefs.getXRefFile i).parent.param1 as string)
 	)
 )

result:

“Xref:20.0”
“Parent:10.0”
“Xref:20.0”
“Parent:20.0”

thanks for confirming. It’s a PITA but i guess I’ll have to store my data on a hidden dummy object unless anyone has any suggestions?

yeah, it’s where I’ve got mine… a dummy on the Xref .parent, which is the “binding” item in the Xref scene dialog.