Exemple #1
0
def connector_join():
    remote = mmRemote();
    remote.connect();

    # accept outstanding tools, if there are any
    mm.accept_tool(remote)

    [found,id1] = mm.find_object_by_name(remote,'socket')
    [found,id2] = mm.find_object_by_name(remote,"connector")
    mm.select_objects(remote,[id1,id2])



    # combine part with socket
    mm.begin_tool(remote, "combine")

    # select-all and do join # [TODO] support select-boundary-loops in API
    mm.select_all(remote)
    mm.begin_tool(remote, "join")
    mm.accept_tool(remote)


    [foundconnector,id1] = mm.find_object_by_name(remote,'connector')
    ## we need to rename the connector back to socket
    if foundconnector:
        cmd  = mmapi.StoredCommands()
        cmd.AppendSceneCommand_SetObjectName(id1,'socket')
        remote.runCommand(cmd)

    ## [RMS] this block will clean up holes, but requires ability to save & restore selection!
    ##   [TODO] we can do this now, because we can read back facegroup after createFaceGroup...
    #if False:
    #    # save selection
    #    mm.begin_tool(remote, "createFaceGroup")
    #    mm.clear_face_selection(remote)

    #    # do repair pass, in case join created holes (happens!)
    #    mm.begin_tool(remote, "inspector")
    #    mm.tool_utility_command(remote, "repairAll")

    #    # [TODO] restore selection


    ## expand selection a few times, then remesh
    #if True:
    #    for x in range(0,8):
    #        mm.selection_utility_command(remote, "expandByOneRing")

    #    mm.begin_tool(remote, "remesh")
    #    mm.accept_tool(remote)
    #    mm.begin_tool(remote, "smooth")
    #    mm.set_toolparam(remote, "scale", 500.0)
    #    mm.accept_tool(remote)

    #mm.clear_face_selection(remote)

    remote.shutdown()
Exemple #2
0
def connector_join():
    remote = mmRemote();
    remote.connect();

    # accept outstanding tools, if there are any
    mm.accept_tool(remote)

    [found,id1] = mm.find_object_by_name(remote,SocketName())
    [found,id2] = mm.find_object_by_name(remote,ConnectorName())
    mm.select_objects(remote,[id1,id2])



    # combine part with socket
    mm.begin_tool(remote, "combine")

    # select-all and do join # [TODO] support select-boundary-loops in API
    mm.select_all(remote)
    mm.begin_tool(remote, "join")
    mm.accept_tool(remote)

    # [RMS] this block will clean up holes, but requires ability to save & restore selection!
    #   [TODO] we can do this now, because we can read back facegroup after createFaceGroup...
    if False:
        # save selection
        mm.begin_tool(remote, "createFaceGroup")
        mm.clear_face_selection(remote)

        # do repair pass, in case join created holes (happens!)
        mm.begin_tool(remote, "inspector")
        mm.tool_utility_command(remote, "repairAll")

        # [TODO] restore selection


    # expand selection a few times, then remesh
    if True:
        for x in range(0,8):
            mm.selection_utility_command(remote, "expandByOneRing")

        mm.begin_tool(remote, "remesh")
        mm.accept_tool(remote)
        mm.begin_tool(remote, "smooth")
        mm.set_toolparam(remote, "scale", 500.0)
        mm.accept_tool(remote)

    mm.clear_face_selection(remote)

    remote.shutdown()
Exemple #3
0
def selectObjectsByName(remote, name_list):
    objects = []
    for name in name_list:
        (found, objid) = mm.find_object_by_name(remote, name)
        if found:
            objects.append(objid)
    mm.select_objects(remote, objects)
def selectObjectsByName(remote, name_list):
    objects = []
    for name in name_list:
        (found, objid) = mm.find_object_by_name(remote, name)
        if found:
            objects.append(objid)
    mm.select_objects(remote, objects)
Exemple #5
0
def selectObjectByName(remote, name):
    (found, objid) = mm.find_object_by_name(remote, name)
    if found:
        mm.select_objects(remote, [objid])
    return found
def selectObjectByName(remote, name):
    (found, objid) = mm.find_object_by_name(remote, name)
    if found:
        mm.select_objects(remote, [objid])
    return found