Example #1
0
""" Example to show the use of the additional parameters
"""

# import and init advcubit
import advcubit

advcubit.init('/Applications/Cubit-15.1/Cubit.app/Contents/MacOS', False)
import cubit

# start cubit
advcubit.startCubit()

# create a circle
circle = advcubit.createCircle(1)
# create a surface from circle
surface = cubit.create_surface([circle]).surfaces()[0]

# set meshing scheme, use the additional parameters for advanced control
advcubit.setMeshScheme(surface,
                       advcubit.SurfaceMeshSchemes.circle,
                       fraction=0.5,
                       interval=3)
# mesh surface
surface.mesh()
# sweep the surface, include the mesh using a parameter
body = advcubit.sweepVector(circle, (0, 0, -1), 'include_mesh')

# create block and export
advcubit.createBlock(body, 1)
advcubit.export('param.e')
Example #2
0
#!/bin/python

import unittest
import sys
import advcubit

# import test suits
import tests

print('Running advcubit test suite:')

try:
    advcubit.init(silentMode=False)
except EnvironmentError as e:
    print('Error initializing advcubit. $PYTHON_PATH must be set!\n' + str(e))
    sys.exit(1)

# run tests
testSuite = tests.testSuite()
try:
    unittest.main(defaultTest='testSuite')
finally:
    # clean journal files
    advcubit.deleteJournalFiles()
Example #3
0
""" Example file to show the difference of the cmd command
"""

# import and init advcubit
import advcubit
advcubit.init('/Applications/Cubit-15.1/Cubit.app/Contents/MacOS', False)
import cubit

# start cubit
advcubit.startCubit()

# use the originally cmd function
print('First try the original cmd')
try:
    # execute a wrong command
    cubit.cmd('this is not a command')
    # passed command, print it
    print('#' * 80)
    print('No error found in cubit.cmd')
# catch a possible error
except Exception as e:
    print('#' * 80)
    print('We got an error with cubit.cmd:\n' + str(e))
# print that we are done
print('Done!!!')
print('#' * 80)


# use the advanced cmd function
print('Lets try the advcubit cmd')
try:
Example #4
0
""" Basic example file for advcubit
"""

# import the package
import advcubit
# initialize advcubit
advcubit.init()

# start cubit
advcubit.startCubit()
# create a simple brick
brick = advcubit.brick(1, 1, 1)
# find top surface
topSurface = advcubit.findSurfaceWithNormal(brick.surfaces(), (0, 0, 1), 0)[0]
# apply scheme
advcubit.setMeshScheme(topSurface, advcubit.SurfaceMeshSchemes.tri)
# mesh surface
advcubit.mesh(topSurface)
# set volume mesh scheme
advcubit.setMeshScheme(brick, advcubit.VolumeMeshSchemes.sweep)
# mesh volume
advcubit.mesh(brick)
# create block
advcubit.createBlock(brick, 1)
# name block
advcubit.nameBlock(1, 'mein_block')
# set second order mesh
advcubit.setElementType(1, advcubit.VolumeElementTypes.WEDGE15)
# export to exodus
advcubit.export('basic.e', True)
# close cubit
Example #5
0
""" Example file to show the difference of the cmd command
"""

# import and init advcubit
import advcubit
advcubit.init(None, False)
import cubit

# start cubit
advcubit.startCubit()

# use the originally cmd function
print('First try the original cmd')
try:
    # execute a wrong command
    cubit.cmd('this is not a command')
    # passed command, print it
    print('#' * 80)
    print('No error found in cubit.cmd')
# catch a possible error
except Exception as e:
    print('#' * 80)
    print('We got an error with cubit.cmd:\n' + str(e))
# print that we are done
print('Done!!!')
print('#' * 80)

# use the advanced cmd function
print('Lets try the advcubit cmd')
try:
    # execute a wrong command