From 25c9e04a6124e27fe14819df0af79cfbfd338e93 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 30 Aug 2017 22:08:24 +0300 Subject: [PATCH] IPAL54306: IMACS Support: Section of a mesh with a plane 1) add an example 2) fix a bug --- doc/salome/examples/ex_MakePolyLine.py | 34 ++++++++++++++++++++++++++ src/SMESH/SMESH_MeshEditor.cxx | 3 +-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 doc/salome/examples/ex_MakePolyLine.py diff --git a/doc/salome/examples/ex_MakePolyLine.py b/doc/salome/examples/ex_MakePolyLine.py new file mode 100644 index 000000000..354a1d765 --- /dev/null +++ b/doc/salome/examples/ex_MakePolyLine.py @@ -0,0 +1,34 @@ +import salome +salome.salome_init() + +### create geometry + +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +geompy.addToStudy( Box_1, 'Box_1' ) + +### create a mesh + +import SMESH +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +Mesh_1 = smesh.Mesh( Box_1 ) +Mesh_1.Segment().NumberOfSegments(15) +Mesh_1.Triangle() +Mesh_1.Compute() + +# define arguments for MakePolyLine + +segments = [] +segments.append( SMESH.PolySegment( 20, 0, 1, 0, smesh.MakeDirStruct(0,0,0) )) +segments.append( SMESH.PolySegment( 1, 0, 200, 0, smesh.MakeDirStruct(0,0,0) )) +segments.append( SMESH.PolySegment( 200, 0, 578, 577, smesh.MakeDirStruct(1,1,1) )) + +Mesh_1.MakePolyLine( segments, "1D group") + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(True) diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 7b7c1a40e..8c5de25a4 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -12921,8 +12921,7 @@ namespace // utils for MakePolyLine { ok = ( myDot1 != myDot2 ); if ( ok && myFace ) - ok = ( myFace->GetNodeIndex( myNode1._node ) < 0 && - myFace->GetNodeIndex( myNode2._node ) < 0 ); + ok = ( myFace->GetNodeIndex(( myDot1 == 0 ? myNode1 : myNode2 )._node ) < 0 ); } if ( ok ) { -- 2.39.2