class
ILibraryConfigurationExtension.
ILibraryConfigurationExtension
Bases: object
Library Extensions for IScriptApplication (based on IScriptObject) and IScriptProject
make_auto_mapping
replaceExistingLegacyMappings=False
reportChanges=False
Automatically map and update of the libraries to the best matching versions.
replaceExistingLegacyMappings (bool) -- If TRUE, also replace legacy mappings. (This parameter is optional, the default value is FALSE)
reportChanges (bool) -- If TRUE, updated libraries will be reported to the standard output. (This parameter is optional, the default value is FALSE)
This example shows how to update the libraries:
p = projects.primary
app = p.active_application
libmgr = app.get_library_manager()
if libmgr.is_current_mapping_valid():
print("Mapping is valid")
else:
print("Updating all libraries")
libmgr.make_auto_mapping()
get_invalid_library_mappings
Retrieves a list with full names of libraries which have references that cause conflicts.
A list with full names of the libraries in conflict state
string[]
This example shows how to retrieve invalid mappings from project and application
p = projects.primary
libmgr = p.get_library_manager()
print("Verifying project library mappings")
if not libmgr.is_current_mapping_valid():
for lib in libmgr.get_invalid_library_mappings():
print("Library reference cannot be satisfied for: " + lib)
else:
print("All mappings valid")
app = p.active_application
libmgr = app.get_library_manager()
print("Verifying application library mappings")
if not libmgr.is_current_mapping_valid():
for lib in libmgr.get_invalid_library_mappings():
print("Library reference cannot be satisfied for: " + lib)
else:
print("All mappings valid")
is_current_mapping_valid
Verifies whether the mapping of the library references is valid.
Returns TRUE if the mappings are valid or FALSE otherwise.
bool
This example shows how to verify the validity of the mappings and retrieve the invalid mappings:
p = projects.primary
libmgr = p.get_library_manager()
print("Verifying project library mappings")
if not libmgr.is_current_mapping_valid():
for lib in libmgr.get_invalid_library_mappings():
print("Library reference cannot be satisfied for: " + lib)
else:
print("All mappings valid")
app = p.active_application
libmgr = app.get_library_manager()
print("Verifying application library mappings")
if not libmgr.is_current_mapping_valid():
for lib in libmgr.get_invalid_library_mappings():
print("Library reference cannot be satisfied for: " + lib)
else:
print("All mappings valid")
is_library_forward_compatible
libDisplayName
Verifies whether the given library is a forward compatible library.
libDisplayName (string) -- Display name of the library.
Returns TRUE if the given library is forward compatible or FALSE otherwise.
bool
This example shows iterates through all referenced libraries of the application and verifies whether they are forward compatible:
p = projects.primary
app = p.active_application
libmgr = app.get_library_manager()
print("# Verifying all libraries:")
for lib in libman.get_libraries():
print("- " + lib + " Is Forward Compatible Library? " + str(libmgr.is_library_forward_compatible(lib)))
set_new_library_version
libName
libVendor
newLibVersion
Explicitly sets a specific version mapping for the given library.
libName (string) -- Name of the library.
libVendor (string) -- The library vendor.
newLibVersion (string) -- The new library version. NULL (Python: None) for Legacy
This example shows the various methods for setting the referenced library version
p = projects.primary
app = p.active_application
libmgr = app.get_library_manager()
# set version using individual parameters
libmgr.set_new_library_version("PD_GlobalDiagnostics", "Schneider Electric", "1.0.1.0")
# set version using the library full name
libmgr.set_new_library_version("PD_AxisModule, 1.1.6.0 (Schneider Electric)", "1.2.4.0")
# set version to Legacy
libmgr.set_new_library_version("PD_Template", "Schneider Electric", None)