Librarian Posted September 23, 2020 Share Posted September 23, 2020 (edited) Have Fun.. thanx + @t_hasegawa Twitter file +read In second example make attributes like in first ..it works For me https://github.com/d3/d3-force https://observablehq.com/@d3/force-directed-tree ForceDirectedGraph_v002t03(1).hipnc Edited September 23, 2020 by Librarian Quote Link to comment Share on other sites More sharing options...
animatrix Posted September 24, 2020 Share Posted September 24, 2020 You can use this to layout your nodes in the network editor Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 24, 2020 Author Share Posted September 24, 2020 Yunus How to ? Point me to Right Direction when you have Time .... If You Have Said A, You Must Also Say B ... geonode = hou.node('/obj/geo') # geometry geonode.deleteItems(geonode.children()) # merge = geonode.createNode("merge") # merge merge.setPosition(hou.Vector2(1,-2)) # box nodes = [] posarray = [(0,0),(0,2),(2,2),(2,0)] # for i in xrange(4): nodes.append(geonode.createNode("box")) # box nodes[i].setPosition(hou.Vector2(posarray[i])) merge.setInput(i,nodes[i]) # box # posarray posarray2 = posarray[:] posarray2.append(posarray2[0]) posarray2.pop(0) anival = [] # for i in xrange(4): # anival.append( hou.NetworkAnimValue( 4.0, nodes[i].position(), hou.Vector2(posarray2[i]))) ne.setVisibleBounds(hou.BoundingRect(-3,-3,6,3),0.5) ne.setAdjustments(nodes, anival, auto_remove=True) # # ref) http://www.sidefx.com/docs/houdini/hom/hou/NetworkAnimValue.html for i in xrange(4): nodes[i].setPosition(hou.Vector2(posarray2[i])) Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 24, 2020 Author Share Posted September 24, 2020 I Found I think https://vimeo.com/240230247 1 Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 24, 2020 Author Share Posted September 24, 2020 @animatrix When you Have Time Please.. I followed ...here its Code ..I download Again 16.5 Houdini...syntax error /Don't 'see ....Don't Understand-- Nada ...Maybe Typo IndentationError: ('unexpected indent', ('Sc', 34, 1, ' for point in wrangle.geometry().points():\n')) import toolutils #Ask user to select source geometry sViewer = toolutils.sceneViewer() selected_object = sViewer.selectObjects('Select geometry to copy nodes to', allowed_types=("geo",), allow_multisel=0) source = selected_object[0] #Create folder in which new animated nodes will be contained root = hou.node('/obj') folder = root.createNode('geo', 'Moving_Nodes') folder.moveToGoodPosition() # Delete default file node from the new folder for nodes in folder.children(): nodes.destroy() #Find a node with Display Flag on for child in source.children(): if child.isDisplayFlagSet() == 1: geo = child #Create a new wrangle node which sets Id and Color point attributes to source geo wrangle = source.createNode('attribwrangle') wrangle.parm('snippet').set("""i@id = @ptnum; @Cd = fit01(@P, 0.5, 1);""") wrangle.moveToGoodPosition() wrangle.setInput(0, geo) wrangle.setDisplayFlag(1) wrangle.setRenderFlag(1) # Create a new Null node on for every point and copy X and Y coordinates from P point attribute to every new Null # Create a new Index parameter on each Null which corresponds to its "parent" point for point in wrangle.geometry().points(): node_Xpos = point.attribValue('P')[0]*6 node_Ypos = point.attribValue('P')[1]*6 new_node = folder.createNode('null') parms = new_node.parmTemplateGroup() parms.addParmTemplate(hou.IntParmTemplate("index", "Index", 1)) new_node.setParmTemplateGroup(parms) new_node.parm('index').set(point.attribValue('id')) new_node.setPosition((node_Xpos, node_Ypos)) # Create a new Python SOP in the source folder with a code which transfers a position from points to the corresponding Nulls on every frame python = source.createNode('python') python.parm('python').set("""node = hou.pwd() geo = node.geometry() root = hou.node('/obj/Moving_Nodes') for point in geo.points(): node_Xpos = point.attribValue('P')[0]*6 node_Ypos = point.attribValue('P')[1]*6 node_color= point.attribValue('Cd') for child in root.children(): if child.parm('index').eval() == point.attribValue('id'): child.setPosition((node_Xpos, node_Ypos)) child.setColor(hou.Color(node_color))""") python.setDisplayFlag(1) python.setRenderFlag(1) python.moveToGoodPosition() python.setInput(0, wrangle) Quote Link to comment Share on other sites More sharing options...
anim Posted September 24, 2020 Share Posted September 24, 2020 the indent is off on that line just erase the space in front of 'for' on the mentioned line Quote Link to comment Share on other sites More sharing options...
Librarian Posted September 24, 2020 Author Share Posted September 24, 2020 @anim Thanx It works Yessssss ...OO I have Fun Quote Link to comment Share on other sites More sharing options...
animatrix Posted September 25, 2020 Share Posted September 25, 2020 7 hours ago, Librarian said: @anim Thanx It works Yessssss ...OO I have Fun Yes that happens when you copy paste code and even Sublime seems to mess up indents sometimes especially if you don't edit the code in Python syntax. But my idea was to model your network using the OpenCL force directed graph, solve it using the OpenCL SOP in the BG, and then copy the positions in animated form Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.