#!/usr/bin/env python3

###
### This file is generated automatically by SALOME v9.13.0 with dump python functionality
###

import sys
import salome

salome.salome_init()

###
### GEOM component
###

import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS


geompy = geomBuilder.New()

O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Plane_1 = geompy.MakePlane(O, OZ, 200)
Plane_2 = geompy.MakePlane(O, OZ, 50)
Extrusion_1 = geompy.MakePrismVecH(Plane_1, OZ, 200)
Extrusion_2 = geompy.MakePrismVecH(Plane_2, OZ, 50)
Cut_1 = geompy.MakeCutList(Extrusion_1, [Extrusion_2], True)
Plane_1.SetAutoColor(1)
Plane_2.SetAutoColor(1)
Plane_2.SetAutoColor(1)
Extrusion_1.SetAutoColor(1)
Extrusion_2.SetAutoColor(1)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( Plane_2, 'Plane_2' )
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
geompy.addToStudy( Cut_1, 'Cut_1' )

###
### SMESH component
###

import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder

smesh = smeshBuilder.New()
#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
                                 # multiples meshes built in parallel, complex and numerous mesh edition (performance)

Number_of_Segments_1 = smesh.CreateHypothesis('NumberOfSegments')
Number_of_Segments_1.SetNumberOfSegments( 25 )
Mesh_1 = smesh.Mesh(Cut_1,'Mesh_1')
Cartesian_3D = Mesh_1.BodyFitted()
Body_Fitting_Parameters_1 = Cartesian_3D.SetGrid([ [ '5' ], [ 0, 1 ]],[ [ '5' ], [ 0, 1 ]],[ [ '5' ], [ 0, 1 ]],5,0)
Body_Fitting_Parameters_1.SetSizeThreshold( 5 )
Body_Fitting_Parameters_1.SetToAddEdges( 0 )
Body_Fitting_Parameters_1.SetToUseThresholdForInternalFaces( 1 )
Body_Fitting_Parameters_1.SetGridSpacing( [ '5' ], [ 0, 1 ], 0 )
Body_Fitting_Parameters_1.SetGridSpacing( [ '5' ], [ 0, 1 ], 1 )
Body_Fitting_Parameters_1.SetGridSpacing( [ '5' ], [ 0, 1 ], 2 )
isDone = Mesh_1.Compute()
Mesh_1.CheckCompute()


## Set names of Mesh objects
smesh.SetName(Number_of_Segments_1, 'Number of Segments_1')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Body_Fitting_Parameters_1, 'Body Fitting Parameters_1')
smesh.SetName(Cartesian_3D.GetAlgorithm(), 'Cartesian_3D')


if salome.sg.hasDesktop():
  salome.sg.updateObjBrowser()
