Example #1
0
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')

# close cubit and clean
advcubit.closeCubit()
advcubit.deleteJournalFiles()
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()