2017-09-19 14:38:41 +05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import salome
|
|
|
|
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2017-09-19 14:38:41 +05:00
|
|
|
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
import math
|
|
|
|
import SALOMEDS
|
|
|
|
|
2017-12-29 18:20:32 +05:00
|
|
|
geompy = geomBuilder.New()
|
2017-09-19 14:38:41 +05:00
|
|
|
|
|
|
|
O = geompy.MakeVertex(0, 0, 0)
|
|
|
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
|
|
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
|
|
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
|
|
|
Divided_Disk_1 = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
|
|
|
|
geompy.addToStudy( O, 'O' )
|
|
|
|
geompy.addToStudy( OX, 'OX' )
|
|
|
|
geompy.addToStudy( OY, 'OY' )
|
|
|
|
geompy.addToStudy( OZ, 'OZ' )
|
|
|
|
geompy.addToStudy( Divided_Disk_1, 'Divided Disk_1' )
|
|
|
|
|
|
|
|
import SMESH, SALOMEDS
|
|
|
|
from salome.smesh import smeshBuilder
|
|
|
|
|
2017-12-29 18:20:32 +05:00
|
|
|
smesh = smeshBuilder.New()
|
2017-09-19 14:38:41 +05:00
|
|
|
aFilterManager = smesh.CreateFilterManager()
|
|
|
|
Mesh_1 = smesh.Mesh(Divided_Disk_1)
|
|
|
|
Regular_1D = Mesh_1.Segment()
|
|
|
|
Number_of_Segments_1 = Regular_1D.NumberOfSegments(6)
|
|
|
|
Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
|
|
|
|
isDone = Mesh_1.Compute()
|
2023-02-21 18:59:44 +05:00
|
|
|
if not isDone:
|
|
|
|
raise Exception("Error when computing Mesh")
|
|
|
|
|
2017-09-19 14:38:41 +05:00
|
|
|
aMaxElementLength2D0x5d7fdf0 = aFilterManager.CreateMaxElementLength2D()
|
|
|
|
isDone = Mesh_1.QuadToTriObject( Mesh_1, )
|
|
|
|
Mesh_1.ExtrusionSweepObjects( [ Mesh_1 ], [ Mesh_1 ], [ Mesh_1 ], [ 0, 0, 50 ], 3, 1 )
|
|
|
|
Mesh_1.ConvertToQuadratic(0, Mesh_1,True)
|
|
|
|
|
|
|
|
infos = Mesh_1.GetMeshInfo()
|
2017-12-29 18:20:32 +05:00
|
|
|
print("Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta])
|
2017-09-19 14:38:41 +05:00
|
|
|
if (infos[SMESH.Entity_BiQuad_Penta] != 1080):
|
|
|
|
raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1080")
|
|
|
|
|
|
|
|
## Set names of Mesh objects
|
|
|
|
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
|
|
|
|
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
|
|
|
|
smesh.SetName(Number_of_Segments_1, 'Number of Segments_1')
|
|
|
|
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
|
|
|
|
|
|
|
|
|
|
|
|
if salome.sg.hasDesktop():
|
2017-12-29 18:20:32 +05:00
|
|
|
salome.sg.updateObjBrowser()
|