Thanks a lot Oscar - I will give both methods a shot and see what happens.

Morten



Den 24. marts 2015 kl. 10:45 skrev Oscar Juarez
<[email protected]>:

> this should fix the script, it will select all the polygons that are wrong
> 
> si = Application
> epsilon = 0.00001
> 
> # Get PolygonArea DataArray (which is a tuple)
> sel = si.Selection(0)
> attr = sel.ActivePrimitive.GetICEAttributeFromName( "PolygonArea" )
> areaData = attr.DataArray
> 
> #
> # Find the indices of the bad polys
> #
> bad = [ x for x,y in enumerate( areaData ) if y < epsilon]
> 
> # Select the degenerates with a string like 'cube.poly[112,114,155]'
> str_indices = '%s.poly[%s]' % (sel.FullName, ','.join(str(i) for i in bad))
> si.SelectGeometryComponents(str_indices)
> 
> On Tue, Mar 24, 2015 at 10:38 AM, Oscar Juarez < [email protected]
> <mailto:[email protected]> > wrote:
> > As the blog post says, degenerate polygons most of the time are zero area
> > polys, a filter points with a very small distance have solved this kind of
> > issues for me on the past, but since your geometry is deformed you have to
> > check if it doesn't break your plotted shape or if it doesn't break other
> > things.
> > 
> > On Tue, Mar 24, 2015 at 9:44 AM, Morten Bartholdy < [email protected]
> > <mailto:[email protected]> > wrote:
> > > I have a scene which crashes more or less randomly and Arnold prints an
> > > error that there are degenerate polygons in the scene. The geometry
> > > consist
> > > of 3600 simple cubes which are imported from an alembic file generated in
> > > Cinema4D, so manually examining every object is not really an option. So
> > > my
> > > question is how to fix the degenerate polygons? I found this script:
> > > http://xsisupport.com/2013/03/13/finding-degenerate-polygons-by-area/
> > > <http://xsisupport.com/2013/03/13/finding-degenerate-polygons-by-area/> ,
> > > but it fails with an error:
> > > 
> > > This is what I ran:
> > > 
> > > 
> > > si = Application
> > > epsilon = 0.00001
> > > 
> > > # Get PolygonArea DataArray (which is a tuple)
> > > attr = si.Selection(0).ActivePrimitive.GetICEAttributeFromName(
> > > "PolygonArea" )
> > > areaData = attr.DataArray
> > > 
> > > #
> > > # Find the indices of the bad polys
> > > #
> > > bad = [ x for x,y in enumerate( areaData ) if y < epsilon]
> > > 
> > > # Select the degenerates with a string like 'cube.poly[112,114,155]'
> > > si.SelectGeometryComponents( 'Null2.Cube_[%s]' % ','.join(str(i) for i in
> > > bad) )
> > > 
> > > 
> > > 
> > > 
> > > - and the error:
> > > 
> > > 
> > > Application.SelectMembers("abc_Tiles", "", "")
> > > # ERROR : 2000 - Argument 0 (SelectionList) is invalid
> > > # ERROR : 2001-SELE-SelectGeometryComponents - Argument 0 is invalid
> > > Application.SelectGeometryComponents("Null2.Cube_[]")
> > > # ERROR : Traceback (most recent call last):
> > > # File "<Script Block >", line 14, in <module>
> > > # si.SelectGeometryComponents( 'Null2.Cube_[%s]' % ','.join(str(i) for i
> > > in
> > > bad) )
> > > # File "<COMObject Application>", line 2, in SelectGeometryComponents
> > > # COM Error: The parameter is incorrect. (0x-7ff8ffa9) - [line 14]
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Line 14 is this one:  si.SelectGeometryComponents( 'Null2.Cube_[%s]' %
> > > ','.join(str(i) for i in bad) )
> > > 
> > > 
> > > 
> > > So what might be wrong with this one, and when I know which polygons are
> > > bad, how can I fix them? I am thinking since they dont have an ICE tree
> > > they might have no ICE PolygonArea property...
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Best
> > > 
> > > Morten
> > > 
> > > 
> > > 
> > > 

Reply via email to