Esempio n. 1
0
def main():
    """Main
    """
    session = ph.HSessionManager.get_or_create_default_session()

    #create an inputnode where you can set geometry
    geo_inputnode = ph.HInputNode(session, "Cube")

    #create a geomesh
    cube_geo = ph.HGeoMesh(
        vertices=np.array(
            [[0.0, 0.0, 0.0],
             [0.0, 0.0, 1.0],
             [0.0, 1.0, 0.0],
             [0.0, 1.0, 1.0],
             [1.0, 0.0, 0.0],
             [1.0, 0.0, 1.0],
             [1.0, 1.0, 0.0],
             [1.0, 1.0, 1.0]], dtype=np.float32),
        faces=np.array(
            [[0, 2, 6, 4],
             [2, 3, 7, 6],
             [2, 0, 1, 3],
             [1, 5, 7, 3],
             [5, 4, 6, 7],
             [0, 4, 5, 1]], dtype=np.int32))

    #set this geomesh as geometry of inputnode
    geo_inputnode.set_geometry(cube_geo)

    #create a node whose input is inputnode
    ph.HNode(session, "Sop/subdivide", "Cube Subdivider").connect_node_input(geo_inputnode)

    session.save_hip()
Esempio n. 2
0
def test_connect_nodes(init_session):
    """Test connect nodes
    """
    geo_inputnode = ph.HInputNode(init_session, "Cube")
    subdnode = ph.HNode(init_session, "Sop/subdivide", "Cube Subdivider").\
        connect_node_input(geo_inputnode)
    assert subdnode is not None
Esempio n. 3
0
def test_create_input_node_and_set_curve(init_session):
    """Create input node and marshall in curve
    """
    geo_inputnode = ph.HInputNode(init_session, "Curve")
    curve_geo = ph.HGeoCurve(
        vertices=np.array([[-4.0, 0.0, 4.0], [-4.0, 0.0, -4.0],
                           [4.0, 0.0, -4.0], [4.0, 0.0, 4.0]],
                          dtype=np.float32),
        curve_knots=np.array([0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
                             dtype=np.float32),
        curve_type=ph.CurveType.NURBS)
    geo_inputnode.set_geometry(curve_geo)
    assert geo_inputnode is not None
Esempio n. 4
0
def test_create_input_node_and_set_mesh(init_session):
    """Create input node and marshall in mesh
    """
    geo_inputnode = ph.HInputNode(init_session, "Cube")
    cube_geo = ph.HGeoMesh(vertices=np.array(
        [[0.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, 1.0, 1.0],
         [1.0, 0.0, 0.0], [1.0, 0.0, 1.0], [1.0, 1.0, 0.0], [1.0, 1.0, 1.0]],
        dtype=np.float32),
                           faces=np.array(
                               [[0, 2, 6, 4], [2, 3, 7, 6], [2, 0, 1, 3],
                                [1, 5, 7, 3], [5, 4, 6, 7], [0, 4, 5, 1]],
                               dtype=np.int32))
    geo_inputnode.set_geometry(cube_geo)
    assert geo_inputnode is not None
Esempio n. 5
0
def main():
    """Main
    """
    session = ph.HSessionManager.get_or_create_default_session()

    #create an inputnode where you can set geometry
    geo_inputnode = ph.HInputNode(session, "Curve")

    #create a geocurve
    curve_geo = ph.HGeoCurve(
        vertices=np.array([[-4.0, 0.0, 4.0], [-4.0, 0.0, -4.0],
                           [4.0, 0.0, -4.0], [4.0, 0.0, 4.0]],
                          dtype=np.float32),
        curve_knots=np.array([0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
                             dtype=np.float32),
        curve_type=ph.CurveType.NURBS)

    #set this geocurve as geometry of inputnode
    geo_inputnode.set_geometry(curve_geo)

    session.save_hip()