68 lines (55 with data), 1.8 kB
// Preliminary example of how to create a python utility functions
// and use them from AnyBody. In this case we have made some functions
// from Python's os.path module available in AMS.
//
// #include "<ANYBODY_PATH_MODELUTILS>/Python/Utils.any"
// AnySwitchVar file_exists = PyUtils.os.path.exist("some-file")
//
// Note: To add more function you need to modify both this file and the
// ams_python_utils.py file.
//Will only work in AMS > 7.2.1
#if (ANYBODY_V1 > 7)|(ANYBODY_V1 == 7 & ANYBODY_V2 > 2)|(ANYBODY_V1 == 7 & ANYBODY_V2 == 2 & ANYBODY_V3 >= 1)
AnyFolder PyUtils = {
AnyFunEx get_current_file = {
AnyString Return = "";
AnyFunExMonoPy get_current_file = {
ModuleFile = "ams_python_utils.py";
ArgList = {};
};
};
AnyFolder os =
{
AnyFolder path =
{
AnyFunEx exists = {
AnyInt Return = 0;
AnyFunExMonoPy os_path_exists = {
ModuleFile = "ams_python_utils.py";
ArgList = {AnyString path = ""; };
};
};
AnyFunEx dirname = {
AnyString Return = "";
AnyFunExMonoPy os_path_dirname = {
ModuleFile = "ams_python_utils.py";
ArgList = {AnyString path = ""; };
};
};
AnyFunEx abspath = {
AnyString Return = "";
AnyFunExMonoPy os_path_abspath = {
ModuleFile = "ams_python_utils.py";
ArgList = {AnyString path = ""; };
};
};
AnyFunEx basename = {
AnyString Return = "";
AnyFunExMonoPy os_path_basename = {
ModuleFile = "ams_python_utils.py";
ArgList = {AnyString path = ""; };
};
};
};
};
};
#endif