I want to use vscode or pycharm(windows 10) for programming,how to do that?
Are you asking how to use the API? You might look at the Trelis Help under Appendix/Python or online here:
I want to code a small trelis’ program by vscode(Windows 10).But vscode keeps bothering me about “ModuleNotFoundError: No module named ‘_cubit’”.And I add the cubit.py to the PATH but it makes no differents.
You might need to make the cubit.init() call:
Importing Cubit into Python
Python users are able to import Cubit into Python and make calls into Cubit via CubitInterface and the other Python classes described in this section. Below is a simple Python script. The key parts are ensuring the Cubit libraries are on the path and ensuring the cubit.init() call is made first.
import sys
add Cubit libraries to your path
sys.path.append(’/opt/cubit/bin’)
import cubit
#start cubit - this step is key cubit.init does not require any arguments. If you do want to provide arguments, you must provide 2 or more, where the first must be “cubit”, and user args start as the 2nd argument. If only one argument is used, it will be ignored.
cubit.init([‘cubit’,’-nojournal’])
x_val = 1.2
y_val = 1.4
z_val = 1.1
cubit.cmd(‘bri x {0} y {1} z {2}’.format(x_val, y_val, z_val))
cubit.cmd(‘mesh vol all’)
node_list = cubit.parse_cubit_list(‘node’, ‘in volume 1’)
#etc…
it’s working now.thank u