# Make Symmetry¶

There are three differents ways to make the symmetry of an element:

• Symmetry by point

• Symmetry by line

• Symmetry by plane

## Symmetry by point¶

To make the symmetry of an element by point, you need to define:

• the element

• the symmetry center

```elts = doc.makeSymmetryPoint (grid, orig)
```

Operations on elts: Elements

Here is an example where we make the symmetry of a grid:

### Example¶

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60``` ```# -*- coding: latin-1 -*- # Copyright (C) 2009-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # ######## Make Symmetry Point ######## import hexablock # ======================================================= make_grid def make_grid (doc) : ori = doc.addVertex ( 0, 0, 0) vz = doc.addVector ( 0, 0, 1) vx = doc.addVector ( 1 ,0, 0) dr = 1 da = 360 dl = 1 nr = 1 na = 6 nl = 1 grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) ##### doc .saveVtk ("cyl_grid.vtk") return grid # ======================================================= test_sym_point def test_sym_point () : doc = hexablock.addDocument ("default") grid = make_grid (doc) orig = grid.getVertex(3) grid2 = doc.makeSymmetryPoint (grid, orig) ##### doc .saveVtk ("sym_point.vtk") return doc # ================================================================= Begin doc = test_sym_point () ```

### Result¶

Initial

Symmetry of a grid by point

## Symmetry by line¶

To make the symmetry of an element by line, you need to define:

• the element

• a point and a direction to define the line of symmetry

```elts = doc.makeSymmetryLine (grid, orig, dir)
```

Operations on elts: Elements

### Code¶

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60``` ```# -*- coding: latin-1 -*- # Copyright (C) 2009-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # ######## Make Symmetry Line ######## import hexablock # ======================================================= make_grid def make_grid (doc) : ori = doc.addVertex ( 0, 0, 0) vz = doc.addVector ( 0, 0, 1) vx = doc.addVector ( 1 ,0, 0) dr = 1 da = 360 dl = 1 nr = 1 na = 6 nl = 1 grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) ##### doc .saveVtk ("cyl_grid.vtk") return grid # ======================================================= test_sym_line def test_sym_line () : doc = hexablock.addDocument ("default") grid = make_grid (doc) orig = grid.getVertex(3) dir = doc.addVector (0, 0, 1); grid2 = doc.makeSymmetryLine (grid, orig, dir) ##### doc .saveVtk ("sym_line.vtk") return doc # ================================================================= Begin doc = test_sym_line () ```

### Result¶

Symmetry of a grid by line

## Symmetry by plane¶

To make the symmetry of an element by plane, you need to define:

• the element

• a point and a direction to define the plane of symmetry

```elts = doc.makeSymmetryPlane (grid, orig, dir)
```

Operations on elts: Elements

### Code¶

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59``` ```# -*- coding: latin-1 -*- # Copyright (C) 2009-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # ######## Make Symmetry Plane ######## import hexablock # ======================================================= make_grid def make_grid (doc) : ori = doc.addVertex ( 0, 0, 0) vz = doc.addVector ( 0, 0, 1) vx = doc.addVector ( 1 ,0, 0) dr = 1 da = 360 dl = 1 nr = 1 na = 6 nl = 1 grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) ##### doc .saveVtk ("cyl_grid.vtk") return grid # ======================================================= test_sym_plane def test_sym_plane () : doc = hexablock.addDocument ("default") grid = make_grid (doc) orig = grid.getVertex(3) dir = doc.addVector (0, 1, 0); grid2 = doc.makeSymmetryPlane (grid, orig, dir) ##### doc .saveVtk ("sym_plane.vtk") return doc # ================================================================= Begin doc = test_sym_plane () ```

### Result¶

Symmetry of a grid by plane

GUI command: Make elements by symmetry