Evgeniy Zaitsev Technical Artist


Houdini: roundcorners python node

This python node allows user to get equivalent of mia_roundcorners in Houdini.
Download : roundcorners_example
Download : roundcorners_digitalAsset

Python code for getting bevelEdgesGrp:

import math
import hou

m_node = hou.pwd()
m_geo = m_node.geometry()

m_dotAngle = hou.hmath.degToRad( m_node.parm("mAngle").eval() )
m_dotAngle = -1 * math.cos( m_dotAngle )

def computeEdge( m_edge ):
    if len(m_edge.prims()) < 2 : return 1
    m_n0 = m_edge.prims()[0].normal() 
    m_n1 = m_edge.prims()[1].normal() 
    m_dot = m_n0.dot(m_n1)
    return m_dot

def getEdgeGrp():
    for m_grp in m_geo.edgeGroups():
        if 'bevelEdgesGrp' == m_grp.name():
            return m_grp
    return None

def updateBevelEdgeGrp():
    m_egdegrp = getEdgeGrp()
    if m_egdegrp: m_egdegrp.clear()
    else:  return
    m_prims = m_geo.prims()
    for m_prim in m_prims:
        m_edges = m_prim.edges()
        for m_edge in m_prim.edges():
            if( computeEdge( m_edge ) < m_dotAngle ):
                if m_egdegrp:
                    if not m_egdegrp.contains( m_edge ):
                        #print( m_edge.edgeId() )
Filed under: Houdini Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.