powfacpy.PFBaseInterface
- class powfacpy.PFBaseInterface(app, language=None)
Base interface for interaction with the PF database.
- __init__(app, language=None)
Methods
__init__
(app[, language])activate_study_case
(path)Activate study case under path.
add_results_variable
(obj, variables[, ...])Adds variables of the object to the PowerFactory results object (ElmRes) obj: PowerFactory object or its path
copy_obj
(obj_or_path, target_folder[, ...])Copies object(s) by using 'get_obj' in first step and the copying the returned objects to 'target_folder'.
copy_single_obj
(obj_or_path, target_folder)Copies single object by using 'get_single_obj' in first step and the copying the returned objects to 'target_folder'.
create_by_path
(path[, overwrite])Create an object by specifying its path including its class and return the object. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_by_path(r"LibraryDynamic Modelsdummy.BlkDef") .
create_directory
(directory[, parent_folder])Create a directory of folders ('IntFolder') if the directory does not yet exist. Arguments: path: path of folders parent_folder: If not specified, the active project folder is used.
create_in_folder
(folder, obj[, overwrite])Creates an obj inside a folder and returns the object. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_in_folder("LibraryDynamic Models","dummy2.BlkDef").
delete_obj
(obj_or_path[, condition, ...])Delete object(s).
get_active_project
()Returns the currently active project and throws an error if no prject has been activated.
get_active_user_folder
()Return the folder of the active user.
get_attr
(obj, attr[, parent_folder])Get the value of an attribute of an object.
get_attr_by_path
(path_with_attr)get_by_condition
(objects, condition)From a list of objects, get those for whom the 'condition' (which is a function) returns 'True'. Example: pfbi.get_by_condition(list_of_objects,lambda x : getattr(x,"uknom")==110).
get_first_level_folder
(folder)Returns folder on first level of PF database.
get_multiple_obj_from_similar_sub_directories
(...)Returns multiple objects that are in a similar subdirectory relativ to their parent folders. Arguments: parents: Parent folders (string path,list of objects/string paths) sub_path: Path within the parent folders (string). Must be unique (don't use placeholders '*').
get_obj
(path[, condition, parent_folder, ...])Returns the PowerFactory object(s) under 'path'. 'path' can contain wildcards ("*") after the last "". A condition may be specified as a function, for example to check certain attributes with lambda function: (eg. "condition = lambda x : getattr(x,"uknom")==110)". By default, the 'path' is relative to the folder of the active project. Only if 'parent_folder' is specified, it is relative to that folder. The parent_folder can be a PF container object or a string: parent_folder = "user" means 'path' is relative to the active user instead of the active project. An error is raised if no object is found, unless 'error_if_non_existent=False'.
get_parameter_value_string
(parameters[, ...])get_path_of_object
(obj)get_single_obj
(path[, parent_folder, ...])Use this method if you want to access one single unique object.
handle_condition_of_obj_not_met
(path, obj, ...)Handles the attempted access to an object with a certain condition that does not exist.
handle_inclusion_of_subfolders
(path, ...)If subfolders are included, 'GetChildren' must be used instead of 'GetContents'.
handle_non_existing_obj
(path, parent_folder, ...)Handles the attempted access to a non existent object.
handle_pf_object_or_path_input
(obj_or_path)Handles the input argument when a method accepts either
handle_single_pf_object_or_path_input
(obj[, ...])Handles the input argument when a method accepts either
is_container
(obj)Checks whether a PF object is a container.
path_exists
(path[, parent, return_info])Check if the path exists.
set_attr
(obj, params[, parent_folder])Set the attribute(s) of an object.
set_attr_by_path
(path_with_attr, value)path_with_attr: path of object plus the attribute name Example: pfbi.set_attr_by_path(self, "LibraryDynamic ModelsLinear_interpolationdesc",["description"]) Here 'desc' is the name of the attribute. .
Attributes
language