Re: A good Cap All Holes script?

2012-08-01 Thread Nic Groot Bluemink
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 alan.fregt...@gmail.comwrote:

 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 
 alan.fregt...@gmail.comwrote:

 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 mzalo...@gmail.comwrote:

 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 gbo...@gmail.com 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/


Re: A good Cap All Holes script?

2012-08-01 Thread Stefan Kubicek

Are the difficult scenarios you mention not ultimately a non-manifold geometry 
problem?
This reminds me on the Any tips to fix non-manifold vertices in Soft? thread 
as of June 26th.

We came up with:

A vertex is non-manifold if more than two of its adjacent edges
do not share their second vertex with any other of said adjacent edge's second 
vertices.

Or as Martin Chatterjee put it slightly differently:

I'd check if a vertex has a neighborPolygon that does *not *share an edge with 
any of the
other neighborPolygons

According to this it should be possible to identify problematic vertices and split the 
capping process up on a per island basis.





Back several years ago I spent quite a bit of time trying to develop a
Fill Hole script similar to Maya's. Beware this activity when using
something automated.

I ran into immense difficulty trying to develop a method for sealing
winged holes. In general holes which are an island upon themselves are
easy to fill. That means that if a quad hole has an adjacent  poly
present at each  edge and more importantly each vertex, totalling 8
polys surrounding the quad hole, the hole is extremely easy to fill. I
succeeded quite well at accomplishing an automated script to fill all
holes on a mesh in one click.

The problem however is if any hole has another adjacent hole present at
a shared vertex (oxymoron? since you can't really share vertices for
something that technically is a void), but separated by two polys winged
at the vertex, its extremely difficult by conventional standards to not
identify the two holes that are winged as a single hole.

If memory serves me right  even Maya had an issue with this as you could
delete a single poly on a mesh and if the sphere was selected as an
object running Fill Hole would automatically seal all valid holes.
However if their were two holes and they were adjacent, or winged at a
vertex, Maya was smart enough to know how to avoid the situation and
would prevent the winged holes from being filled with a single poly.

The point is, its fairly easy to to write a script to fill the hole, but
it must be smart enough to prevent the winged holes from becoming a
single poly, which is very very bad. If you have a script that was
written to do this task, test it on an example with winged holes before
you proceed. You won't regret the extra effort.

Incidentally this tool is not impossible to write, but as a script or
plugin it requires special information about the topology be available
for the user to query. In my experience XSI  did not provide enough
vertex, facet and edge info to give the developer enough information to
easily script a bulletproof fill hole tool.

Joey Ponthieux
ATOL Experiment Specialist
LaRC Information Technology Enhanced Services (LITES)
Science Systems and Applications, Inc.
NASA Langley Research Center
15 Langley Blvd B1268 R1051
Hampton, VA, 23681
Phone: 757-864-6754
EMail: j.ponthi...@nasa.gov

Opinions stated here-in are strictly those of the author and
do not represent the opinions of NASA or any other party.


On 2/13/2012 1:12 PM, Alan Fregtman wrote:

Sweet! Thanks, Mr.Core! ;)

On 2/13/2012 11:47 AM, Oleg Bliznuk 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







--
---
Stefan Kubicek   Co-founder
---
  keyvis digital imagery
 Wehrgasse 9 - Grüner Hof
   1050 Vienna  Austria
Phone:+43/699/12614231
--- www.keyvis.at  ste...@keyvis.at ---
--  This email and its attachments are
--confidential and for the recipient only--



RE: A good Cap All Holes script?

2012-08-01 Thread Grahame Fuller
I believe this is the issue that Joey was referring to. You's need to somehow 
consider the hole islands rather than the polygon islands.

gray

-Original Message-
From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Stefan Kubicek
Sent: Wednesday, August 01, 2012 04:37 AM
To: softimage@listproc.autodesk.com
Subject: Re: A good Cap All Holes script?

Are the difficult scenarios you mention not ultimately a non-manifold geometry 
problem?
This reminds me on the Any tips to fix non-manifold vertices in Soft? thread 
as of June 26th.

We came up with:

A vertex is non-manifold if more than two of its adjacent edges
do not share their second vertex with any other of said adjacent edge's second 
vertices.

Or as Martin Chatterjee put it slightly differently:

I'd check if a vertex has a neighborPolygon that does *not *share an edge with 
any of the
other neighborPolygons

According to this it should be possible to identify problematic vertices and 
split the capping process up on a per island basis.




 Back several years ago I spent quite a bit of time trying to develop a
 Fill Hole script similar to Maya's. Beware this activity when using
 something automated.

 I ran into immense difficulty trying to develop a method for sealing
 winged holes. In general holes which are an island upon themselves are
 easy to fill. That means that if a quad hole has an adjacent  poly
 present at each  edge and more importantly each vertex, totalling 8
 polys surrounding the quad hole, the hole is extremely easy to fill. I
 succeeded quite well at accomplishing an automated script to fill all
 holes on a mesh in one click.

 The problem however is if any hole has another adjacent hole present at
 a shared vertex (oxymoron? since you can't really share vertices for
 something that technically is a void), but separated by two polys winged
 at the vertex, its extremely difficult by conventional standards to not
 identify the two holes that are winged as a single hole.

 If memory serves me right  even Maya had an issue with this as you could
 delete a single poly on a mesh and if the sphere was selected as an
 object running Fill Hole would automatically seal all valid holes.
 However if their were two holes and they were adjacent, or winged at a
 vertex, Maya was smart enough to know how to avoid the situation and
 would prevent the winged holes from being filled with a single poly.

 The point is, its fairly easy to to write a script to fill the hole, but
 it must be smart enough to prevent the winged holes from becoming a
 single poly, which is very very bad. If you have a script that was
 written to do this task, test it on an example with winged holes before
 you proceed. You won't regret the extra effort.

 Incidentally this tool is not impossible to write, but as a script or
 plugin it requires special information about the topology be available
 for the user to query. In my experience XSI  did not provide enough
 vertex, facet and edge info to give the developer enough information to
 easily script a bulletproof fill hole tool.

 Joey Ponthieux
 ATOL Experiment Specialist
 LaRC Information Technology Enhanced Services (LITES)
 Science Systems and Applications, Inc.
 NASA Langley Research Center
 15 Langley Blvd B1268 R1051
 Hampton, VA, 23681
 Phone: 757-864-6754
 EMail: j.ponthi...@nasa.gov
 
 Opinions stated here-in are strictly those of the author and
 do not represent the opinions of NASA or any other party.


 On 2/13/2012 1:12 PM, Alan Fregtman wrote:
 Sweet! Thanks, Mr.Core! ;)

 On 2/13/2012 11:47 AM, Oleg Bliznuk 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




-- 
---
Stefan Kubicek   Co-founder
---
   keyvis digital imagery
  Wehrgasse 9 - Grüner Hof
   1050 Vienna  Austria
 Phone:+43/699/12614231
--- www.keyvis.at  ste...@keyvis.at ---
--  This email and its attachments are
--confidential and for the recipient only--

attachment: winmail.dat

Re: A good Cap All Holes script?

2012-08-01 Thread Alan Fregtman
My function fails in a scenario like this because it thinks the boundary
edges are one hole, as they are connected.

When I have some time I'll try to revise it.

On Wed, Aug 1, 2012 at 11:22 AM, Grahame Fuller grahame.ful...@autodesk.com
 wrote:

 I believe this is the issue that Joey was referring to. You's need to
 somehow consider the hole islands rather than the polygon islands.

 gray

 -Original Message-
 From: softimage-boun...@listproc.autodesk.com [mailto:
 softimage-boun...@listproc.autodesk.com] On Behalf Of Stefan Kubicek
 Sent: Wednesday, August 01, 2012 04:37 AM
 To: softimage@listproc.autodesk.com
 Subject: Re: A good Cap All Holes script?

 Are the difficult scenarios you mention not ultimately a non-manifold
 geometry problem?
 This reminds me on the Any tips to fix non-manifold vertices in Soft?
 thread as of June 26th.

 We came up with:

 A vertex is non-manifold if more than two of its adjacent edges
 do not share their second vertex with any other of said adjacent edge's
 second vertices.

 Or as Martin Chatterjee put it slightly differently:

 I'd check if a vertex has a neighborPolygon that does *not *share an edge
 with any of the
 other neighborPolygons

 According to this it should be possible to identify problematic vertices
 and split the capping process up on a per island basis.




  Back several years ago I spent quite a bit of time trying to develop a
  Fill Hole script similar to Maya's. Beware this activity when using
  something automated.
 
  I ran into immense difficulty trying to develop a method for sealing
  winged holes. In general holes which are an island upon themselves are
  easy to fill. That means that if a quad hole has an adjacent  poly
  present at each  edge and more importantly each vertex, totalling 8
  polys surrounding the quad hole, the hole is extremely easy to fill. I
  succeeded quite well at accomplishing an automated script to fill all
  holes on a mesh in one click.
 
  The problem however is if any hole has another adjacent hole present at
  a shared vertex (oxymoron? since you can't really share vertices for
  something that technically is a void), but separated by two polys winged
  at the vertex, its extremely difficult by conventional standards to not
  identify the two holes that are winged as a single hole.
 
  If memory serves me right  even Maya had an issue with this as you could
  delete a single poly on a mesh and if the sphere was selected as an
  object running Fill Hole would automatically seal all valid holes.
  However if their were two holes and they were adjacent, or winged at a
  vertex, Maya was smart enough to know how to avoid the situation and
  would prevent the winged holes from being filled with a single poly.
 
  The point is, its fairly easy to to write a script to fill the hole, but
  it must be smart enough to prevent the winged holes from becoming a
  single poly, which is very very bad. If you have a script that was
  written to do this task, test it on an example with winged holes before
  you proceed. You won't regret the extra effort.
 
  Incidentally this tool is not impossible to write, but as a script or
  plugin it requires special information about the topology be available
  for the user to query. In my experience XSI  did not provide enough
  vertex, facet and edge info to give the developer enough information to
  easily script a bulletproof fill hole tool.
 
  Joey Ponthieux
  ATOL Experiment Specialist
  LaRC Information Technology Enhanced Services (LITES)
  Science Systems and Applications, Inc.
  NASA Langley Research Center
  15 Langley Blvd B1268 R1051
  Hampton, VA, 23681
  Phone: 757-864-6754
  EMail: j.ponthi...@nasa.gov
  
  Opinions stated here-in are strictly those of the author and
  do not represent the opinions of NASA or any other party.
 
 
  On 2/13/2012 1:12 PM, Alan Fregtman wrote:
  Sweet! Thanks, Mr.Core! ;)
 
  On 2/13/2012 11:47 AM, Oleg Bliznuk 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
 
 


 --
 ---
 Stefan Kubicek   Co-founder
 ---
keyvis digital imagery
   Wehrgasse 9 - Grüner Hof
1050 Vienna  Austria
  Phone:+43/699/12614231
 --- www.keyvis.at  ste...@keyvis.at ---
 --  This email and its attachments are
 --confidential and for the recipient only--




Re: A good Cap All Holes script?

2012-07-31 Thread Alan Fregtman
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 alan.fregt...@gmail.comwrote:

 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 mzalo...@gmail.comwrote:

 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 gbo...@gmail.com 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