Following the advice on the page, I'm instead going to issue a Python subprocess.run( cli_command, shell=True, check=True) from my master script. The cli_command will look something like: freecadcmd UpdateGeometry.py, however, I need to pass a variable into the UpdateGeometry.py script as a system argument (e.g. sys.argv[-1]). But I've looked high and low and can't seem to find any way to pass an argument into a script called in this manner.Since the FreeCAD Python module is compiled from C++ (rather than being a pure Python module), it can only be imported from a compatible Python interpreter. Generally this means that the Python interpreter must be compiled with the same C compiler as was used to build FreeCAD. Information about the compiler used to build a Python interpreter (including the one built with FreeCAD) can be found as follows
This process is the same thing I do in my current Abaqus workflow, e.g. master script, uses subprocess.run to call a CLI executable, with an input Python script that accepts CLI arguments. The syntax for doing this with Abaqus is:
Code: Select all
abaqus cae script=try.py -- argument1 argument2 argument3
Code: Select all
cli_command = f"abaqus cae script=UpdateGeometry.py -- {innerRadius} {outerRadius} {thickness}"
subprocess.run( cli_command, shell=True, check=True )