Import STEP files with python3 not working outside GUI

Trelis Version: Cubit 2020.2 and Cubit 2021.4
Platform: Windows 10

Issue
As part of a python script I am trying to import a number of STEP files.
This works fine when running the python file inside the GUI.
When running the script from command line or from pycharm, STEP files don’t get imported. Here I’ve tried using both system python3 or Cubit embedded python3.
The step_import.log file reports that SPAXStep is not loaded (see message below).
This seems to be specific to python3, because using python2 STEP files do get imported.
Anyone experienced the same?
Any tips?


Warning : SPAXStep library not loaded.
Finish Time : Thu Apr 29 11:36:50 2021


Translation Result : Failure


The step libraries are an add on to the standard ACIS libraries. You will need to add an additional path.

Here is how I was able to start up with python 3.8.

import sys
sys.path.append("sys.path.append(“C:\Program Files\Coreform Cubit 2021.4\bin”)
sys.path.append("sys.path.append(“C:\Program Files\Coreform Cubit 2021.4\bin\acis\code\bin”)
import cubit
cubit.init([“cubit”, “-nojournal”])
cubit.cmd(“brick x 10”)
cubit.cmd("export step ‘brick.stp’ ")

Thanks Karl,

I had append the acis\code\bin already to sys.
So that wasn’t the issue.
Your example, and my code works perfect with python 2.7.18 that shipped with Cubit, and also with system python 2.
But results in failure messages both for step import and export using python 3.8.6 that comes with Cubit.
I have tried on a second machine (also Windows 10), same behavior there.
Any other suggestions?

I’m going to have to dig into this one. Here was my process.

  1. I downloaded the latest 2021.4 release installed it on my Windows 10 machine.
  2. I copied the Cubit learn license from my existing 2021.3 install and put the license in the 2021.4 bin/license folder.
  3. I have python 3.7.9 installed natively on this machine so I started the python installed inside of Cubit.
    a) C:\Program Files\Coreform Cubit 2021.4\bin\python3\python test.py

The file test.py contains the script from the previous post. I generate the correct STEP file, brick.stp.

Hi Karl,

Thanks for trying. I tried the same procedure as you specified, using this test.py script, on two machines, using two versions, and both paid and cubit-learn license.
Unfortunately no success (see screenshot below).
I also tried re-installing 2021.4, just to double-check.
Anything else I could try?
For now I can move on using python 2, but will need python3 at some point.

screenshot of ‘step_export.log’

I have been unable to replicate this problem. I will turn this over to our QA people and see if they can determine what is happening. We will likely deprecate python 2 at some point, so this is an important issue for us as well.

Thanks,
Karl

Thanks,

Feel free to get in touch if you need more info from me to figure out what’s happening.