Good tip! Thanks Nic.

On Wed, Aug 1, 2012 at 4:07 AM, Nic Groot Bluemink <
[email protected]> wrote:

> Neat, thanks for the share Alan!
>
> A little suggestion - personally I like using the OpenUndo/CloseUndo with
> a try-except structure like so:
>
> xsi = Application
>
> xsi.OpenUndo("somefunction")
> try:
>     dostuff
> except:
>     pass
> finally:
>     xsi.CloseUndo()
>
>
> This way, any errors that may occur while doing stuff will always be
> undoable. Of course, you can handle your exceptions more cleanly than in my
> crude example :p
>
> -Nic
>
>
> On Tue, Jul 31, 2012 at 4:04 PM, Alan Fregtman <[email protected]>wrote:
>
>> 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"
>>>>
>>>
>>>
>>
>
>
> --
> Technical Pretty Picture Making Person
> Kettle <http://www.kettlestudio.co.uk/>
>

Reply via email to