TUI script for grouping elements/nodes belonging to a Geom
Hello,
I have read the documentation and tried to look in the examples, but have been unable to figure out how to create a group of edge elements in a 2D mesh that belong to a geometrical edge. Hre is what I have so far:
[code]
# Create the Mesh groups for BC
aFilterManager = smesh.CreateFilterManager()
Filter_M1_Fixed = aFilterManager.CreateFilter()
aCriteria = []
aCriterion = SMESH.Filter.Criterion(16,32,0,'M1_Fixed','',32,32,1e-07,SMESH.EDGE,-1)
aBelongToGeom_M1_Fixed = aFilterManager.CreateBelongToGeom()
aBelongToGeom_M1_Fixed.SetElementType(SMESH.EDGE)
aBelongToGeom_M1_Fixed.SetTolerance(1e-07)
aCriteria.append(aCriterion)
Filter_M1_Fixed.SetCriteria(aCriteria)
Filter_M1_Fixed.SetPredicate(aBelongToGeom_M1_Fixed)
Fixed1 = Mesh_1.CreateEmptyGroup( SMESH.EDGE, 'Fixed1' )
[/code]
I am unsure not sure I am on the right path above. Also I am unsure about the next steps such as:
[code]
nbAdd = Fixed1.Add( [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] )
aBelongToGeom_M1_Fixed.SetMesh(Mesh_1.GetMesh())
[/code]
because I don't want to speicfy the nodes or element numbers, the script should select them if they belong to the edge called "Fixed1". Would somebody kindly assist me with the snippet of code I should be using here. Thanks.
Regards,
JMB
Re: TUI script for grouping elements/nodes belonging to a Geom
Hello,
I encounter the same difficulty. Did you fix it ? If yes, could you let me know the solution.
Thanks
Regards
Re: TUI script for grouping elements/nodes belonging to a Geom
Previously JMB wrote:
Hello,
I have read the documentation and tried to look in the examples, but have been unable to figure out how to create a group of edge elements in a 2D mesh that belong to a geometrical edge. Hre is what I have so far:
[code]
# Create the Mesh groups for BC
aFilterManager = smesh.CreateFilterManager()
Filter_M1_Fixed = aFilterManager.CreateFilter()
aCriteria = []
aCriterion = SMESH.Filter.Criterion(16,32,0,'M1_Fixed','',32,32,1e-07,SMESH.EDGE,-1)
aBelongToGeom_M1_Fixed = aFilterManager.CreateBelongToGeom()
aBelongToGeom_M1_Fixed.SetElementType(SMESH.EDGE)
aBelongToGeom_M1_Fixed.SetTolerance(1e-07)
aCriteria.append(aCriterion)
Filter_M1_Fixed.SetCriteria(aCriteria)
Filter_M1_Fixed.SetPredicate(aBelongToGeom_M1_Fixed)
Fixed1 = Mesh_1.CreateEmptyGroup( SMESH.EDGE, 'Fixed1' )[/code]
I am unsure not sure I am on the right path above. Also I am unsure about the next steps such as:
[code]
nbAdd = Fixed1.Add( [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] )
aBelongToGeom_M1_Fixed.SetMesh(Mesh_1.GetMesh())[/code]
because I don't want to speicfy the nodes or element numbers, the script should select them if they belong to the edge called "Fixed1". Would somebody kindly assist me with the snippet of code I should be using here. Thanks.
Regards,
JMB
Hi JMB,
It seems there is a way to get the element numbers of the filter but there is a bug if computed after
Filter_M1_Fixed.SetPredicate(aBelongToGeom_M1_Fixed)
So could you try to replace :
Filter_M1_Fixed.SetCriteria(aCriteria)
Filter_M1_Fixed.SetPredicate(aBelongToGeom_M1_Fixed)
Fixed1 = Mesh_1.CreateEmptyGroup( SMESH.EDGE, 'Fixed1' )
nbAdd = Fixed1.Add( [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] )
by
Filter_M1_Fixed.SetCriteria(aCriteria)
ids = Filter_M1_Fixed.GetElementsId(Mesh_1.mesh)
Filter_M1_Fixed.SetPredicate(aBelongToGeom_M1_Fixed)
Fixed1 = Mesh_1.CreateEmptyGroup( SMESH.EDGE, 'Fixed1' )
nbAdd = Fixed1.Add( ids )
and tell us if it works ...
Regards, Erwan.
