Another look at IsElement problems


I’ve had some problems with IsElement lately, so I took another look at how to work around problems with IsElement, especially when you’re using it with ICE topology. Also, a quick look under the covers at the connections in the construction stack (aka operator history).

Here’s the script I was using to print the connection stack info:

#
# This script works in 2013 SP1 only because it uses sipyutils 
#
from sipyutils import si			# win32com.client.Dispatch('XSI.Application')
from sipyutils import siut		# win32com.client.Dispatch('XSI.Utils')
from sipyutils import siui		# win32com.client.Dispatch('XSI.UIToolkit')
from sipyutils import simath	# win32com.client.Dispatch('XSI.Math')
from sipyutils import log		# LogMessage
from sipyutils import disp		# win32com.client.Dispatch
from sipyutils import C			# win32com.client.constants

si=si()
siut =siut()

sisel = si.Selection


from xml.etree import ElementTree as ET

prim = sisel(0).ActivePrimitive if si.ClassName(sisel(0)) ==  'X3DObject' else sisel(0)


stackInfo = siut.DataRepository.GetConnectionStackInfo( prim )
#log( stackInfo )
connections = ET.XML(stackInfo)
currentMarker =''

print "Connections for %s" % prim.FullName
for connection in connections:
		o = connection.find('object').text
		if o == currentMarker:
			continue
	
		if o.endswith('marker'):
			currentMarker = o
			
		print "%s (%s)" % (connection.find('object').text, connection.find('type').text)