--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import math
+
+simple = False
+
+r = 10
+dist = 10
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(25., 5., 25.)
+sphere1 = geompy.MakeSpherePntR(p3, 15.)
+geompy.addToStudy(sphere1, "sphere1")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+p4 = geompy.MakeVertex(5, 50, 90)
+sphere2 = geompy.MakeSpherePntR(p4, 20.)
+
+sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
+geompy.addToStudy(sphere2_trans, "sphere2_trans")
+
+sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
+geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
+
+sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
+geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
+
+if simple:
+ part = box
+else:
+ part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(left, left_faces)
+geompy.addToStudyInFather(part, left, "left")
+
+right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(right, right_faces)
+geompy.addToStudyInFather(part, right, "right")
+
+back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(back, back_faces)
+geompy.addToStudyInFather(part, back, "back")
+
+front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(front, front_faces)
+geompy.addToStudyInFather(part, front, "front")
+
+bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(bottom, bottom_faces)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(top, top_faces)
+geompy.addToStudyInFather(part, top, "top")
+
+sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(sources, left_faces)
+geompy.UnionList(sources, back_faces)
+geompy.UnionList(sources, top_faces)
+geompy.addToStudyInFather(part, sources, "sources")
+
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
+
+def proj_x(shape1):
+ shape2 = geompy.MakeTranslation(shape1, 100, 0., 0)
+ return shape2
+
+def proj_y(shape1):
+ shape2 = geompy.MakeTranslation(shape1, 0, 100., 0)
+ return shape2
+
+def proj_z(shape1):
+ shape2 = geompy.MakeTranslation(shape1, 0, 0, 100.)
+ return shape2
+
+def AddAdvancedFacesPeriodicity(faces1, faces2, f_transf):
+ # Periodicity left/right
+ source_faces = geompy.SubShapeAll(faces1, geompy.ShapeType["FACE"])
+ i = 0
+ j = 0
+ k = 0
+ for source_face in source_faces:
+ geompy.addToStudyInFather(faces1, source_face, "source_face_%i"%i)
+ p_source = geompy.MakeVertexInsideFace(source_face)
+ p_target = f_transf(p_source)
+ target_face = geompy.GetFaceNearPoint(faces2, p_target)
+ geompy.addToStudyInFather(faces2, target_face, "target_face_%i"%i)
+ algo2d.AddFacePeriodicity(source_face, target_face)
+ i += 1
+
+ source_edges = geompy.SubShapeAll(source_face, geompy.ShapeType["EDGE"])
+ for source_edge in source_edges:
+ geompy.addToStudyInFather(faces1, source_edge, "source_edge_%i"%(j))
+ p_source = geompy.MakeVertexOnCurve(source_edge, 0.5)
+ p_target = f_transf(p_source)
+ target_edge = geompy.GetEdgeNearPoint(faces2, p_target)
+ geompy.addToStudyInFather(faces2, target_edge, "target_edge_%i"%(j))
+ algo2d.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge)
+ j += 1
+
+ source_vertices = geompy.SubShapeAll(source_edge, geompy.ShapeType["VERTEX"])
+ for source_vertex in source_vertices:
+ geompy.addToStudyInFather(faces1, source_vertex, "source_vertex_%i"%(k))
+ target_vertex_tmp = f_transf(source_vertex)
+ target_vertex = geompy.GetSame(faces2, target_vertex_tmp)
+ geompy.addToStudyInFather(faces2, target_vertex, "target_vertex_%i"%(k))
+ algo2d.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
+ k += 1
+ pass
+
+AddAdvancedFacesPeriodicity(back, front, proj_x)
+AddAdvancedFacesPeriodicity(left, right, proj_y)
+AddAdvancedFacesPeriodicity(bottom, top, proj_z)
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_front = Mesh.Group(front)
+gr_back = Mesh.Group(back)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
+front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
+bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_right, left_translated)
+checkProjection(gr_back, front_translated)
+checkProjection(gr_top, bottom_translated)
+
+salome.sg.updateObjBrowser(0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+import math
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+simple = False
+
+r = 10
+dist = 10
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(25., 5., 25.)
+sphere1 = geompy.MakeSpherePntR(p3, 15.)
+geompy.addToStudy(sphere1, "sphere1")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+geompy.addToStudy(sphere1_trans, "sphere1_trans")
+
+p4 = geompy.MakeVertex(5, 50, 90)
+sphere2 = geompy.MakeSpherePntR(p4, 20.)
+
+sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
+geompy.addToStudy(sphere2_trans, "sphere2_trans")
+
+sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
+geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
+
+sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
+geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
+
+if simple:
+ part = box
+else:
+ part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
+geompy.addToStudy(part, "part")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(left, left_faces)
+geompy.addToStudyInFather(part, left, "left")
+
+right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(right, right_faces)
+geompy.addToStudyInFather(part, right, "right")
+
+back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(back, back_faces)
+geompy.addToStudyInFather(part, back, "back")
+
+front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(front, front_faces)
+geompy.addToStudyInFather(part, front, "front")
+
+bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(bottom, bottom_faces)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(top, top_faces)
+geompy.addToStudyInFather(part, top, "top")
+
+sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(sources, left_faces)
+geompy.UnionList(sources, back_faces)
+geompy.UnionList(sources, top_faces)
+geompy.addToStudyInFather(part, sources, "sources")
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+algo2d.SetVerbosity(1)
+
+# Periodicity
+#algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+algo2d.AddPreCadFacesPeriodicity(left, right)
+algo2d.AddPreCadFacesPeriodicity(front, back)
+algo2d.AddPreCadFacesPeriodicity(bottom, top)
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_front = Mesh.Group(front)
+gr_back = Mesh.Group(back)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
+front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
+bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_right, left_translated)
+checkProjection(gr_back, front_translated)
+checkProjection(gr_top, bottom_translated)
+
+salome.sg.updateObjBrowser(0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import salome
+
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import math
+
+simple = False
+
+r = 10
+dist = 10
+
+p1 = geompy.MakeVertex(0., 0., 0.)
+p2 = geompy.MakeVertex(100., 100., 100.)
+box = geompy.MakeBoxTwoPnt(p1, p2)
+geompy.addToStudy(box, "box")
+
+p3 = geompy.MakeVertex(25., 5., 25.)
+sphere1 = geompy.MakeSpherePntR(p3, 15.)
+geompy.addToStudy(sphere1, "sphere1")
+
+Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+p4 = geompy.MakeVertex(100., 0., 0.)
+axe = geompy.MakePrismVecH(p4, Vz, 1)
+geompy.addToStudy(axe, "axe")
+
+sphere1_rota = geompy.MakeRotation(sphere1, axe, -math.pi/2.)
+geompy.addToStudy(sphere1_rota, "sphere1_rota")
+
+part = geompy.MakePartition([box], [sphere1, sphere1_rota])
+geompy.addToStudy(part, "part")
+
+left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(left, left_faces)
+geompy.addToStudyInFather(part, left, "left")
+
+right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(right, right_faces)
+geompy.addToStudyInFather(part, right, "right")
+
+back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(back, back_faces)
+geompy.addToStudyInFather(part, back, "back")
+
+front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(front, front_faces)
+geompy.addToStudyInFather(part, front, "front")
+
+bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(bottom, bottom_faces)
+geompy.addToStudyInFather(part, bottom, "bottom")
+
+top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(top, top_faces)
+geompy.addToStudyInFather(part, top, "top")
+
+sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+geompy.UnionList(sources, left_faces)
+geompy.UnionList(sources, back_faces)
+geompy.UnionList(sources, top_faces)
+geompy.addToStudyInFather(part, sources, "sources")
+
+
+# Mesh
+# ====
+
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+Mesh = smesh.Mesh(part, "Mesh")
+
+algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
+algo2d.SetGeometricMesh( 1 )
+algo2d.SetAngleMesh( 4 )
+algo2d.SetPhySize( 8 )
+algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
+
+def rota_z(shape1):
+ shape2 = geompy.MakeRotation(shape1, axe, -math.pi/2)
+ return shape2
+
+algo2d.AddAdvancedFacesPeriodicity(left, front, rota_z)
+
+gr_left = Mesh.Group(left)
+gr_right = Mesh.Group(right)
+gr_front = Mesh.Group(front)
+gr_back = Mesh.Group(back)
+gr_bottom = Mesh.Group(bottom)
+gr_top = Mesh.Group(top)
+
+Mesh.Compute()
+
+left_rotated = Mesh.RotateObjectMakeMesh( gr_left, axe, -math.pi/2, NewMeshName='left_rotated' )
+
+def checkProjection(gr, mesh_translated, tol=1e-7):
+ name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+ mesh_source = smesh.CopyMesh(gr, gr.GetName())
+ mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+ ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+ coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+ mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+ mesh_nodes = mesh_check.GetNodesId()
+ if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+ non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+ mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+ raise Exception("Projection failed for %s"%name)
+
+checkProjection(gr_front, left_rotated)
+
+salome.sg.updateObjBrowser(0)
+
\ref blsurf_top "Back to top"
+
+\section blsurf_periodicity Periodicity
+
+\subsection periodicity_introduction Introduction
+
+Periodicity is used to have the same discretization on two faces (in 3D) or two edges (in 2D).
+This is useful for instance for a Representative Volume Element so that the translated meshes share the same nodes on the common faces.
+
+In GUI, periodicity association uses PreCAD (optional BLSURF add-on). Be sure to have a PreCAD license to be able to use it. Otherwise, use \ref periodicity_tui_basic_api_usage "the basic API in TUI" or the \ref periodicity_tui_advanced_api_usage "the advanced API in TUI".
+
+\image html blsurf_periodicity_translation.png "Two periodic faces (translation)"
+
+\image html blsurf_periodicity_reflexion.png "Two periodic faces (reflexion)"
+
+\image html blsurf_periodicity_2D.png "Associations of edges in 2D (both red edges are associated with each other)"
+
+\subsection periodicity_gui_usage GUI usage
+
+\image html blsurf_parameters_periodicity.png
+
+The periodicity association can be defined:
+
+- on 2 groups of faces (in 3D)
+- on 2 groups of edges (in 2D)
+
+If the transformation is a translation, PreCAD makes the periodicity association with only this information.
+
+Otherwise, for instance a rotation, the user has to define 3 non-colinear vertices and their image by the transformation.
+
+\subsection periodicity_tui_precad_usage TUI PreCAD usage
+
+The two methods to define periodicity with PreCAD are:
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddPreCadFacesPeriodicity
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddPreCadEdgesPeriodicity
+
+List of source and target vertices to define a transformation are optional.
+
+\sa Sample TUI Script of the definition of BLSurf periodicity \ref tui_blsurf_periodicity_preCAD "using preCAD".
+
+\subsection periodicity_tui_basic_api_usage TUI Basic API usage
+
+In the CADSurf basic API, only available in TUI, the periodicity must be defined face by face, edge by edge and vertex by vertex.
+
+The methods are:
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddFacePeriodicity
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddEdgePeriodicity
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddEdgePeriodicityWithoutFaces
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddVertexPeriodicity
+
+Sample TUI Script of the definition of BLSurf periodicity \ref tui_blsurf_periodicity_basic "using basic API (without preCAD)".
+
+\subsection periodicity_tui_advanced_api_usage TUI Advanced API usage
+
+To ease the periodicity description, the basic API methods can be called through two advanced methods, given two geom groups and a python geom transformation:
+
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddAdvancedFacesPeriodicity (in 3D)
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddAdvancedEdgesPeriodicity (in 2D)
+
+Sample TUI Script of the definition of BLSurf periodicity \ref tui_blsurf_periodicity_advanced "using advanced API (without preCAD)".
+
+\ref blsurf_top "Back to top"
+
\section blsurf_limitations Limitations
Currently BLSURF plugin has the following limitations.
<h2>Example of mesh generation with BLSurf algorithm:</h2>
\tui_script{blsurfdemo.py}
+\anchor tui_blsurf_periodicity_preCAD
+<h2>Example of periodicity definition with preCAD</h2>
+\tui_script{test_periodicity_precad.py}
+
+\anchor tui_blsurf_periodicity_basic
+<h2>Example of basic periodicity definition (without preCAD)</h2>
+\tui_script{test_periodicity.py}
+
+\anchor tui_blsurf_periodicity_advanced
+<h2>Example of advanced periodicity definition (without preCAD)</h2>
+\tui_script{test_periodicity_reflexion_advanced.py}
+
*/
};
typedef sequence<TAttractorParams> TAttParamsMap;
+ // Periodicity
+ struct TPreCadPeriodicity {
+ TEntry shape1Entry;
+ TEntry shape2Entry;
+ TEntryList theSourceVerticesEntries;
+ TEntryList theTargetVerticesEntries;
+ };
+
+ typedef sequence<TPreCadPeriodicity> TPeriodicityList;
+
/*!
* BLSURFPlugin_BLSURF: interface of BLSURF algorithm
*/
// PERIODICITY //
///////////////////////
+ void ClearPreCadPeriodicityVectors();
void AddPreCadFacesPeriodicity(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theFace2) raises (SALOME::SALOME_Exception);
void AddPreCadFacesPeriodicityWithVertices(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theFace2, in GEOM::ListOfGO theSourceVertices, in GEOM::ListOfGO theTargetVertices) raises (SALOME::SALOME_Exception);
+ void AddPreCadFacesPeriodicityEntry(in TEntry theFace1, in TEntry theFace2, in TEntryList theSourceVertices, in TEntryList theTargetVertices) raises (SALOME::SALOME_Exception);
void AddPreCadEdgesPeriodicity(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2) raises (SALOME::SALOME_Exception);
void AddPreCadEdgesPeriodicityWithVertices(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2, in GEOM::ListOfGO theSourceVertices, in GEOM::ListOfGO theTargetVertices) raises (SALOME::SALOME_Exception);
+ void AddPreCadEdgesPeriodicityEntry(in TEntry theEdge1, in TEntry theEdge2, in TEntryList theSourceVertices, in TEntryList theTargetVertices) raises (SALOME::SALOME_Exception);
void AddFacePeriodicity(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theFace2) raises (SALOME::SALOME_Exception);
void AddEdgePeriodicity(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theFace2, in GEOM::GEOM_Object theEdge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
void AddEdgePeriodicityWithoutFaces(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
void AddVertexPeriodicity(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theVertex1, in GEOM::GEOM_Object theEdge2, in GEOM::GEOM_Object theVertex2) raises (SALOME::SALOME_Exception);
-
+ TPeriodicityList GetPreCadFacesPeriodicityVector();
+ TPeriodicityList GetPreCadEdgesPeriodicityVector();
///////////////////////
/*!
print "Warning: BLSURFPlugin module unavailable"
self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so")
self.params=None
+ self.geompyD = mesh.geompyD
#self.SetPhysicalMesh() - PAL19680
pass
self.Parameters().AddVertexPeriodicity(theEdge1, theVertex1, theEdge2, theVertex2)
pass
+ ## Define periodicity between two groups of faces, given a transformation function.
+ # This uses the basic BLSURF API for each face, each edge, and each vertex.
+ # @param theFace1 : GEOM face (or group, compound) to associate with theFace2
+ # @param theFace2 : GEOM face (or group, compound) associated with theFace1
+ # @param f_transf : python function defining the transformation between an object of theFace1
+ # into an object of theFace2
+ def AddAdvancedFacesPeriodicity(self, theFace1, theFace2, f_transf):
+ source_faces = self.geompyD.SubShapeAll(theFace1, self.geompyD.ShapeType["FACE"])
+ i = 0
+ j = 0
+ k = 0
+ for source_face in source_faces:
+ self.geompyD.addToStudyInFather(theFace1, source_face, "source_face_%i"%i)
+ p_source = self.geompyD.MakeVertexInsideFace(source_face)
+ p_target = f_transf(p_source)
+ target_face = self.geompyD.GetFaceNearPoint(theFace2, p_target)
+ self.geompyD.addToStudyInFather(theFace2, target_face, "target_face_%i"%i)
+ self.AddFacePeriodicity(source_face, target_face)
+ i += 1
+
+ source_edges = self.geompyD.SubShapeAll(source_face, self.geompyD.ShapeType["EDGE"])
+ for source_edge in source_edges:
+ self.geompyD.addToStudyInFather(theFace1, source_edge, "source_edge_%i"%(j))
+ p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
+ p_target = f_transf(p_source)
+ target_edge = self.geompyD.GetEdgeNearPoint(theFace2, p_target)
+ self.geompyD.addToStudyInFather(theFace2, target_edge, "target_edge_%i"%(j))
+ self.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge)
+ j += 1
+
+ source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
+ for source_vertex in source_vertices:
+ self.geompyD.addToStudyInFather(theFace1, source_vertex, "source_vertex_%i"%(k))
+ target_vertex_tmp = f_transf(source_vertex)
+ target_vertex = self.geompyD.GetSame(theFace2, target_vertex_tmp)
+ self.geompyD.addToStudyInFather(theFace2, target_vertex, "target_vertex_%i"%(k))
+ self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
+ k += 1
+ pass
+
+ ## Define periodicity between two groups of edges, without faces, given a transformation function.
+ # This uses the basic BLSURF API for each edge and each vertex.
+ # @param theFace1 : GEOM edge (or group, compound) to associate with theEdge2
+ # @param theFace2 : GEOM edge (or group, compound) associated with theEdge1
+ # @param f_transf : python function defining the transformation between an object of theEdge1
+ # into an object of theFace2
+ def AddAdvancedEdgesPeriodicity(self, theEdge1, theEdge2, f_transf):
+ source_edges = self.geompyD.SubShapeAll(theEdge1, self.geompyD.ShapeType["EDGE"])
+ j = 0
+ k = 0
+ for source_edge in source_edges:
+ self.geompyD.addToStudyInFather(theEdge1, source_edge, "source_edge_%i"%j)
+ p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
+ p_target = f_transf(p_source)
+ target_edge = self.geompyD.GetEdgeNearPoint(theEdge2, p_target)
+ self.geompyD.addToStudyInFather(theEdge2, target_edge, "target_edge_%i"%j)
+ self.AddEdgePeriodicityWithoutFaces(source_edge, target_edge)
+
+ j += 1
+
+ source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
+ for source_vertex in source_vertices:
+ self.geompyD.addToStudyInFather(theEdge1, source_vertex, "source_vertex_%i"%k)
+ target_vertex_tmp = self.geompyD.MakeTranslation(source_vertex, 10, 0., 0)
+ target_vertex_tmp = f_transf(source_vertex)
+ target_vertex = self.geompyD.GetSame(theEdge2, target_vertex_tmp)
+ self.geompyD.addToStudyInFather(theEdge2, target_vertex, "target_vertex_%i"%k)
+ self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
+
+ k += 1
+ pass
#=====================
# Obsolete methods
return face_ids;
}
+void BLSURFPlugin_BLSURF::addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords)
+{
+ for (std::vector<std::string>::const_iterator it = theVerticesEntries.begin(); it != theVerticesEntries.end(); it++)
+ {
+ BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it;
+ MESSAGE("Vertex entry " << theVertexEntry);
+ addCoordsFromVertex(theVertexEntry, theVerticesCoords);
+ }
+}
+
+
void BLSURFPlugin_BLSURF::addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords)
{
if (theVertexEntry!="")
preCadFacesPeriodicityIDs.shape1IDs = theFace1_ids;
preCadFacesPeriodicityIDs.shape2IDs = theFace2_ids;
- for (size_t i = 0; i<preCadPeriodicity.theSourceVerticesEntries.size(); i++)
- addCoordsFromVertex(preCadPeriodicity.theSourceVerticesEntries[i], preCadFacesPeriodicityIDs.theSourceVerticesCoords);
+ MESSAGE("preCadPeriodicity.theSourceVerticesEntries.size(): " << preCadPeriodicity.theSourceVerticesEntries.size());
+ MESSAGE("preCadPeriodicity.theTargetVerticesEntries.size(): " << preCadPeriodicity.theTargetVerticesEntries.size());
- for (size_t i = 0; i<preCadPeriodicity.theTargetVerticesEntries.size(); i++)
- addCoordsFromVertex(preCadPeriodicity.theTargetVerticesEntries[i], preCadFacesPeriodicityIDs.theTargetVerticesCoords);
+ addCoordsFromVertices(preCadPeriodicity.theSourceVerticesEntries, preCadFacesPeriodicityIDs.theSourceVerticesCoords);
+ addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadFacesPeriodicityIDs.theTargetVerticesCoords);
+ MESSAGE("preCadFacesPeriodicityIDs.theSourceVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theSourceVerticesCoords.size());
+ MESSAGE("preCadFacesPeriodicityIDs.theTargetVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theTargetVerticesCoords.size());
_preCadFacesIDsPeriodicityVector.push_back(preCadFacesPeriodicityIDs);
MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
preCadEdgesPeriodicityIDs.shape1IDs = theEdge1_ids;
preCadEdgesPeriodicityIDs.shape2IDs = theEdge2_ids;
- for (size_t i = 0; i<preCadPeriodicity.theSourceVerticesEntries.size(); i++)
- addCoordsFromVertex(preCadPeriodicity.theSourceVerticesEntries[i], preCadEdgesPeriodicityIDs.theSourceVerticesCoords);
-
- for (size_t i = 0; i<preCadPeriodicity.theTargetVerticesEntries.size(); i++)
- addCoordsFromVertex(preCadPeriodicity.theTargetVerticesEntries[i], preCadEdgesPeriodicityIDs.theTargetVerticesCoords);
-
+ addCoordsFromVertices(preCadPeriodicity.theSourceVerticesEntries, preCadEdgesPeriodicityIDs.theSourceVerticesCoords);
+ addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadEdgesPeriodicityIDs.theTargetVerticesCoords);
_preCadEdgesIDsPeriodicityVector.push_back(preCadEdgesPeriodicityIDs);
MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
const char * option_value);
TopoDS_Shape entryToShape(std::string entry);
+ void addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords);
void addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords);
void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
return hyp ? hyp->_GetVerticesPeriodicityVector() : GetDefaultVerticesPeriodicityVector();
}
+//=======================================================================
+//function : ClearAllEnforcedVertices
+//=======================================================================
+void BLSURFPlugin_Hypothesis::ClearPreCadPeriodicityVectors() {
+ _preCadFacesPeriodicityVector.clear();
+ _preCadEdgesPeriodicityVector.clear();
+ NotifySubMeshesHypothesisModification();
+}
+
//=======================================================================
//function : AddPreCadFacesPeriodicity
//=======================================================================
void BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
- vector<TEntry> &theSourceVerticesEntries, vector<TEntry> &theTargetVerticesEntries) {
+ vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries) {
TPreCadPeriodicity preCadFacesPeriodicity;
preCadFacesPeriodicity.shape1Entry = theFace1Entry;
//function : AddPreCadEdgesPeriodicity
//=======================================================================
void BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
- vector<TEntry> &theSourceVerticesEntries, vector<TEntry> &theTargetVerticesEntries) {
+ vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries) {
TPreCadPeriodicity preCadEdgesPeriodicity;
preCadEdgesPeriodicity.shape1Entry = theEdge1Entry;
save << " " << "__ENFORCED_VERTICES_END__";
}
+ //PERIODICITY
+
+ SavePreCADPeriodicity(save, "FACES");
+ SavePreCADPeriodicity(save, "EDGES");
+
+ SaveFacesPeriodicity(save);
+ SaveEdgesPeriodicity(save);
+ SaveVerticesPeriodicity(save);
+
return save;
}
+void BLSURFPlugin_Hypothesis::SaveFacesPeriodicity(std::ostream & save){
+
+ TFacesPeriodicityVector::const_iterator it_faces_periodicity = _facesPeriodicityVector.begin();
+ if (it_faces_periodicity != _facesPeriodicityVector.end()) {
+ MESSAGE("__FACES_PERIODICITY_BEGIN__");
+ save << " " << "__FACES_PERIODICITY_BEGIN__";
+ for (; it_faces_periodicity != _facesPeriodicityVector.end(); ++it_faces_periodicity) {
+ TFacesPeriodicity periodicity_i = (*it_faces_periodicity);
+ save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
+ save << " " << "__BEGIN_ENTRY1__";
+ save << " " << periodicity_i.first;
+ save << " " << "__END_ENTRY1__";
+ save << " " << "__BEGIN_ENTRY2__";
+ save << " " << periodicity_i.second;
+ save << " " << "__END_ENTRY2__";
+ save << " " << "__END_PERIODICITY_DESCRIPTION__";
+ }
+ save << " " << "__FACES_PERIODICITY_END__";
+ MESSAGE("__FACES_PERIODICITY_END__");
+ }
+}
+
+void BLSURFPlugin_Hypothesis::SaveEdgesPeriodicity(std::ostream & save){
+
+ TEdgesPeriodicityVector::const_iterator it_edges_periodicity = _edgesPeriodicityVector.begin();
+ if (it_edges_periodicity != _edgesPeriodicityVector.end()) {
+ save << " " << "__EDGES_PERIODICITY_BEGIN__";
+ MESSAGE("__EDGES_PERIODICITY_BEGIN__");
+ for (; it_edges_periodicity != _edgesPeriodicityVector.end(); ++it_edges_periodicity) {
+ TEdgePeriodicity periodicity_i = (*it_edges_periodicity);
+ save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
+ if (not periodicity_i.theFace1Entry.empty()){
+ save << " " << "__BEGIN_FACE1__";
+ save << " " << periodicity_i.theFace1Entry;
+ save << " " << "__END_FACE1__";
+ }
+ save << " " << "__BEGIN_EDGE1__";
+ save << " " << periodicity_i.theEdge1Entry;
+ save << " " << "__END_EDGE1__";
+ if (not periodicity_i.theFace2Entry.empty()){
+ save << " " << "__BEGIN_FACE2__";
+ save << " " << periodicity_i.theFace2Entry;
+ save << " " << "__END_FACE2__";
+ }
+ save << " " << "__BEGIN_EDGE2__";
+ save << " " << periodicity_i.theEdge2Entry;
+ save << " " << "__END_EDGE2__";
+ save << " " << "__BEGIN_EDGE_ORIENTATION__";
+ save << " " << periodicity_i.edge_orientation;
+ save << " " << "__END_EDGE_ORIENTATION__";
+ save << " " << "__END_PERIODICITY_DESCRIPTION__";
+ }
+ save << " " << "__EDGES_PERIODICITY_END__";
+ MESSAGE("__EDGES_PERIODICITY_END__");
+ }
+}
+
+void BLSURFPlugin_Hypothesis::SaveVerticesPeriodicity(std::ostream & save){
+
+ TVerticesPeriodicityVector::const_iterator it_vertices_periodicity = _verticesPeriodicityVector.begin();
+ if (it_vertices_periodicity != _verticesPeriodicityVector.end()) {
+ MESSAGE("__VERTICES_PERIODICITY_BEGIN__");
+ save << " " << "__VERTICES_PERIODICITY_BEGIN__";
+ for (; it_vertices_periodicity != _verticesPeriodicityVector.end(); ++it_vertices_periodicity) {
+ TVertexPeriodicity periodicity_i = (*it_vertices_periodicity);
+ save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
+ save << " " << "__BEGIN_EDGE1__";
+ save << " " << periodicity_i.theEdge1Entry;
+ save << " " << "__END_EDGE1__";
+ save << " " << "__BEGIN_VERTEX1__";
+ save << " " << periodicity_i.theVertex1Entry;
+ save << " " << "__END_VERTEX1__";
+ save << " " << "__BEGIN_EDGE2__";
+ save << " " << periodicity_i.theEdge2Entry;
+ save << " " << "__END_EDGE2__";
+ save << " " << "__BEGIN_VERTEX2__";
+ save << " " << periodicity_i.theVertex2Entry;
+ save << " " << "__END_VERTEX2__";
+ save << " " << "__END_PERIODICITY_DESCRIPTION__";
+ }
+ save << " " << "__VERTICES_PERIODICITY_END__";
+ MESSAGE("__VERTICES_PERIODICITY_END__");
+ }
+}
+
+void BLSURFPlugin_Hypothesis::SavePreCADPeriodicity(std::ostream & save, const char* shapeType) {
+ TPreCadPeriodicityVector precad_periodicity;
+ if (shapeType == "FACES")
+ precad_periodicity = _preCadFacesPeriodicityVector;
+ else
+ precad_periodicity = _preCadEdgesPeriodicityVector;
+ TPreCadPeriodicityVector::const_iterator it_precad_periodicity = precad_periodicity.begin();
+ if (it_precad_periodicity != precad_periodicity.end()) {
+ save << " " << "__PRECAD_" << shapeType << "_PERIODICITY_BEGIN__";
+ for (; it_precad_periodicity != precad_periodicity.end(); ++it_precad_periodicity) {
+ TPreCadPeriodicity periodicity_i = (*it_precad_periodicity);
+ save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
+ if (!periodicity_i.shape1Entry.empty()) {
+ save << " " << "__BEGIN_ENTRY1__";
+ save << " " << periodicity_i.shape1Entry;
+ save << " " << "__END_ENTRY1__";
+ }
+ if (!periodicity_i.shape2Entry.empty()) {
+ save << " " << "__BEGIN_ENTRY2__";
+ save << " " << periodicity_i.shape2Entry;
+ save << " " << "__END_ENTRY2__";
+ }
+
+ std::vector<std::string>::const_iterator sourceVerticesEntriesIt = periodicity_i.theSourceVerticesEntries.begin();
+ bool hasSourceVertices = false;
+ if (sourceVerticesEntriesIt != periodicity_i.theSourceVerticesEntries.end()) {
+ hasSourceVertices = true;
+ save << " " << "__BEGIN_SOURCE_VERTICES_LIST__";
+ }
+ for (; sourceVerticesEntriesIt != periodicity_i.theSourceVerticesEntries.end(); ++sourceVerticesEntriesIt)
+ save << " " << (*sourceVerticesEntriesIt);
+ if (hasSourceVertices)
+ save << " " << "__END_SOURCE_VERTICES_LIST__";
+
+ std::vector<std::string>::const_iterator targetVerticesEntriesIt = periodicity_i.theTargetVerticesEntries.begin();
+ bool hasTargetVertices = false;
+ if (targetVerticesEntriesIt != periodicity_i.theTargetVerticesEntries.end()) {
+ hasTargetVertices = true;
+ save << " " << "__BEGIN_TARGET_VERTICES_LIST__";
+ }
+ for (; targetVerticesEntriesIt != periodicity_i.theTargetVerticesEntries.end(); ++targetVerticesEntriesIt)
+ save << " " << (*targetVerticesEntriesIt);
+ if (hasTargetVertices)
+ save << " " << "__END_TARGET_VERTICES_LIST__";
+
+ save << " " << "__END_PERIODICITY_DESCRIPTION__";
+ }
+ save << " " << "__PRECAD_" << shapeType << "_PERIODICITY_END__";
+ }
+
+}
+
//=============================================================================
std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
bool isOK = true;
bool hasAttractor = false;
bool hasNewAttractor = false;
bool hasEnforcedVertex = false;
+ bool hasPreCADFacesPeriodicity = false;
+ bool hasPreCADEdgesPeriodicity = false;
+ bool hasFacesPeriodicity = false;
+ bool hasEdgesPeriodicity = false;
+ bool hasVerticesPeriodicity = false;
isOK = (load >> option_or_sm);
if (isOK)
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
if (isOK && hasCADSurfOptions) {
isOK = (load >> i);
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
std::string optName, optValue;
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
while (isOK && hasPreCADOptions) {
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
std::string smEntry, smValue;
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
std::string atEntry, atValue;
hasNewAttractor = true;
else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
std::string newAtFaceEntry, atTestString;
if (isOK)
if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
}
}
}
+ // PERIODICITY
+
+ if (hasPreCADFacesPeriodicity){
+ LoadPreCADPeriodicity(load, "FACES");
+
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ if (hasPreCADEdgesPeriodicity){
+ LoadPreCADPeriodicity(load, "EDGES");
+
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ if (hasFacesPeriodicity){
+ LoadFacesPeriodicity(load);
+
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ if (hasEdgesPeriodicity){
+ LoadEdgesPeriodicity(load);
+
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ if (hasVerticesPeriodicity)
+ LoadVerticesPeriodicity(load);
+
return load;
}
+void BLSURFPlugin_Hypothesis::LoadFacesPeriodicity(std::istream & load){
+
+ bool isOK = true;
+
+ std::string periodicitySeparator;
+ TEntry shape1Entry;
+ TEntry shape2Entry;
+
+ _facesPeriodicityVector.clear();
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
+ MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
+ TFacesPeriodicity *periodicity_i = new TFacesPeriodicity();
+ if (periodicitySeparator == "__FACES_PERIODICITY_END__")
+ break; // __FACES_PERIODICITY_END__
+ if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
+ MESSAGE("//" << periodicitySeparator << "//");
+ throw std::exception();
+ }
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator);
+ MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
+ if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
+
+ periodicity_i->first = shape1Entry;
+ periodicity_i->second = shape2Entry;
+
+ _facesPeriodicityVector.push_back(*periodicity_i);
+
+ break; // __END_PERIODICITY_DESCRIPTION__
+ }
+
+ if (periodicitySeparator == "__BEGIN_ENTRY1__") { // __BEGIN_ENTRY1__
+ isOK = (load >> shape1Entry);
+ isOK = (load >> periodicitySeparator); // __END_ENTRY1__
+ if (periodicitySeparator != "__END_ENTRY1__")
+ throw std::exception();
+ MESSAGE("shape1Entry: " <<shape1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
+ isOK = (load >> shape2Entry);
+ isOK = (load >> periodicitySeparator); // __END_ENTRY2__
+ if (periodicitySeparator != "__END_ENTRY2__")
+ throw std::exception();
+ MESSAGE("shape2Entry: " <<shape2Entry);
+ }
+ }
+ }
+}
+
+
+void BLSURFPlugin_Hypothesis::LoadEdgesPeriodicity(std::istream & load){
+
+ bool isOK = true;
+
+ std::string periodicitySeparator;
+ TEntry theFace1Entry;
+ TEntry theEdge1Entry;
+ TEntry theFace2Entry;
+ TEntry theEdge2Entry;
+ int edge_orientation = 0;
+
+ _edgesPeriodicityVector.clear();
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
+ MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
+ TEdgePeriodicity *periodicity_i = new TEdgePeriodicity();
+ if (periodicitySeparator == "__EDGES_PERIODICITY_END__")
+ break; // __EDGES_PERIODICITY_END__
+ if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
+ MESSAGE("//" << periodicitySeparator << "//");
+ throw std::exception();
+ }
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator);
+ MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
+ if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
+
+ periodicity_i->theFace1Entry = theFace1Entry;
+ periodicity_i->theEdge1Entry = theEdge1Entry;
+ periodicity_i->theFace2Entry = theFace2Entry;
+ periodicity_i->theEdge2Entry = theEdge2Entry;
+ periodicity_i->edge_orientation = edge_orientation;
+
+ _edgesPeriodicityVector.push_back(*periodicity_i);
+
+ break; // __END_PERIODICITY_DESCRIPTION__
+ }
+
+ if (periodicitySeparator == "__BEGIN_FACE1__") { // __BEGIN_FACE1__
+ isOK = (load >> theFace1Entry);
+ MESSAGE("//" << theFace1Entry << "//");
+ isOK = (load >> periodicitySeparator); // __END_FACE1__
+ if (periodicitySeparator != "__END_FACE1__"){
+ MESSAGE("//" << periodicitySeparator << "//");
+ throw std::exception();
+ }
+ MESSAGE("theFace1Entry: " <<theFace1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_EDGE1__") { // __BEGIN_EDGE1__
+ isOK = (load >> theEdge1Entry);
+ isOK = (load >> periodicitySeparator); // __END_EDGE1__
+ if (periodicitySeparator != "__END_EDGE1__")
+ throw std::exception();
+ MESSAGE("theEdge1Entry: " <<theEdge1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_FACE2__") { // __BEGIN_FACE2__
+ isOK = (load >> theFace2Entry);
+ isOK = (load >> periodicitySeparator); // __END_FACE2__
+ if (periodicitySeparator != "__END_FACE2__")
+ throw std::exception();
+ MESSAGE("theFace2Entry: " <<theFace2Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
+ isOK = (load >> theEdge2Entry);
+ isOK = (load >> periodicitySeparator); // __END_EDGE2__
+ if (periodicitySeparator != "__END_EDGE2__")
+ throw std::exception();
+ MESSAGE("theEdge2Entry: " <<theEdge2Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_EDGE_ORIENTATION__") { // __BEGIN_EDGE_ORIENTATION__
+ isOK = (load >> edge_orientation);
+ isOK = (load >> periodicitySeparator); // __END_EDGE_ORIENTATION__
+ if (periodicitySeparator != "__END_EDGE_ORIENTATION__")
+ throw std::exception();
+ MESSAGE("edge_orientation: " <<edge_orientation);
+ }
+ }
+ }
+}
+
+void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load){
+
+ bool isOK = true;
+
+ std::string periodicitySeparator;
+ TEntry theEdge1Entry;
+ TEntry theVertex1Entry;
+ TEntry theEdge2Entry;
+ TEntry theVertex2Entry;
+
+ _verticesPeriodicityVector.clear();
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
+ MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
+ TVertexPeriodicity *periodicity_i = new TVertexPeriodicity();
+ if (periodicitySeparator == "__VERTICES_PERIODICITY_END__")
+ break; // __VERTICES_PERIODICITY_END__
+ if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
+ MESSAGE("//" << periodicitySeparator << "//");
+ throw std::exception();
+ }
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator);
+ MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
+ if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
+
+ periodicity_i->theEdge1Entry = theEdge1Entry;
+ periodicity_i->theVertex1Entry = theVertex1Entry;
+ periodicity_i->theEdge2Entry = theEdge2Entry;
+ periodicity_i->theVertex2Entry = theVertex2Entry;
+
+ _verticesPeriodicityVector.push_back(*periodicity_i);
+
+ break; // __END_PERIODICITY_DESCRIPTION__
+ }
+
+ if (periodicitySeparator == "__BEGIN_EDGE1__") { // __BEGIN_EDGE1__
+ isOK = (load >> theEdge1Entry);
+ isOK = (load >> periodicitySeparator); // __END_EDGE1__
+ if (periodicitySeparator != "__END_EDGE1__")
+ throw std::exception();
+ MESSAGE("theEdge1Entry: " <<theEdge1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_VERTEX1__") { // __BEGIN_VERTEX1__
+ isOK = (load >> theVertex1Entry);
+ isOK = (load >> periodicitySeparator); // __END_VERTEX1__
+ if (periodicitySeparator != "__END_VERTEX1__")
+ throw std::exception();
+ MESSAGE("theVertex1Entry: " <<theVertex1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
+ isOK = (load >> theEdge2Entry);
+ isOK = (load >> periodicitySeparator); // __END_EDGE2__
+ if (periodicitySeparator != "__END_EDGE2__")
+ throw std::exception();
+ MESSAGE("theEdge2Entry: " <<theEdge2Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_VERTEX2__") { // __BEGIN_VERTEX2__
+ isOK = (load >> theVertex2Entry);
+ isOK = (load >> periodicitySeparator); // __END_VERTEX2__
+ if (periodicitySeparator != "__END_VERTEX2__")
+ throw std::exception();
+ MESSAGE("theVertex2Entry: " <<theVertex2Entry);
+ }
+ }
+ }
+}
+
+void BLSURFPlugin_Hypothesis::LoadPreCADPeriodicity(std::istream & load, const char* shapeType) {
+
+ bool isOK = true;
+
+ std::string periodicitySeparator;
+ TEntry shape1Entry;
+ TEntry shape2Entry;
+ std::vector<std::string> theSourceVerticesEntries;
+ std::vector<std::string> theTargetVerticesEntries;
+
+ bool hasSourceVertices = false;
+ bool hasTargetVertices = false;
+
+ if (shapeType == "FACES")
+ _preCadFacesPeriodicityVector.clear();
+ else
+ _preCadEdgesPeriodicityVector.clear();
+
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
+ MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
+ TPreCadPeriodicity *periodicity_i = new TPreCadPeriodicity();
+// MESSAGE("periodicitySeparator: " <<periodicitySeparator);
+ std::string endSeparator = "__PRECAD_" + std::string(shapeType) + "_PERIODICITY_END__";
+ if (periodicitySeparator == endSeparator)
+ break; // __PRECAD_FACES_PERIODICITY_END__
+ if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
+ MESSAGE("//" << endSeparator << "//");
+ MESSAGE("//" << periodicitySeparator << "//");
+ throw std::exception();
+ }
+
+ while (isOK) {
+ isOK = (load >> periodicitySeparator);
+ MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
+ if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
+
+ periodicity_i->shape1Entry = shape1Entry;
+ periodicity_i->shape2Entry = shape2Entry;
+
+ MESSAGE("theSourceVerticesEntries.size(): " << theSourceVerticesEntries.size());
+ MESSAGE("theTargetVerticesEntries.size(): " << theTargetVerticesEntries.size());
+
+ if (hasSourceVertices)
+ periodicity_i->theSourceVerticesEntries = theSourceVerticesEntries;
+ if (hasTargetVertices)
+ periodicity_i->theTargetVerticesEntries = theTargetVerticesEntries;
+
+ if (shapeType == "FACES")
+ _preCadFacesPeriodicityVector.push_back(*periodicity_i);
+ else
+ _preCadEdgesPeriodicityVector.push_back(*periodicity_i);
+
+ theSourceVerticesEntries.clear();
+ theTargetVerticesEntries.clear();
+ hasSourceVertices = false;
+ hasTargetVertices = false;
+ break; // __END_PERIODICITY_DESCRIPTION__
+ }
+
+ if (periodicitySeparator == "__BEGIN_ENTRY1__") { // __BEGIN_ENTRY1__
+ isOK = (load >> shape1Entry);
+ isOK = (load >> periodicitySeparator); // __END_ENTRY1__
+ if (periodicitySeparator != "__END_ENTRY1__")
+ throw std::exception();
+ MESSAGE("shape1Entry: " <<shape1Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
+ isOK = (load >> shape2Entry);
+ isOK = (load >> periodicitySeparator); // __END_ENTRY2__
+ if (periodicitySeparator != "__END_ENTRY2__")
+ throw std::exception();
+ MESSAGE("shape2Entry: " <<shape2Entry);
+ }
+
+ if (periodicitySeparator == "__BEGIN_SOURCE_VERTICES_LIST__") { // __BEGIN_SOURCE_VERTICES_LIST__
+ hasSourceVertices = true;
+ while (isOK && (periodicitySeparator != "__END_SOURCE_VERTICES_LIST__")) {
+ isOK = (load >> periodicitySeparator);
+ if (periodicitySeparator != "__END_SOURCE_VERTICES_LIST__") {
+ theSourceVerticesEntries.push_back(periodicitySeparator);
+ MESSAGE("theSourceVerticesEntries: " <<periodicitySeparator);
+ }
+ }
+ }
+
+ if (periodicitySeparator == "__BEGIN_TARGET_VERTICES_LIST__") { // __BEGIN_TARGET_VERTICES_LIST__
+ hasTargetVertices = true;
+ while (isOK && (periodicitySeparator != "__END_TARGET_VERTICES_LIST__")) {
+ isOK = (load >> periodicitySeparator);
+ if (periodicitySeparator != "__END_TARGET_VERTICES_LIST__") {
+ theTargetVerticesEntries.push_back(periodicitySeparator);
+ MESSAGE("theTargetVerticesEntries: " <<periodicitySeparator);
+ }
+ }
+ }
+ }
+ }
+}
+
//=============================================================================
std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp) {
return hyp.SaveTo(save);
struct TPreCadPeriodicity {
TEntry shape1Entry;
TEntry shape2Entry;
- std::vector<TEntry> theSourceVerticesEntries;
- std::vector<TEntry> theTargetVerticesEntries;
+ std::vector<std::string> theSourceVerticesEntries;
+ std::vector<std::string> theTargetVerticesEntries;
};
// Edge periodicity
static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
*/
+// const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
+
static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
const TPreCadPeriodicityVector _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
const TVerticesPeriodicityVector _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+ void ClearPreCadPeriodicityVectors();
+
void AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
TEdgesPeriodicityVector _edgesPeriodicityVector;
TVerticesPeriodicityVector _verticesPeriodicityVector;
+ // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+ void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
+
+ // Called by LoadFrom to fill _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
+ void LoadPreCADPeriodicity(std::istream & load, const char* shapeType);
+
+ // Called by LoadFrom to fill _facesPeriodicityVector
+ void LoadFacesPeriodicity(std::istream & load);
+
+ // Called by LoadFrom to fill _edgesPeriodicityVector
+ void LoadEdgesPeriodicity(std::istream & load);
+
+ // Called by LoadFrom to fill _verticesPeriodicityVector
+ void LoadVerticesPeriodicity(std::istream & load);
+
+ // Called by SaveTo to store content of _facesPeriodicityVector
+ void SaveFacesPeriodicity(std::ostream & save);
+
+ // Called by SaveTo to store content of _edgesPeriodicityVector
+ void SaveEdgesPeriodicity(std::ostream & save);
+
+ // Called by SaveTo to store content of _verticesPeriodicityVector
+ void SaveVerticesPeriodicity(std::ostream & save);
+
std::string _GMFFileName;
// bool _GMFFileMode;
if (!theSourceVerticesEntries.empty())
{
listEntriesTxt << ", [" ;
- for (size_t i = 0; i<theSourceVerticesEntries.size(); i++)
+ size_t i =0;
+ for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
{
if (i>0)
listEntriesTxt << ", ";
- listEntriesTxt << theSourceVerticesEntries[i];
+ listEntriesTxt << *it;
}
listEntriesTxt << "], [" ;
- for (size_t i = 0; i<theTargetVerticesEntries.size(); i++)
+ i =0;
+ for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
{
if (i>0)
listEntriesTxt << ", ";
- listEntriesTxt << theTargetVerticesEntries[i];
+ listEntriesTxt << *it;
}
listEntriesTxt << "]" ;
}
return listEntriesTxt.str();
}
+/**
+ * Erase all PreCad periodicity associations
+ */
+void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearPreCadPeriodicityVectors();
+ SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
+}
+
+BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
+ const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
+ this->GetImpl()->_GetPreCadFacesPeriodicityVector();
+
+ BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
+
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
+ return periodicityList._retn();
+}
+
+BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
+ const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
+ this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
+
+ BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
+
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
+ return periodicityList._retn();
+}
+
+// convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
+BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
+ BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
+
+ periodicityList->length(preCadPeriodicityVector.size());
+
+ for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
+ {
+ ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
+
+ BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
+ myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
+ myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
+
+ BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+ if (not preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
+ {
+ sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
+ for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
+ sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
+ }
+
+ myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
+
+ BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+ if (not preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
+ {
+ targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
+ for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
+ targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
+ }
+
+ myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
+
+ periodicityList[i] = myPreCadPeriodicity;
+ }
+
+
+ return periodicityList._retn();
+}
+
void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
throw (SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
+ MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
size_t theLength = theSourceVertices.length();
if (theLength != theTargetVertices.length())
string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
string prefix3 = "Source_vertex_";
- vector<string> theSourceVerticesEntries (theLength) ;
+ BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
+ theSourceVerticesEntries->length(theLength);
GEOM::GEOM_Object_ptr theVtx_i;
string theEntry_i;
for (size_t ind = 0; ind < theLength; ind++) {
theVtx_i = theSourceVertices[ind];
theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
- theSourceVerticesEntries[ind] = theEntry_i;
+ theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string prefix4 = "Target_vertex_";
- vector<string> theTargetVerticesEntries (theLength) ;
+ BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
+ theTargetVerticesEntries->length(theLength);
for (size_t ind = 0; ind < theLength; ind++) {
theVtx_i = theTargetVertices[ind];
theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
- theTargetVerticesEntries[ind] = theEntry_i;
+ theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string theFace2Name = theFace2->GetName();
void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
- vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
+ // Convert BLSURFPlugin::TEntryList to vector<string>
+ vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
+ for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
+ theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
+ theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
+ }
+
string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
throw (SALOME::SALOME_Exception)
{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
ASSERT(myBaseImpl);
size_t theLength = theSourceVertices.length();
string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
string prefix3 = "Source_vertex_";
- vector<string> theSourceVerticesEntries (theLength) ;
+ BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
+ theSourceVerticesEntries->length(theLength);
GEOM::GEOM_Object_ptr theVtx_i;
string theEntry_i;
for (size_t ind = 0; ind < theLength; ind++) {
theVtx_i = theSourceVertices[ind];
theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
- theSourceVerticesEntries[ind] = theEntry_i;
+ theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string prefix4 = "Target_vertex_";
- vector<string> theTargetVerticesEntries (theLength) ;
+ BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
+ theTargetVerticesEntries->length(theLength);
for (size_t ind = 0; ind < theLength; ind++) {
theVtx_i = theTargetVertices[ind];
theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
- theTargetVerticesEntries[ind] = theEntry_i;
+ theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string theEdge2Name = theEdge2->GetName();
void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
- vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
+ // Convert BLSURFPlugin::TEntryList to vector<string>
+ vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
+ for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
+ theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
+ theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
+ }
+
string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
// PERIODICITY //
///////////////////////
+ void ClearPreCadPeriodicityVectors();
+
+ BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
+ BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
+
+ BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
+
void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
throw (SALOME::SALOME_Exception);
throw (SALOME::SALOME_Exception);
void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
- vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
throw (SALOME::SALOME_Exception);
void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
throw (SALOME::SALOME_Exception);
void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
- vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
throw (SALOME::SALOME_Exception);
void AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
#include <QTableWidget>
#include <QTabWidget>
#include <QVBoxLayout>
+#include <QSplitter>
#include <QStandardItemModel>
#include <QStandardItem>
ADV_TAB,
SMP_TAB,
ENF_TAB,
+ PERIODICITY_TAB,
SMP_NAME_COLUMN =0,
SMP_SIZEMAP_COLUMN,
SMP_ENTRY_COLUMN,
ENF_VER_Z_COLUMN,
ENF_VER_ENTRY_COLUMN,
ENF_VER_GROUP_COLUMN,
- ENF_VER_NB_COLUMNS
+ ENF_VER_NB_COLUMNS,
+// Periodicity
+ PERIODICITY_OBJ_SOURCE_COLUMN = 0,
+ PERIODICITY_OBJ_TARGET_COLUMN,
+ PERIODICITY_P1_SOURCE_COLUMN,
+ PERIODICITY_P2_SOURCE_COLUMN,
+ PERIODICITY_P3_SOURCE_COLUMN,
+ PERIODICITY_P1_TARGET_COLUMN,
+ PERIODICITY_P2_TARGET_COLUMN,
+ PERIODICITY_P3_TARGET_COLUMN,
+ PERIODICITY_SHAPE_TYPE,
+
+// PERIODICITY_OBJ_SOURCE_COLUMN = 0,
+// PERIODICITY_ENTRY_SOURCE_COLUMN,
+// PERIODICITY_OBJ_TARGET_COLUMN,
+// PERIODICITY_ENTRY_TARGET_COLUMN,
+// PERIODICITY_P1_SOURCE_COLUMN,
+// PERIODICITY_P1_ENTRY_SOURCE_COLUMN,
+// PERIODICITY_P2_SOURCE_COLUMN,
+// PERIODICITY_P2_ENTRY_SOURCE_COLUMN,
+// PERIODICITY_P3_SOURCE_COLUMN,
+// PERIODICITY_P3_ENTRY_SOURCE_COLUMN,
+// PERIODICITY_P1_TARGET_COLUMN,
+// PERIODICITY_P1_ENTRY_TARGET_COLUMN,
+// PERIODICITY_P2_TARGET_COLUMN,
+// PERIODICITY_P2_ENTRY_TARGET_COLUMN,
+// PERIODICITY_P3_TARGET_COLUMN,
+// PERIODICITY_P3_ENTRY_TARGET_COLUMN,
+
+ PERIODICITY_NB_COLUMN
};
enum {
return GeometryGUI::GetGeomGen();
}
+void BLSURFPluginGUI_HypothesisCreator::avoidSimultaneousSelection(ListOfWidgets &selectionWidgets) const
+{
+ StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
+ ListOfWidgets::const_iterator anIt = selectionWidgets.begin();
+ for ( ; anIt != selectionWidgets.end(); anIt++)
+ {
+ if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 =
+ ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ ListOfWidgets::const_iterator anIt2 = anIt;
+ for ( ++anIt2; anIt2 != selectionWidgets.end(); anIt2++)
+ if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w2 =
+ ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
+ w1->AvoidSimultaneousSelection( w2 );
+ }
+ if ( !widgetToActivate )
+ widgetToActivate = w1;
+ }
+ }
+ if ( widgetToActivate )
+ widgetToActivate->activateSelection();
+}
bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
{
anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
// anEnfLayout->setRowStretch(1, 1);
+ // ---
+ // Periodicity parameters
+ myPeriodicityGroup = new QWidget();
+ aPeriodicityLayout1 = new QGridLayout(myPeriodicityGroup);
+
+ myPeriodicitySplitter = new QSplitter(myPeriodicityGroup);
+ myPeriodicitySplitter->setOrientation(Qt::Horizontal);
+ aPeriodicityLayout1->addWidget(myPeriodicitySplitter, 0, 0, 1, 1);
+
+ myPeriodicityTreeWidget = new QTreeWidget(myPeriodicitySplitter);
+
+ QStringList myPeriodicityTreeHeaders;
+ myPeriodicityTreeHeaders << tr("BLSURF_PERIODICITY_OBJ_SOURCE_COLUMN")
+ << tr("BLSURF_PERIODICITY_OBJ_TARGET_COLUMN")
+ << tr("BLSURF_PERIODICITY_P1_SOURCE_COLUMN")
+ << tr("BLSURF_PERIODICITY_P2_SOURCE_COLUMN")
+ << tr("BLSURF_PERIODICITY_P3_SOURCE_COLUMN")
+ << tr("BLSURF_PERIODICITY_P1_TARGET_COLUMN")
+ << tr("BLSURF_PERIODICITY_P2_TARGET_COLUMN")
+ << tr("BLSURF_PERIODICITY_P3_TARGET_COLUMN")
+ << tr("BLSURF_PERIODICITY_SHAPE_TYPE");
+ myPeriodicityTreeWidget->setHeaderLabels(myPeriodicityTreeHeaders);
+
+ // Hide the vertex name to make the widget more readable
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_SOURCE_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_SOURCE_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_SOURCE_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P1_TARGET_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P2_TARGET_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_P3_TARGET_COLUMN);
+ myPeriodicityTreeWidget->hideColumn(PERIODICITY_SHAPE_TYPE);
+
+
+ myPeriodicityTreeWidget->setColumnCount(PERIODICITY_NB_COLUMN);
+ myPeriodicityTreeWidget->setSortingEnabled(true);
+
+ myPeriodicityTreeWidget->setAlternatingRowColors(true);
+ myPeriodicityTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myPeriodicityTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ int periodicityVisibleColumns = 2;
+ for (size_t column = 0; column < periodicityVisibleColumns; ++column) {
+ myPeriodicityTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
+ myPeriodicityTreeWidget->resizeColumnToContents(column);
+ }
+ myPeriodicityTreeWidget->header()->setStretchLastSection(true);
+
+ myPeriodicitySplitter->addWidget(myPeriodicityTreeWidget);
+
+ myPeriodicityRightWidget = new QWidget(myPeriodicitySplitter);
+
+ myPeriodicityRightGridLayout = new QGridLayout(myPeriodicityRightWidget);
+ myPeriodicityGroupBox1 = new QGroupBox(tr("BLSURF_PRECAD_PERIODICITY"), myPeriodicityRightWidget);
+ myPeriodicityGroupBox1Layout = new QGridLayout(myPeriodicityGroupBox1);
+
+ myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox1, 0, 0, 1, 2);
+
+ myPeriodicityOnFaceRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_FACE"), myPeriodicityGroupBox1);
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnFaceRadioButton, 0, 0, 1, 2);
+
+ myPeriodicityOnFaceRadioButton->setChecked(true);
+
+ myPeriodicityOnEdgeRadioButton = new QRadioButton(tr("BLSURF_PERIODICITY_ON_EDGE"), myPeriodicityGroupBox1);
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicityOnEdgeRadioButton, 0, 2, 1, 2);
+
+
+ // FACE, EDGE AND VERTEX SELECTION
+ TColStd_MapOfInteger shapeTypesFace, shapeTypesEdge;
+ shapeTypesFace.Add( TopAbs_FACE );
+ shapeTypesFace.Add( TopAbs_EDGE );
+ shapeTypesFace.Add( TopAbs_COMPOUND );
+ shapeTypesEdge.Add( TopAbs_EDGE );
+ shapeTypesEdge.Add( TopAbs_COMPOUND );
+
+// myPeriodicityEdgeFilter = new SMESH_NumberFilter("GEOM", TopAbs_EDGE, 0, shapeTypesEdge);
+
+ myPeriodicityMainSourceLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_SOURCE"), myPeriodicityGroupBox1);
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainSourceLabel, 1, 0, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicitySourceFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
+ myPeriodicitySourceFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicitySourceFaceFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+// myPeriodicitySourceFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceFaceWdg, 1, 1, 1, 1);
+
+// myPeriodicitySourceEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+// myPeriodicitySourceEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
+// myPeriodicitySourceEdgeWdg->hide();
+// myPeriodicityGroupBox1Layout->addWidget(myPeriodicitySourceEdgeWdg, 1, 1, 1, 1);
+
+ myPeriodicityMainTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_MAIN_TARGET"), myPeriodicityGroupBox1);
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicityMainTargetLabel, 1, 2, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityTargetFaceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 0, shapeTypesFace);
+ myPeriodicityTargetFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityTargetFaceFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+// myPeriodicityTargetFaceWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_FACE"), "QLineEdit { color: grey }");
+ myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetFaceWdg, 1, 3, 1, 1);
+
+// myPeriodicityTargetEdgeWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityEdgeFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+// myPeriodicityTargetEdgeWdg->SetDefaultText(tr("BLSURF_PERIODICITY_SELECT_EDGE"), "QLineEdit { color: grey }");
+// myPeriodicityTargetEdgeWdg->hide();
+// myPeriodicityGroupBox1Layout->addWidget(myPeriodicityTargetEdgeWdg, 1, 3, 1, 1);
+
+ myPeriodicityGroupBox2 = new QGroupBox(tr("BLSURF_PERIODICITY_WITH_VERTICES"), myPeriodicityRightWidget);
+ myPeriodicityGroupBox2Layout = new QGridLayout(myPeriodicityGroupBox2);
+ myPeriodicityRightGridLayout->addWidget(myPeriodicityGroupBox2, 1, 0, 1, 2);
+
+ myPeriodicityGroupBox2->setCheckable(true);
+ myPeriodicityGroupBox2->setChecked(false);
+
+ myPeriodicitySourceLabel = new QLabel(tr("BLSURF_PERIODICITY_SOURCE"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicitySourceLabel, 0, 0, 1, 2);
+
+ myPeriodicityTargetLabel = new QLabel(tr("BLSURF_PERIODICITY_TARGET"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityTargetLabel, 0, 2, 1, 2);
+
+ // P1
+ myPeriodicityP1SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_SOURCE"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceLabel, 1, 0, 1, 1);
+
+
+ SMESH_NumberFilter* myPeriodicityP1SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP1SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1SourceFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1SourceWdg, 1, 1, 1, 1);
+
+ // P2
+ myPeriodicityP2SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_SOURCE"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceLabel, 2, 0, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityP2SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP2SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2SourceFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2SourceWdg, 2, 1, 1, 1);
+
+ // P3
+ myPeriodicityP3SourceLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_SOURCE"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceLabel, 3, 0, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityP3SourceFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP3SourceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3SourceFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3SourceWdg, 3, 1, 1, 1);
+
+ // P1
+ myPeriodicityP1TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P1_TARGET"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetLabel, 1, 2, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityP1TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP1TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP1TargetFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP1TargetWdg, 1, 3, 1, 1);
+
+ // P2
+ myPeriodicityP2TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P2_TARGET"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetLabel, 2, 2, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityP2TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP2TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP2TargetFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP2TargetWdg, 2, 3, 1, 1);
+
+ // P3
+ myPeriodicityP3TargetLabel = new QLabel(tr("BLSURF_PERIODICITY_P3_TARGET"), myPeriodicityGroupBox2);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetLabel, 3, 2, 1, 1);
+
+ SMESH_NumberFilter* myPeriodicityP3TargetFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX);
+ myPeriodicityP3TargetWdg = new StdMeshersGUI_ObjectReferenceParamWdg( myPeriodicityP3TargetFilter, 0, /*multiSel=*/false, /*stretch=*/false);
+ myPeriodicityGroupBox2Layout->addWidget(myPeriodicityP3TargetWdg, 3, 3, 1, 1);
+
+ myPeriodicityVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
+ myPeriodicityGroupBox2Layout->addItem(myPeriodicityVerticalSpacer, 7, 1, 1, 1);
+
+
+ myPeriodicityAddButton = new QPushButton(tr("BLSURF_PERIODICITY_ADD"),myPeriodicityRightWidget);
+ myPeriodicityRightGridLayout->addWidget(myPeriodicityAddButton, 2, 0, 1, 1);
+
+ myPeriodicityRemoveButton = new QPushButton(tr("BLSURF_PERIODICITY_REMOVE"),myPeriodicityRightWidget);
+ myPeriodicityRightGridLayout->addWidget(myPeriodicityRemoveButton, 2, 1, 1, 1);
+
+ myPeriodicitySplitter->addWidget(myPeriodicityRightWidget);
+
+ myPeriodicitySelectionWidgets.clear();
+ myPeriodicitySelectionWidgets.append(myPeriodicitySourceFaceWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityTargetFaceWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP1SourceWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP2SourceWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP3SourceWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP1TargetWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP2TargetWdg);
+ myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
+ avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
+
// ---
myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
+ myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
myTabWidget->setCurrentIndex( STD_TAB );
// connect( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) );
// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) );
+ // Periodicity
+ connect( myPeriodicityAddButton, SIGNAL( clicked()), this, SLOT( onAddPeriodicity() ) );
+ connect( myPeriodicityRemoveButton, SIGNAL( clicked()), this, SLOT( onRemovePeriodicity() ) );
+ connect( myPeriodicityTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*, int)), this, SLOT( onPeriodicityTreeClicked(QTreeWidgetItem *, int) ) );
+ connect( myPeriodicityGroupBox2, SIGNAL(toggled(bool)), this, SLOT(onPeriodicityByVerticesChecked(bool)));
+
+ ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
+ for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
+
+ }
+// connect( myPeriodicitySourceFaceWdg, SIGNAL(contentModified()), this, SLOT(onPeriodicityContentModified()));
return fr;
}
myInternalEnforcedVerticesAllFacesGroup->setEnabled(state == Qt::Checked);
}
+/** BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity()
+This method is called when a item is added into the periodicity table widget
+*/
+void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
+// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
+
+ BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+
+ that->getGeomSelectionTool()->selectionMgr()->clearFilters();
+ ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
+ for ( ; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ w1->deactivateSelection();
+ }
+
+
+ // Source-Target selection
+ int selSource = myPeriodicitySourceFaceWdg->NbObjects();
+ int selTarget = myPeriodicityTargetFaceWdg->NbObjects();
+
+ if (selSource == 0 or selTarget == 0)
+ return;
+
+ // Vertices selection
+ if (myPeriodicityGroupBox2->isChecked())
+ {
+ int P1Ssel = myPeriodicityP1SourceWdg->NbObjects();
+ int P2Ssel = myPeriodicityP2SourceWdg->NbObjects();
+ int P3Ssel = myPeriodicityP3SourceWdg->NbObjects();
+ int P1Tsel = myPeriodicityP1TargetWdg->NbObjects();
+ int P2Tsel = myPeriodicityP2TargetWdg->NbObjects();
+ int P3Tsel = myPeriodicityP3TargetWdg->NbObjects();
+
+ if (P1Ssel!=1 or P2Ssel!=1 or P3Ssel!=1 or P1Tsel!=1 or P3Tsel!=1 or P3Tsel!=1)
+ {
+ QString msg = tr("BLSURF_PERIODICITY_WRONG_NUMBER_OF_VERTICES");
+ SUIT_MessageBox::critical( dlg(),"Error" , msg );
+ return;
+ }
+ }
+
+ // Add Source-Target in table
+ string shapeEntry, sourceEntry, targetEntry;
+ string shapeName, sourceName, targetName;
+ GEOM::GEOM_Object_var shape;
+
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+ myPeriodicityTreeWidget->addTopLevelItem(item);
+
+ item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
+
+
+ size_t k=0;
+ for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ shape = w1->GetObject< GEOM::GEOM_Object >(0);
+ shapeName = shape->GetName();
+ shapeEntry = shape->GetStudyEntry();
+ item->setData(k, Qt::EditRole, shapeName.c_str() );
+ item->setData(k, Qt::UserRole, shapeEntry.c_str() );
+ if (not myPeriodicityGroupBox2->isChecked() and k==1)
+ break;
+ }
+
+ // Add shape type in tree
+ string onFace = (myPeriodicityOnFaceRadioButton->isChecked()) ? "1" : "0";
+ item->setData(PERIODICITY_SHAPE_TYPE, Qt::UserRole, onFace.c_str());
+
+ // Blank input fields
+ for (anIt = myPeriodicitySelectionWidgets.begin(); anIt != myPeriodicitySelectionWidgets.end(); anIt++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ w1->SetObject(GEOM::GEOM_Object::_nil());
+ }
+
+// for (int column = 0; column < myPeriodicityTreeWidget->columnCount(); ++column)
+// myPeriodicityTreeWidget->resizeColumnToContents(column);
+
+}
+
+/** BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity()
+This method is called when a item is removed from the periodicity tree widget
+*/
+void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
+// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
+ QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
+ QTreeWidgetItem* item;
+
+ foreach(item,selectedItems) {
+ MESSAGE("Remove " << item->text(0).toStdString());
+ delete item;
+ }
+
+ myEnforcedTreeWidget->selectionModel()->clearSelection();
+}
+
+/** BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked()
+This method enable clears the field for periodicity by vertices
+*/
+void BLSURFPluginGUI_HypothesisCreator::onPeriodicityByVerticesChecked(bool checked)
+{
+ if (not checked)
+ {
+ for (size_t k=2; k<myPeriodicitySelectionWidgets.size(); k++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k] );
+ w1->deactivateSelection();
+ w1->SetObject(CORBA::Object::_nil());
+ }
+ }
+}
+
+/** BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
+This method enable the proper shape selection widget to Face or Edge shapes
+*/
+//void BLSURFPluginGUI_HypothesisCreator::onPeriodicityRadioButtonChanged()
+//{
+// if (myPeriodicityOnFaceRadioButton->isChecked())
+// {
+// MESSAGE("Show Face");
+// myPeriodicitySourceEdgeWdg->hide();
+// myPeriodicityTargetEdgeWdg->hide();
+// myPeriodicitySourceFaceWdg->show();
+// myPeriodicityTargetFaceWdg->show();
+// }
+// else
+// {
+// MESSAGE("Show Edge");
+// myPeriodicitySourceFaceWdg->hide();
+// myPeriodicityTargetFaceWdg->hide();
+// myPeriodicitySourceEdgeWdg->show();
+// myPeriodicityTargetEdgeWdg->show();
+// }
+//}
+
+void BLSURFPluginGUI_HypothesisCreator::onPeriodicityTreeClicked(QTreeWidgetItem* item, int row)
+{
+ QString shapeName, shapeEntry;
+ CORBA::Object_var shape;
+ size_t k=0;
+ ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
+ for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+
+ shapeName = item->data(k, Qt::EditRole).toString();
+ shapeEntry = item->data(k, Qt::UserRole).toString();
+ if (not shapeEntry.isEmpty())
+ {
+ shape = entryToObject(shapeEntry);
+ w1->SetObject(shape);
+ w1->deactivateSelection();
+ if (k==2)
+ myPeriodicityGroupBox2->setChecked(1);
+ }
+ else if(k==2)
+ myPeriodicityGroupBox2->setChecked(0);
+ }
+
+ if (item->data(PERIODICITY_SHAPE_TYPE, Qt::UserRole) == "1")
+ myPeriodicityOnFaceRadioButton->setChecked(true);
+ else
+ myPeriodicityOnEdgeRadioButton->setChecked(true);
+
+
+}
+
+/** BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
+This method gives the focus to the next selection widget when a content is modified in a selection widget.
+*/
+void BLSURFPluginGUI_HypothesisCreator::onPeriodicityContentModified()
+{
+ BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+
+ ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
+ size_t k=0;
+ // find wich selection widget is activated
+ for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++, k++)
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ if (w1->IsSelectionActivated() and k<(myPeriodicitySelectionWidgets.size()-1))
+ {
+ // don't activate vertex selection if the group box is not checked
+ if (k==1 and not myPeriodicityGroupBox2->isChecked())
+ break;
+ // clear the selection, to avoid to put the same object in the other widget
+ that->getGeomSelectionTool()->selectionMgr()->clearSelected();
+ // activate the next widget
+ StdMeshersGUI_ObjectReferenceParamWdg * w2 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( myPeriodicitySelectionWidgets[k+1] );
+ w2->activateSelection();
+ break;
+ }
+ }
+}
+
+
/** BLSURFPluginGUI_HypothesisCreator::retrieveParams()
This method updates the GUI widgets with the hypothesis data
*/
myInternalEnforcedVerticesAllFacesGroup->setText(QString(data.myInternalEnforcedVerticesAllFacesGroup.c_str()));
myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
+ // Periodicity
+ MESSAGE("retrieveParams(): periodicity ");
+
+
+ // Add an item in the tree widget for each association
+ for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+ myPeriodicityTreeWidget->addTopLevelItem(item);
+ item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
+ TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
+ for (size_t k=0; k<periodicity_i.size(); k++)
+ {
+ string shapeEntry = periodicity_i[k];
+ string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
+ item->setData(k, Qt::EditRole, shapeName.c_str() );
+ item->setData(k, Qt::UserRole, shapeEntry.c_str() );
+ }
+ }
+
// update widgets
that->myStdWidget->onPhysicalMeshChanged();
that->myStdWidget->onGeometricMeshChanged();
*/
QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
{
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
}
// attractor new version
- MESSAGE("retrieveParams, Attractors")
+ MESSAGE("readParamsFromHypo, Attractors")
BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
for ( int i = 0;i<allMyAttractorParams->length(); ++i ) {
BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
h_data.myInternalEnforcedVerticesAllFaces = h->GetInternalEnforcedVertexAllFaces();
h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
+ // Periodicity
+ MESSAGE("readParamsFromHypo, Periodicity")
+
+ h_data.preCadPeriodicityVector.clear();
+
+ BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector = h->GetPreCadFacesPeriodicityVector();
+ AddPreCadSequenceToVector(h_data, preCadFacePeriodicityVector, true);
+
+ BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
+ AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
return true;
}
+void BLSURFPluginGUI_HypothesisCreator::AddPreCadSequenceToVector(BlsurfHypothesisData& h_data,
+ BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const
+{
+
+ for (size_t i=0; i<preCadFacePeriodicityVector->length(); i++ )
+ {
+ TPreCadPeriodicity periodicity_i(PERIODICITY_NB_COLUMN);
+ periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN] = preCadFacePeriodicityVector[i].shape1Entry.in();
+ periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN] = preCadFacePeriodicityVector[i].shape2Entry.in();
+
+ BLSURFPlugin::TEntryList sourceVertices = preCadFacePeriodicityVector[i].theSourceVerticesEntries;
+ BLSURFPlugin::TEntryList targetVertices = preCadFacePeriodicityVector[i].theTargetVerticesEntries;
+
+ if (sourceVertices.length()!=0)
+ {
+ periodicity_i[PERIODICITY_P1_SOURCE_COLUMN] = sourceVertices[0].in();
+ periodicity_i[PERIODICITY_P2_SOURCE_COLUMN] = sourceVertices[1].in();
+ periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
+ }
+
+ if (targetVertices.length()!=0)
+ {
+ periodicity_i[PERIODICITY_P1_TARGET_COLUMN] = targetVertices[0].in();
+ periodicity_i[PERIODICITY_P2_TARGET_COLUMN] = targetVertices[1].in();
+ periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
+ }
+
+ if (onFace)
+ periodicity_i[PERIODICITY_SHAPE_TYPE] = "1";
+ else
+ periodicity_i[PERIODICITY_SHAPE_TYPE] = "0";
+
+ h_data.preCadPeriodicityVector.push_back(periodicity_i);
+ }
+}
+
/** BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo(h_data)
Saves the hypothesis data to hypothesis values.
*/
if ( h->GetInternalEnforcedVertexAllFacesGroup() != h_data.myInternalEnforcedVerticesAllFacesGroup )
h->SetInternalEnforcedVertexAllFacesGroup( h_data.myInternalEnforcedVerticesAllFacesGroup.c_str() );
+ // Periodicity
+ if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 or h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
+ h->ClearPreCadPeriodicityVectors();
+
+ MESSAGE("h_data.preCadPeriodicityVector.size(): " << h_data.preCadPeriodicityVector.size());
+ TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
+ for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
+ {
+ TPreCadPeriodicity periodicity_i = *pIt;
+ TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
+ TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
+ TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
+ TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
+ TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
+ TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
+ TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
+ TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
+ bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
+
+ BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+ sourceVertices->length(3);
+ sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
+ sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
+ sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
+
+
+ BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+ targetVertices->length(3);
+ targetVertices[0]=CORBA::string_dup(p1Target.c_str());
+ targetVertices[1]=CORBA::string_dup(p2Target.c_str());
+ targetVertices[2]=CORBA::string_dup(p3Target.c_str());
+
+ if (onFace)
+ h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ else
+ h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ }
+
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end periodicity");
+
+
} // try
catch(const std::exception& ex) {
std::cout << "Exception: " << ex.what() << std::endl;
// // SalomeApp_Tools::QtCatchCorbaException(ex);
// // ok = false;
// }
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end");
return ok;
}
h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
h_data.myInternalEnforcedVerticesAllFacesGroup = myInternalEnforcedVerticesAllFacesGroup->text().toStdString();
+ // Periodicity
+ h_data.preCadPeriodicityVector.clear();
+ // For each tree item, store each value. Shapes are stored as entries.
+ int nbPeriodicityDescriptions = myPeriodicityTreeWidget->topLevelItemCount();
+ for (size_t i=0 ; i<nbPeriodicityDescriptions ; i++) {
+ QTreeWidgetItem* item = myPeriodicityTreeWidget->topLevelItem(i);
+ TPreCadPeriodicity periodicity_i;
+ if (item) {
+ for (size_t k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
+ {
+ MESSAGE(k);
+ std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
+ MESSAGE(entry);
+ periodicity_i.push_back(entry);
+ }
+ h_data.preCadPeriodicityVector.push_back(periodicity_i);
+ }
+ guiHyp += "PERIODICITY = yes; ";
+ }
+
MESSAGE("guiHyp : " << guiHyp.toLatin1().data());
return guiHyp;
}
class QTreeWidgetItem;
class QTableWidgetItem;
class QObject;
+class QSplitter;
+class QGridLayout;
+class QVBoxLayout;
+class QSpacerItem;
class SMESHGUI_SpinBox;
+class SMESH_NumberFilter;
class LightApp_SelectionMgr;
class BLSURFPluginGUI_StdWidget;
class BLSURFPluginGUI_AdvWidget;
// Map Face Entry / InternalEnforcedVertices
typedef std::map< TEntry, bool > TFaceEntryInternalVerticesMap;
+// PreCad Face and Edge periodicity
+typedef std::vector<std::string> TPreCadPeriodicity;
+typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
+
typedef struct
{
int myTopology, myVerbosity;
/* TODO GROUPS
TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
*/
+ TPreCadPeriodicityVector preCadPeriodicityVector;
QString myName;
} BlsurfHypothesisData;
// void deactivateSelection(QWidget*, QWidget*);
void clearEnforcedVertexWidgets();
void onInternalVerticesClicked(int);
+ // Periodicity tab
+ void onPeriodicityByVerticesChecked(bool);
+ void onPeriodicityRadioButtonChanged();
+ void onAddPeriodicity();
+ void onRemovePeriodicity();
+ void onPeriodicityTreeClicked(QTreeWidgetItem*, int);
+ void onPeriodicityContentModified();
private:
bool readParamsFromHypo( BlsurfHypothesisData& ) const;
int findRowFromEntry(QString entry);
CORBA::Object_var entryToObject(QString entry);
static LightApp_SelectionMgr* selectionMgr();
+ void avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
+ void AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
private:
GeomSelectionTools* GeomToolSelected;
LightApp_SelectionMgr* aSel;
+ // Periodicity
+ QWidget* myPeriodicityGroup;
+ QSplitter* myPeriodicitySplitter;
+ QTreeWidget* myPeriodicityTreeWidget;
+ QWidget* myPeriodicityRightWidget;
+ QGridLayout* myPeriodicityRightGridLayout;
+ QGroupBox* myPeriodicityGroupBox1;
+ QGroupBox* myPeriodicityGroupBox2;
+ QGridLayout* aPeriodicityLayout1;
+ QGridLayout* myPeriodicityGroupBox1Layout;
+ QGridLayout* myPeriodicityGroupBox2Layout;
+ QRadioButton* myPeriodicityOnFaceRadioButton;
+ QRadioButton* myPeriodicityOnEdgeRadioButton;
+ QLabel* myPeriodicityMainSourceLabel;
+ QLabel* myPeriodicityMainTargetLabel;
+ QLabel* myPeriodicitySourceLabel;
+ QLabel* myPeriodicityTargetLabel;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceFaceWdg;
+// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceEdgeWdg;
+ GEOM::GEOM_Object_var myPeriodicityFace;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetFaceWdg;
+// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetEdgeWdg;
+ GEOM::GEOM_Object_var myPeriodicityEdge;
+ QLabel* myPeriodicityP1SourceLabel;
+ QLabel* myPeriodicityP2SourceLabel;
+ QLabel* myPeriodicityP3SourceLabel;
+ QLabel* myPeriodicityP1TargetLabel;
+ QLabel* myPeriodicityP2TargetLabel;
+ QLabel* myPeriodicityP3TargetLabel;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1TargetWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2TargetWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3TargetWdg;
+ ListOfWidgets myPeriodicitySelectionWidgets;
+ QPushButton* myPeriodicityAddButton;
+ QPushButton* myPeriodicityRemoveButton;
+ QSpacerItem* myPeriodicityVerticalSpacer;
+
BLSURFPlugin::string_array_var myOptions, myPreCADOptions;
PyObject * main_mod;
<source>ZERO_VALUE_OF</source>
<translation>Invalid value (zero) of "%1"</translation>
</message>
+ <message>
+ <source>BLSURF_PERIODICITY</source>
+ <translation>Periodicity</translation>
+ </message>
+ <message>
+ <source>BLSURF_PRECAD_PERIODICITY</source>
+ <translation>Periodicity association (using PreCAD)</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ON_FACE</source>
+ <translation>On face</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ON_EDGE</source>
+ <translation>On edge only</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_OBJ_SOURCE_COLUMN</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_OBJ_TARGET_COLUMN</source>
+ <translation>Target</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_SOURCE_COLUMN</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_SOURCE_COLUMN</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_SOURCE_COLUMN</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_TARGET_COLUMN</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_TARGET_COLUMN</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_TARGET_COLUMN</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_MAIN_SOURCE</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_MAIN_TARGET</source>
+ <translation>Target</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SOURCE</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_TARGET</source>
+ <translation>Target</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_WITH_VERTICES</source>
+ <translation>Transformation vertices</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_SOURCE</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_SOURCE</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_SOURCE</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_TARGET</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_TARGET</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_TARGET</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ADD</source>
+ <translation>Add</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_REMOVE</source>
+ <translation>Remove</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_WRONG_NUMBER_OF_VERTICES</source>
+ <translation>Wrong number of vertices provided</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SELECT_FACE</source>
+ <translation>Face</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SELECT_EDGE</source>
+ <translation>Edge</translation>
+ </message>
</context>
</TS>
<source>BLSURF_ENF_VER_INTERNAL_VERTICES</source>
<translation>Utiliser les points internes de toutes les faces</translation>
</message>
+ <message>
+ <source>BLSURF_PERIODICITY</source>
+ <translation>Periodicité</translation>
+ </message>
+ <message>
+ <source>BLSURF_PRECAD_PERIODICITY</source>
+ <translation>Association périodique (utilise PreCAD)</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ON_FACE</source>
+ <translation>Sur les faces</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ON_EDGE</source>
+ <translation>Sur les arêtes uniquement</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_OBJ_SOURCE_COLUMN</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_OBJ_TARGET_COLUMN</source>
+ <translation>Cible</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_SOURCE_COLUMN</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_SOURCE_COLUMN</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_SOURCE_COLUMN</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_TARGET_COLUMN</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_TARGET_COLUMN</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_TARGET_COLUMN</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_MAIN_SOURCE</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_MAIN_TARGET</source>
+ <translation>Cible</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SOURCE</source>
+ <translation>Source</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_TARGET</source>
+ <translation>Cible</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_WITH_VERTICES</source>
+ <translation>Points définissant la transformation</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_SOURCE</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_SOURCE</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_SOURCE</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P1_TARGET</source>
+ <translation>P1</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P2_TARGET</source>
+ <translation>P2</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_P3_TARGET</source>
+ <translation>P3</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_ADD</source>
+ <translation>Ajouter</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_REMOVE</source>
+ <translation>Supprimer</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_WRONG_NUMBER_OF_VERTICES</source>
+ <translation>Le nombre de points fournis n'est pas correct</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SELECT_FACE</source>
+ <translation>Face</translation>
+ </message>
+ <message>
+ <source>BLSURF_PERIODICITY_SELECT_EDGE</source>
+ <translation>Arête</translation>
+ </message>
</context>
</TS>
shape2 = geompy.MakeTranslation(shape1, 0, 0, 100.)
return shape2
-def AddAdvancedFacesPeriodicity(faces1, faces2, f_transf):
- # Periodicity left/right
- source_faces = geompy.SubShapeAll(faces1, geompy.ShapeType["FACE"])
- i = 0
- j = 0
- k = 0
- for source_face in source_faces:
- geompy.addToStudyInFather(faces1, source_face, "source_face_%i"%i)
- p_source = geompy.MakeVertexInsideFace(source_face)
- p_target = f_transf(p_source)
- target_face = geompy.GetFaceNearPoint(faces2, p_target)
- geompy.addToStudyInFather(faces2, target_face, "target_face_%i"%i)
- algo2d.AddFacePeriodicity(source_face, target_face)
- i += 1
-
- source_edges = geompy.SubShapeAll(source_face, geompy.ShapeType["EDGE"])
- for source_edge in source_edges:
- geompy.addToStudyInFather(faces1, source_edge, "source_edge_%i"%(j))
- p_source = geompy.MakeVertexOnCurve(source_edge, 0.5)
- p_target = f_transf(p_source)
- target_edge = geompy.GetEdgeNearPoint(faces2, p_target)
- geompy.addToStudyInFather(faces2, target_edge, "target_edge_%i"%(j))
- algo2d.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge)
- j += 1
-
- source_vertices = geompy.SubShapeAll(source_edge, geompy.ShapeType["VERTEX"])
- for source_vertex in source_vertices:
- geompy.addToStudyInFather(faces1, source_vertex, "source_vertex_%i"%(k))
- target_vertex_tmp = f_transf(source_vertex)
- target_vertex = geompy.GetSame(faces2, target_vertex_tmp)
- geompy.addToStudyInFather(faces2, target_vertex, "target_vertex_%i"%(k))
- algo2d.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
- k += 1
- pass
-
-AddAdvancedFacesPeriodicity(back, front, proj_x)
-AddAdvancedFacesPeriodicity(left, right, proj_y)
-AddAdvancedFacesPeriodicity(bottom, top, proj_z)
+algo2d.AddAdvancedFacesPeriodicity(back, front, proj_x)
+algo2d.AddAdvancedFacesPeriodicity(left, right, proj_y)
+algo2d.AddAdvancedFacesPeriodicity(bottom, top, proj_z)
gr_left = Mesh.Group(left)
gr_right = Mesh.Group(right)
shape2 = geompy.MakeTranslation(shape1, 0, 10., 0)
return shape2
-def AddAdvancedEdgesPeriodicity(edges1, edges2, f_transf):
- source_edges = geompy.SubShapeAll(edges1, geompy.ShapeType["EDGE"])
- j = 0
- k = 0
- for source_edge in source_edges:
- geompy.addToStudyInFather(edges1, source_edge, "source_edge_%i"%j)
- p_source = geompy.MakeVertexOnCurve(source_edge, 0.5)
- p_target = f_transf(p_source)
- target_edge = geompy.GetEdgeNearPoint(part, p_target)
- geompy.addToStudyInFather(edges2, target_edge, "target_edge_%i"%j)
- algo2d.AddEdgePeriodicityWithoutFaces(source_edge, target_edge)
-
- j += 1
-
- source_vertices = geompy.SubShapeAll(source_edge, geompy.ShapeType["VERTEX"])
- for source_vertex in source_vertices:
- geompy.addToStudyInFather(edges1, source_vertex, "source_vertex_%i"%k)
- target_vertex_tmp = geompy.MakeTranslation(source_vertex, 10, 0., 0)
- target_vertex_tmp = f_transf(source_vertex)
- target_vertex = geompy.GetSame(part, target_vertex_tmp)
- geompy.addToStudyInFather(edges2, target_vertex, "target_vertex_%i"%k)
- algo2d.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
-
- k += 1
-
-AddAdvancedEdgesPeriodicity(left, right, proj_x)
-AddAdvancedEdgesPeriodicity(bottom, top, proj_y)
+algo2d.AddAdvancedEdgesPeriodicity(left, right, proj_x)
+algo2d.AddAdvancedEdgesPeriodicity(bottom, top, proj_y)
Mesh.Compute()
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
-
shape2 = geompy.MakeRotation(shape1, axe, -math.pi/2)
return shape2
-def AddAdvancedFacesPeriodicity(faces1, faces2, f_transf):
- # Periodicity left/right
- source_faces = geompy.SubShapeAll(faces1, geompy.ShapeType["FACE"])
- i = 0
- j = 0
- k = 0
- for source_face in source_faces:
- geompy.addToStudyInFather(faces1, source_face, "source_face_%i"%i)
- p_source = geompy.MakeVertexInsideFace(source_face)
- p_target = f_transf(p_source)
- target_face = geompy.GetFaceNearPoint(faces2, p_target)
- geompy.addToStudyInFather(faces2, target_face, "target_face_%i"%i)
- algo2d.AddFacePeriodicity(source_face, target_face)
- i += 1
-
- source_edges = geompy.SubShapeAll(source_face, geompy.ShapeType["EDGE"])
- for source_edge in source_edges:
- geompy.addToStudyInFather(faces1, source_edge, "source_edge_%i"%(j))
- p_source = geompy.MakeVertexOnCurve(source_edge, 0.5)
- p_target = f_transf(p_source)
- target_edge = geompy.GetEdgeNearPoint(faces2, p_target)
- geompy.addToStudyInFather(faces2, target_edge, "target_edge_%i"%(j))
- algo2d.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge)
- j += 1
-
- source_vertices = geompy.SubShapeAll(source_edge, geompy.ShapeType["VERTEX"])
- for source_vertex in source_vertices:
- geompy.addToStudyInFather(faces1, source_vertex, "source_vertex_%i"%(k))
- target_vertex_tmp = f_transf(source_vertex)
- target_vertex = geompy.GetSame(faces2, target_vertex_tmp)
- geompy.addToStudyInFather(faces2, target_vertex, "target_vertex_%i"%(k))
- algo2d.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
- k += 1
- pass
-
-AddAdvancedFacesPeriodicity(left, front, rota_z)
+algo2d.AddAdvancedFacesPeriodicity(left, front, rota_z)
gr_left = Mesh.Group(left)
gr_right = Mesh.Group(right)
shape2 = geompy.MakeRotation(shape1, axe, -math.pi/2)
return shape2
-def AddAdvancedEdgesPeriodicity(edges1, edges2, f_transf):
- source_edges = geompy.SubShapeAll(edges1, geompy.ShapeType["EDGE"])
- j = 0
- k = 0
- for source_edge in source_edges:
- geompy.addToStudyInFather(edges1, source_edge, "source_edge_%i"%j)
- p_source = geompy.MakeVertexOnCurve(source_edge, 0.5)
- p_target = f_transf(p_source)
- target_edge = geompy.GetEdgeNearPoint(part, p_target)
- geompy.addToStudyInFather(edges2, target_edge, "target_edge_%i"%j)
- algo2d.AddEdgePeriodicityWithoutFaces(source_edge, target_edge)
-
- j += 1
-
- source_vertices = geompy.SubShapeAll(source_edge, geompy.ShapeType["VERTEX"])
- for source_vertex in source_vertices:
- geompy.addToStudyInFather(edges1, source_vertex, "source_vertex_%i"%k)
- target_vertex_tmp = geompy.MakeTranslation(source_vertex, 10, 0., 0)
- target_vertex_tmp = f_transf(source_vertex)
- target_vertex = geompy.GetSame(part, target_vertex_tmp)
- geompy.addToStudyInFather(edges2, target_vertex, "target_vertex_%i"%k)
- algo2d.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
-
- k += 1
-
-AddAdvancedEdgesPeriodicity(bottom, right, rota_z)
+algo2d.AddAdvancedEdgesPeriodicity(bottom, right, rota_z)
Mesh.Compute()
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
import salome