smesh/doc/salome/examples/create_penta_biquad.py

43 lines
1.4 KiB
Python
Raw Normal View History

2017-09-19 14:38:41 +05:00
# -*- coding: utf-8 -*-
import sys
import salome
salome.salome_init_without_session()
2017-09-19 14:38:41 +05:00
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
unPentaBiQuad = smesh.Mesh()
nodeID = unPentaBiQuad.AddNode( 0, 0, 0 )
nodeID = unPentaBiQuad.AddNode( 10, 0, 0 )
nodeID = unPentaBiQuad.AddNode( 0, 10, 0 )
nodeID = unPentaBiQuad.AddNode( 0, 0, 10 )
nodeID = unPentaBiQuad.AddNode( 10, 0, 10 )
nodeID = unPentaBiQuad.AddNode( 0, 10, 10 )
nodeID = unPentaBiQuad.AddNode( 5, 0, 0 )
nodeID = unPentaBiQuad.AddNode( 7, 7, 0 )
nodeID = unPentaBiQuad.AddNode( 0, 5, 0 )
nodeID = unPentaBiQuad.AddNode( 5, 0, 10 )
nodeID = unPentaBiQuad.AddNode( 7, 7, 10 )
nodeID = unPentaBiQuad.AddNode( 0, 5, 10 )
nodeID = unPentaBiQuad.AddNode( 0, 0, 5 )
nodeID = unPentaBiQuad.AddNode( 10, 0, 5 )
nodeID = unPentaBiQuad.AddNode( 0, 10, 5 )
nodeID = unPentaBiQuad.AddNode( 5, -1, 5 )
nodeID = unPentaBiQuad.AddNode( 8, 8, 5 )
nodeID = unPentaBiQuad.AddNode( -1, 5, 5 )
volID = unPentaBiQuad.AddVolume( [ 4, 5, 6, 1, 2, 3, 10, 11, 12, 7, 8, 9, 13, 14, 15, 16, 17, 18 ] )
infos = unPentaBiQuad.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] != 1):
raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1")
## Set names of Mesh objects
smesh.SetName(unPentaBiQuad.GetMesh(), 'unPentaBiQuad')
if salome.sg.hasDesktop():
2017-12-29 18:20:32 +05:00
salome.sg.updateObjBrowser()