Msg: Duplicate group names in the mesh...
-
Hello all,
I am getting an error message:
"There are duplicated group names in mesh "Mesh_1". You can cancel exporting and rename them, otherwise some group names in the resulting MED file will not match ones in the study. Do you want to continue? Yes/No"
So far I have not been able to track down the cause of this problem with the scripts I am using. Could somebody help me out please?
The scripts are attached below.
Thanks
JMB
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import geompy
import math
def RebuildData(theStudy):
geompy.init_geom(theStudy)
global Vertex_1, Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6, \
Line_1, Line_2, Line_3, Line_4, Line_5, Line_6, Line_7, \
Vector_1, \
Edge_1, Edge_2, Edge_3, Edge_4, \
Cylinder_1, Cylinder_2, Compound_1, Revolution_1, Plane_1, Partition_1, \
Face_1, Face_2, Face_3, Face_4, Face_5, Face_6, \
Wire_1, Wire_2, \
Load, Fixed, Nylon, \
ID, OD, Length, \
LengthInnerSleeve, SleeveOD
ID = 25
OD = 50
Length = 40
LengthInnerSleeve = Length + 10
SleeveOD = ID
Vertex_1 = geompy.MakeVertex(0, 0, 0)
Vertex_2 = geompy.MakeVertex(ID/2, 0, 0)
Vertex_3 = geompy.MakeVertex(OD/2, 0, 0)
Vertex_4 = geompy.MakeVertex(OD/2, Length, 0)
Vertex_5 = geompy.MakeVertex(ID/2, Length, 0)
Vertex_6 = geompy.MakeVertex(0, Length, 0)
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_5)
Line_5 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6)
Line_6 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_1)
Line_7 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_5)
Wire_1 = geompy.MakeWire([Line_1, Line_5, Line_6, Line_7])
Wire_2 = geompy.MakeWire([Line_2, Line_3, Line_4, Line_7])
Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_2, Vertex_5, Vertex_6)
Face_2 = geompy.MakeQuad4Vertices(Vertex_2, Vertex_3, Vertex_4, Vertex_5)
Vector_1 = geompy.MakeVector(Vertex_1, Vertex_6)
Revolution_1 = geompy.MakeRevolution(Face_2, Vector_1, 360*math.pi/180.0)
Plane_1 = geompy.MakePlaneThreePnt(Vertex_1, Vertex_2, Vertex_4, 100)
Partition_1 = geompy.MakePartition([Revolution_1], [Plane_1], [], [], 2, 0, [])
[Edge_1,geomObj_1,geomObj_2,geomObj_3,Edge_2,Edge_3,Edge_4,geomObj_4,geomObj_5,geomObj_6,geomObj_7,geomObj_8,geomObj_9,geomObj_10,geomObj_11,geomObj_12] = geompy.SubShapeAll(Partition_1, geompy.ShapeType["EDGE"])
[geomObj_13,geomObj_14,Face_3,geomObj_15,Face_4,geomObj_16,geomObj_17,Face_5,Face_6,geomObj_18] = geompy.SubShapeAll(Partition_1, geompy.ShapeType["FACE"])
geomObj_19 = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.AddObject(geomObj_19, 21)
geompy.AddObject(geomObj_19, 45)
Partition_1 = geompy.GetMainShape(geomObj_19)
geomObj_20 = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.AddObject(geomObj_20, 31)
geompy.AddObject(geomObj_20, 42)
Partition_1 = geompy.GetMainShape(geomObj_20)
Load = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.AddObject(Load, 21)
geompy.AddObject(Load, 45)
Partition_1 = geompy.GetMainShape(Load)
Fixed = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.AddObject(Fixed, 31)
geompy.AddObject(Fixed, 42)
Partition_1 = geompy.GetMainShape(Fixed)
geompy.addToStudy( Vertex_1, "Vertex_1" )
geompy.addToStudy( Vertex_2, "Vertex_2" )
geompy.addToStudy( Vertex_3, "Vertex_3" )
geompy.addToStudy( Vertex_4, "Vertex_4" )
geompy.addToStudy( Vertex_5, "Vertex_5" )
geompy.addToStudy( Vertex_6, "Vertex_6" )
geompy.addToStudy( Line_1, "Line_1" )
geompy.addToStudy( Line_2, "Line_2" )
geompy.addToStudy( Line_3, "Line_3" )
geompy.addToStudy( Line_4, "Line_4" )
geompy.addToStudy( Line_5, "Line_5" )
geompy.addToStudy( Line_6, "Line_6" )
geompy.addToStudy( Line_7, "Line_7" )
geompy.addToStudy( Wire_1, "Wire_1" )
geompy.addToStudy( Wire_2, "Wire_2" )
geompy.addToStudy( Face_1, "Face_1" )
geompy.addToStudy( Face_2, "Face_2" )
geompy.addToStudyInFather( Revolution_1, Edge_1, "Edge_1" )
geompy.addToStudyInFather( Revolution_1, Edge_2, "Edge_2" )
geompy.addToStudyInFather( Revolution_1, Edge_3, "Edge_3" )
geompy.addToStudyInFather( Revolution_1, Edge_4, "Edge_4" )
geompy.addToStudy( Vector_1, "Vector_1" )
geompy.addToStudy( Revolution_1, "Revolution_1" )
geompy.addToStudy( Plane_1, "Plane_1" )
geompy.addToStudy( Partition_1, "Partition_1" )
geompy.addToStudyInFather( Partition_1, Edge_1, "Edge_1" )
geompy.addToStudyInFather( Partition_1, Edge_2, "Edge_2" )
geompy.addToStudyInFather( Partition_1, Edge_3, "Edge_3" )
geompy.addToStudyInFather( Partition_1, Edge_4, "Edge_4" )
geompy.addToStudyInFather( Partition_1, Face_3, "Face_3" )
geompy.addToStudyInFather( Partition_1, Face_4, "Face_4" )
geompy.addToStudyInFather( Partition_1, Face_5, "Face_5" )
geompy.addToStudyInFather( Partition_1, Face_6, "Face_6" )
geompy.addToStudyInFather( Partition_1, Load, "Load" )
geompy.addToStudyInFather( Partition_1, Fixed, "Fixed" )
pass
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import string, os, sys, re
sys.path.insert( 0, os.path.dirname(__file__) )
exec("from "+re.sub("SMESH$","GEOM",__name__)+" import *"
def RebuildData(theStudy):
aFilterManager = smesh.smesh.CreateFilterManager()
smesh.smesh.SetCurrentStudy(theStudy)
import StdMeshers
Mesh_1 = smesh.Mesh(Partition_1)
Wire_discretisation = Mesh_1.Segment()
R_Segments = Wire_discretisation.NumberOfSegments(18)
R_Segments.SetDistrType( 0 )
Propagation_of_1D_Hyp_on_opposite_edges = Wire_discretisation.Propagation()
Quadrangle_Mapping = Mesh_1.Quadrangle()
Quadrangle_Preference = Quadrangle_Mapping.QuadranglePreference()
Hexahedron_i_j_k = Mesh_1.Hexahedron()
C_Segments = smesh.smesh.CreateHypothesis('NumberOfSegments', 'libStdMeshersEngine.so')
C_Segments.SetNumberOfSegments( 4 )
C_Segments.SetDistrType( 0 )
SubMesh_1 = Mesh_1.GetMesh().GetSubMesh( Edge_1, 'SubMesh_1' )
status = Mesh_1.GetMesh().AddHypothesis( Edge_1, Wire_discretisation.GetAlgorithm() )
status = Mesh_1.GetMesh().AddHypothesis( Edge_1, C_Segments )
status = Mesh_1.GetMesh().AddHypothesis( Edge_1, Propagation_of_1D_Hyp_on_opposite_edges )
isDone = Mesh_1.Compute()
if not isDone: print 'Mesh Mesh_1.GetMesh() : computation failed'
Nylon = Mesh_1.GetMesh().CreateGroupFromGEOM(SMESH.VOLUME, 'Nylon', Partition_1 )
Load_1 = Mesh_1.Group(Load)
Fixed_1 = Mesh_1.Group(Fixed)
mesh_editor_1 = Mesh_1.GetMesh().GetMeshEditor()
mesh_editor_1.RenumberNodes()
mesh_editor_1.RenumberElements()
nodeID = mesh_editor_1.AddNode( 0, 0, 0 )
nodeID = mesh_editor_1.AddNode( 0, 40, 0 )
Torque = Mesh_1.GetMesh().CreateGroup( SMESH.NODE, 'Torque' )
nbAdd = Torque.Add( [ 3421, 3422 ] )
Mesh_1.ExportToMED( '/tmp/CodeAster/BushingTorqueH.med', SMESH.MED_V2_2, 0 )
## set object names
isGUIMode = 1
if isGUIMode and salome.sg.hasDesktop():
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Wire_discretisation.GetAlgorithm(), 'Wire discretisation')
smesh.SetName(R_Segments, 'R Segments')
smesh.SetName(Propagation_of_1D_Hyp_on_opposite_edges, 'Propagation of 1D Hyp. on opposite edges')
smesh.SetName(Quadrangle_Mapping.GetAlgorithm(), 'Quadrangle (Mapping)')
smesh.SetName(Quadrangle_Preference, 'Quadrangle Preference')
smesh.SetName(Hexahedron_i_j_k.GetAlgorithm(), 'Hexahedron (i,j,k)')
smesh.SetName(C_Segments, 'C Segments')
smesh.SetName(SubMesh_1, 'SubMesh_1')
smesh.SetName(Nylon, 'Nylon')
smesh.SetName(Load_1, 'Load')
smesh.SetName(Fixed_1, 'Fixed')
smesh.SetName(Torque, 'Torque')
salome.sg.updateObjBrowser(0)
pass-
Hello,
Ignore my previous message! I found the source of my error. It is a case of the faces belonging to "Load" and "Fixed" overlapping with the group "Nylon" which consists of all the volume elements in the model, thus including "Load" and Fixed" as well. This is not permitted (or is a bug) in the current MED format.
JMB
-
Powered by
Ploneboard
