Python API on a Mac

I am trying to follow the examples, but I cannot import the Python API on a Mac.
I don’t see the library in the download either.
Can any one help please?

Hi @Dave,
the python api is loaded automatically when you start cubit.

just type

#!python
cubit.get_version()

into the command line. that will for example output the cubit version.

with #!cubit and #!python you can switch between cubit and python mode in the command line. you could also just press the symbols for this.
grafik

The available functions can be found in the documentation.
https://coreform.com/cubit_help/cubithelp.htm#t=python%2Fnamespace_cubit_interface.htm

Thank you. But I would like to import the cubit library into an existing python code?
Any help would be great.

You should be able to import cubit like this

import sys
sys.path.append("/Applications/Coreform-Cubit-2024.6.app/Contents/lib") # Or wherever it was installed

import cubit
cubit.init(["-noinit", "-nojournal", "-nographics"]) # Or whatever options you want

Thank you.
When I run this I get:
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘cubit’

Any help would be brilliant. I’m using python version 3.10.12

In the path for Cubit there should reside the file cubit.py

If its not there then search for cubit.py and add that directory to the path.