magneto Posted September 9, 2014 Share Posted September 9, 2014 Hi, If you have an edge group that combines multiple edges like this, i.e. p29-20: How can you expand this edge group so that you can get the full list of edges? Using geo.globEdges shows an edge of (<hou.Edge #29 - 20 of geometry in /obj/grid>), which doesn't exist. Is there a way to expand this edge group? Thanks. Quote Link to comment Share on other sites More sharing options...
pezetko Posted September 9, 2014 Share Posted September 9, 2014 (edited) Does this help? http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=19493 Edited September 9, 2014 by pezetko Quote Link to comment Share on other sites More sharing options...
magneto Posted September 9, 2014 Author Share Posted September 9, 2014 Thanks pezetko, I checked it out but there is no edgelist expression I can use in Houdini. Or am I missing something? Quote Link to comment Share on other sites More sharing options...
pezetko Posted September 9, 2014 Share Posted September 9, 2014 In python: import hou def test_geo(): # init test n = hou.node('/obj').createNode('geo', run_init_scripts=False) n.moveToGoodPosition() g = n.createNode('grid') grp = n.createNode('group') grp.parm('entity').set(2) grp.parm('pattern').set('p5-6-7-8-9 p5-4') grp.setFirstInput(g) grp.moveToGoodPosition() grp.setDisplayFlag(True) grp.setRenderFlag(True) grp.setCurrent(True, clear_all_selected=True) test_geo() #prepare geometry for testing edge_group_points = [] edge_group_pairs = [] for oNode in hou.selectedNodes(): geo = oNode.geometry() for edgeGroup in geo.edgeGroups(): #iterate over existing edge groups #print edgeGroup.edges() print geo.globEdges(edgeGroup.name()) #same with globEdges for edge in edgeGroup.edges(): #iterate over edges in groups #print edge points = edge.points() # get points of each edge point_numbers = map(hou.Point.number, points) point_list_string = map(str, point_numbers) #print points #print point_numbers #print point_list_string edge_group_pairs.append(point_numbers) for pnt in point_numbers: edge_group_points.append(pnt) print edge_group_pairs # list of int print edge_group_points # string edge_group_points_string = map(str, edge_group_points) print ', '.join(edge_group_points_string) #string (list) of unique points edge_group_points_string = set(map(str, edge_group_points)) print ', '.join(edge_group_points_string) 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 10, 2014 Author Share Posted September 10, 2014 Thanks pezetko. It works. Do you know if there is a way to do this without having an existing group? Because I have a group parameter and if the user types, a group like in my post, then geo.globEdges("p29-20").edges() doesn't work. If not, I will try to create a new group using this parameter, but it would be nice if I can get the edges without doing this as I have to delete the group afterwards, etc. Quote Link to comment Share on other sites More sharing options...
pezetko Posted September 10, 2014 Share Posted September 10, 2014 (edited) Actually it works, but it needs correct input. If you create Group sop and type into Pattern parameter p29-20 you get only one edge in this group (between points 29 and 20) if that edge doesn't exists on the mesh then globEdge("p29-20") returns empty list.If you create edge selection in viewport and then in viewport you create group sop you get pattern something like this: p29-28-27-26-25-24-23-21-20 (so you get all edges between these points) So you just need sanitize your (or user) input. One way is using group sop.For processing interactive selection in viewport look at this https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=139675#139675 and just change globPoints to globEdgesFor processing user input that is typed manually you need your own parser, that checks if p29-20 edge exists and if not then expand that string to the string of existing edges (p29-28-27-26-25-24-23-21-20). Edited September 10, 2014 by pezetko 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 10, 2014 Author Share Posted September 10, 2014 Thanks pezetko, it makes sense. Manually expanding will be too much work I think. I see like you said the Group SOP shows only 1 edge. Since Houdini distinguishes this internally, it would be nice to have a python function to expand these kinds of selections. 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.