Personal tools
You are here: Home Forum Extension of the platform Python script for filtering by area in the geometry module.

Python script for filtering by area in the geometry module.

Up to Extension of the platform

Re: Python script for filtering by area in the geometry module.

Posted by Joseph Parker at July 12. 2019

Need help scripting group creation by face area values in the geometry module.

This is possible in the GUI but when I dump the python script it selects faces by face ID.

I have been through the platform documentation but can only find commands that can do this in the mesh module where cell faces are filtered rather than geometry faces. 

Re: Python script for filtering by area in the geometry module.

Posted by Saint Michael at July 12. 2019

Hi Joseph

There is no filtering functions in GEOM, so you are to do it manually:

selectedFaces = []
minArea, maxArea = 0.1, 1.0
for face in geompy.ExtractShapes(shape, geompy.ShapeType["FACE"], False):
    area = geompy.BasicProperties( face )[1]
    if minArea < area and area < maxArea:
        selectedFaces.append( face )
        pass
    pass
group = geompy.CreateGroup( shape, geompy.ShapeType["FACE"] )
geompy.UnionList( group, selectedFaces )

St.Michael

Powered by Ploneboard
Document Actions