Hmmm, last second improvement: this one's got OpenUndo and CloseUndo to
pack all the actions into one undo step...

xsi = Application
def capMeshHoles(mesh, freezeModeling = True):
    '''    Caps holes in given mesh.    '''
    originalSelection = xsi.Selection.GetAsText()
    boundaryEdges = [ e for e in mesh.ActivePrimitive.Geometry.Edges
if e.IsBoundary ]

    xsi.OpenUndo("Cap holes in %s" % mesh.FullName)
    if len(boundaryEdges) > 0:
        xsi.SelectGeometryComponents(boundaryEdges)
        oSel = xsi.Selection(0)
        xsi.DuplicateMeshComponent(oSel)
        xsi.SelectAdjacent(oSel, "Point")
        xsi.ApplyTopoOp("Collapse", oSel)
        oSel = xsi.SetSelFilter("Vertex")
        xsi.ApplyTopoOp("Collapse", oSel)
        if freezeModeling:
            xsi.FreezeModeling(mesh)
        xsi.Selection.SetAsText( originalSelection )
    xsi.CloseUndo()

    return mesh
# --------------------------------
capMeshHoles(xsi.Selection(0))


On Tue, Jul 31, 2012 at 11:01 AM, Alan Fregtman <[email protected]>wrote:

> I have made my own Python function since creating this thread long ago. In
> the interest of sharing:
>
>
> xsi = Application
> def capMeshHoles(mesh, freezeModeling = True):
>     '''    Caps holes in given mesh.    '''
>     originalSelection = xsi.Selection.GetAsText()
>     boundaryEdges = [ e for e in mesh.ActivePrimitive.Geometry.Edges if 
> e.IsBoundary ]
>
>     if len(boundaryEdges) > 0:
>         xsi.SelectGeometryComponents(boundaryEdges)
>         oSel = xsi.Selection(0)
>         xsi.DuplicateMeshComponent(oSel)
>         xsi.SelectAdjacent(oSel, "Point")
>         xsi.ApplyTopoOp("Collapse", oSel)
>         oSel = xsi.SetSelFilter("Vertex")
>         xsi.ApplyTopoOp("Collapse", oSel)
>         if freezeModeling:
>             xsi.FreezeModeling(mesh)
>         xsi.Selection.SetAsText( originalSelection )
>
>     return mesh
> # --------------------------------
> capMeshHoles(xsi.Selection(0))
>
>
>
> On Tue, Jul 31, 2012 at 10:46 AM, Malcolm Zaloon <[email protected]>wrote:
>
>> Hi Oleg!
>>
>> I´m wondering if can you provide the download link again for modified
>> "cap hole" compound?
>> the old link is broken...(404 file not found)
>>
>> Thanks in advance! :)
>>
>>
>> On Mon, Feb 13, 2012 at 1:47 PM, Oleg Bliznuk <[email protected]> wrote:
>>
>>> Hi Alan,
>>> you can also do it with a little bit modified "cap holes" compound via
>>> ICE, we are using it in ImplosiaFX
>>> http://clip2net.com/s/1ABrt
>>> -Oleg
>>>
>>
>>
>>
>> --
>> __________________
>> Malcolm Zaloon - Lighting TD - XSI Generalist
>> Quote:
>> "Everything can be interconnected and will update according by interface"
>>
>
>

Reply via email to