Getting instance from host intersecting object in linked file

Hi all,

I am trying to write a script which can search for intersections and when found, parameter in instance (host) needs to be filled with info from the linked file object.
The instances in host are unhosted (so not face based for example).

I set up a little project to work this out (see below).

  • blue is the linked file;
  • one instance in space (ID=83797)
  • one instance in wall of linked file (ID=84288)
  • the wall containing instance (ID=663387)

This is my script:

How do I get only my wall-ID (663387) and my instance-ID (84288)? Instead of both instances.

Hope I made my self clear about this issue.

Hi @Bogey

Try one of these approaches:

Basically, if the element in hosted in the wall then the final result will be the element and the wall grouped in a list.

Situation:
1

Result:

Or:

elems = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]

result = []

for el in elems:
	if hasattr(el,"Host"):
		if not el.Host == None:
			result.append([])
			result[-1].append(el)
			result[-1].append(el.Host)
		else:
			continue

OUT = result