Ah perfect, Thanks!
Not sure how I missed that one. I was digging through commands and must have overlooked those Properties. Thank you, -James From: [email protected] [mailto:[email protected]] On Behalf Of Steven Caron Sent: Tuesday, June 18, 2013 3:10 PM To: [email protected] Subject: Re: Inspecting ICE node connections from Python oh right, you want 'ConnectedPorts' and 'ConnectedNodes' property of an ICENodePort class. this example isn't a proper step through the graph but it shows you what you want... i think :) from siutils import si si = si() # win32com.client.Dispatch('XSI.Application') from siutils import log # LogMessage from siutils import disp # win32com.client.Dispatch from siutils import C # win32com.client.constants for op in si.Selection(0).ActivePrimitive.ConstructionHistory: if op.Type == "ICETree": ICETree = op # output port direction log("output ports") for node in op.Nodes: for port in node.OutputPorts: for connectedPort,connectedNode in zip(port.ConnectedPorts, port.ConnectedNodes): log("%s.%s -> %s.%s" % (node.Name, port.Name, connectedNode.Name, connectedPort.Name)) # input port direction log("input ports") for node in op.Nodes: for port in node.InputPorts: for connectedPort,connectedNode in zip(port.ConnectedPorts, port.ConnectedNodes): log("%s.%s -> %s.%s" % (node.Name, port.Name, connectedNode.Name, connectedPort.Name)) On Tue, Jun 18, 2013 at 11:43 AM, James Vecore <[email protected]> wrote: Thanks for the reply Steve. I should have been more specific in my question. IsConnect does tell if the port is connected and I had picked that up from the docs, but I don't see a way to traverse backwards to the icenode that is feeding an input node. For example, lets say I have a GetData node (Node A) and a custom ICECompound (Node B). Node A is connected to an known input port in Node B. So if I have a reference to Node B and the input port I'm interested in, how could find out that Node A is what is connected to that port? If you take the inputPort.Value you will get None if the value is a complex type (and the docs say these are not supported). The docs reference using ICENodePort.Parameters for types that are not supported by ICENodeInputPort.Value. However, inputPort.Parameters.Count == 0 and enumerating over it gives: # WARNING : 3407 - Values cannot be accessed on connected ports: <Port: input_null> I also searched all the commands with "ICE" in them and didn't see anything that makes sense for my scenario. Any Ideas? -James From: [email protected] [mailto:[email protected]] On Behalf Of Steven Caron Sent: Tuesday, June 18, 2013 2:19 PM To: [email protected] Subject: Re: Inspecting ICE node connections from Python you want the ICENodePort class... http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index. html?url=si_om/ICENodePort.html,topicNumber=si_om_ICENodePort_html example code... from siutils import si si = si() # win32com.client.Dispatch('XSI.Application') from siutils import log # LogMessage from siutils import disp # win32com.client.Dispatch from siutils import C # win32com.client.constants for op in si.Selection(0).ActivePrimitive.ConstructionHistory: if op.Type == "ICETree": ICETree = op lastPort = list(ICETree.InputPorts)[-1] if lastPort.IsConnected: si.AddPortToICENode( lastPort, "siNodePortDataInsertionLocationAfter" ) lastPort = list(ICETree.InputPorts)[-1] log(lastPort.Name) On Tue, Jun 18, 2013 at 11:10 AM, James Vecore <[email protected]> wrote: I'm looking for a way to inspect the connections between ice nodes from Python. I'm trying to write a tool that will generate and update an ice graph on demand based on some parameters. I need to be able to inspect an existing ice graph and most importantly the connections between nodes in the ICE graph. I can't seem to find how to do this in the docs. All I see related to node connections is ConnectICENode. Ideally I would like something like this AreICENodesConnected(outputPort, inputPort) or a way to enumerate connections but I don't see anything available. Am I missing something or is this just not possible from the Scripting API? Thanks, -James James Vecore | Pluto | A Creative Content Place | hellopluto.com <http://hellopluto.com/> | 248.723.3333 | 586.295.9473 mobile

