Library¶
Read and manage loaded and embedded libraries, library parts, GDL parameters and library-part content.
Access this group through api.tapir.library.
Commands¶
No commands match. Try another name or clear the filter.
For exceptions shared by Unified API commands, see error handling.
add_files_to_embedded_library ¶
add_files_to_embedded_library(
files: list[LibraryFileAddition],
overwrite_existing: None | bool = None,
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Adds the given files into the embedded library. With the overwriteExisting flag an embedded library item already existing on an outputPath is replaced (Archicad 27 or newer).
Parameters:
-
files(list[LibraryFileAddition]) –A list of library file additions to the embedded library
-
overwrite_existing(None | bool, default:None) –Optional. When true, an embedded library item already existing on an outputPath is deleted first, so the newly added file replaces the loaded library part. By default false: the existing loaded part stays in use. Requires Archicad 27 or newer.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
add_libraries ¶
add_libraries(
libraries: list[LibraryLocation],
) -> SuccessfulExecutionResult
Adds the given folders to the project's local libraries, skipping any already loaded.
Parameters:
-
libraries(list[LibraryLocation]) –Local library folders or container files, by absolute path.
Returns:
check_libraries ¶
check_libraries() -> SuccessfulExecutionResult
Checks the loaded libraries with the Archicad API's library check. Returns the error the API reports, if any.
Returns:
compare_library_part_un_ids ¶
compare_library_part_un_ids(
un_id_1: str, un_id_2: str
) -> CompareLibraryPartUnIdsResult
Compares two library part unique IDs with Archicad's own comparison and tells whether their main and revision GUIDs are the same.
Parameters:
-
un_id_1(str) –A library part unique ID, '{main GUID}-{revision GUID}', as GetLibraryPartIdentities returns it.
-
un_id_2(str) –The library part unique ID to compare unId1 with.
Returns:
copy_files_into_embedded_library ¶
copy_files_into_embedded_library(
files: list[EmbeddedLibraryFile],
target_folder: None | str = None,
overwrite_if_exists: None | bool = None,
) -> SuccessfulExecutionResult
Copies the given files, keeping their names, into a folder of the embedded library with one library operation. The target folder is created when it is missing. With overwriteIfExists an item of the same name in that folder is replaced.
Parameters:
-
files(list[EmbeddedLibraryFile]) –The files to copy. Each keeps its file name inside the target folder.
-
target_folder(None | str, default:None) –Optional. The folder relative to the embedded library to copy the files into, for example 'Office/Doors'. Missing folders are created. By default the root of the embedded library.
-
overwrite_if_exists(None | bool, default:None) –Optional. When true, an item with the same name in the target folder is replaced. By default false.
Returns:
copy_library_parts ¶
copy_library_parts(
library_parts: list[LibraryPartCopyData],
) -> CopyLibraryPartsResult
Copies loaded library parts, given by name or by an element placed from them, under a new file name into a folder, by default the embedded library. The copy gets a new unique ID unless the main GUID is kept. An existing file is never overwritten. The libraries are reloaded once afterwards, so the copies can be found by name. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartCopyData]) –The library parts to copy, each given by its name or by an element placed from it, with the name of the copy.
Returns:
create_folder_in_embedded_library ¶
create_folder_in_embedded_library(
folder_path: str,
) -> SuccessfulExecutionResult
Creates a folder, with any missing parent folders, inside the embedded library. The folderPath is relative to the embedded library, like the outputPath of AddFilesToEmbeddedLibrary.
Parameters:
-
folder_path(str) –The path of the folder relative to the embedded library, for example 'Office/Doors'. Missing parent folders are created too; folders that already exist are kept.
Returns:
create_library_part ¶
create_library_part(
path: str, ancestor_subtype: str
) -> CreateLibraryPartResult
Creates a new library part file (.gsm) of the given loaded subtype, inheriting its parameters, and reports whether it is loaded with its index and names. Available from Archicad 28.
Parameters:
-
path(str) –The full path of the new library part file. It must end with .gsm, must not exist yet, and its folder must exist.
-
ancestor_subtype(str) –The name of a loaded library part that is a subtype, with its extension, as returned in the fileName field of GetAvailableLibraryParts. The new object is of this subtype and inherits its parameters.
Returns:
create_library_part_from_elements ¶
create_library_part_from_elements(
name: str,
elements: list[ElementIdArrayItem],
parent_id: None | str = None,
parent_name: None | str = None,
folder: None | str = None,
library_folder: None | str = None,
overwrite: None | bool = None,
placeable: None | bool = None,
scripts: None | Scripts = None,
comment: None | str = None,
keywords: None | str = None,
) -> CreateLibraryPartFromElementsResult
Creates a library part in the embedded library (or in a given local library folder, which is added to the loaded libraries when needed) whose 2D symbol is a copy of the given 2D drawing elements (lines, polylines, arcs, circles, splines, fills, texts and hotspots), under the given parent subtype, with optional master, 2D, 3D and parameter scripts, comment and keywords. A and B are taken from the extent of the symbol. The elements themselves are not changed.
Parameters:
-
name(str) –The name of the new library part, as shown in the library and used by CreateObjects as libraryPartName.
-
elements(list[ElementIdArrayItem]) –The 2D drawing elements (lines, polylines, arcs, circles, splines, fills, texts and hotspots) whose copies make up the 2D symbol of the new library part. They keep their plan coordinates, so the project origin becomes the origin of the symbol. The elements themselves are not changed.
-
parent_id(None | str, default:None) –The parent subtype of the new library part: its unique ID ('{main}-{revision}') or its main GUID, as GetAvailableLibraryParts reports it. Either parentId or parentName is required. The General GDL Object (the root subtype) cannot be the parent: use the Model Element or one of its subtypes.
-
parent_name(None | str, default:None) –The document name of the parent subtype, e.g. 'General Object' or 'Model Element'; used when parentId is not given.
-
folder(None | str, default:None) –Optional. The folder of the new .gsm file, relative to the embedded library (or to libraryFolder), created when missing. By default the embedded library (or libraryFolder) itself.
-
library_folder(None | str, default:None) –Optional. The absolute path of a local library folder to create the library part in instead of the embedded library. A folder that is not one of the loaded libraries yet is added to them first, and stays added.
-
overwrite(None | bool, default:None) –Optional. When true, a library part file of the same name in the folder is overwritten. By default false: the new library part then gets a unique name, which the response returns.
-
placeable(None | bool, default:None) –Optional. Whether the new library part can be placed. True by default.
-
scripts(None | Scripts, default:None) –Optional. The GDL scripts of the new library part.
-
comment(None | str, default:None) –Optional. The comment (description) of the library part.
-
keywords(None | str, default:None) –Optional. The keywords of the library part.
Returns:
create_library_parts ¶
create_library_parts(
library_parts: list[LibraryPartData],
overwrite_existing: None | bool = None,
) -> list[ErrorItem | LibraryPartCreationDetails]
Creates GDL library parts in the embedded library from their scripts (master, 2D, 3D, parameter, interface, properties) and parameter definitions, under the given parent subtype. The new parts are placeable right away, e.g. with CreateObjects. With the overwriteExisting flag an embedded library item already existing on the path of a new part is replaced (Archicad 27 or newer).
Parameters:
-
library_parts(list[LibraryPartData]) –The library parts to create in the embedded library.
-
overwrite_existing(None | bool, default:None) –Optional. When true, an embedded library item already existing on the path of a new library part is deleted first, so the new one replaces the loaded library part. By default false: creating on an existing path fails. Requires Archicad 27 or newer.
Returns:
-
list[ErrorItem | LibraryPartCreationDetails]–The created library parts, in the order of the input, or the error of each one that could not be created.
delete_embedded_library_items ¶
delete_embedded_library_items(
embedded_library_items: list[EmbeddedLibraryItem],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Deletes the given items from the embedded library. The path of an item is the same relative path that AddFilesToEmbeddedLibrary takes as outputPath. Available from Archicad 27.
Parameters:
-
embedded_library_items(list[EmbeddedLibraryItem]) –A list of embedded library items to delete.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
find_library_parts ¶
find_library_parts(
kind: LibraryPartKind | None = None,
name_contains: None | str = None,
first_only: None | bool = None,
) -> list[FoundLibraryPart]
Finds loaded library parts with the Library Manager: all of them, GDL objects, images or text files, optionally only those whose name contains a text. Returns the name, path and index of each. Available from Archicad 28.
Parameters:
-
kind(LibraryPartKind | None, default:None) – -
name_contains(None | str, default:None) –Optional. Only library parts whose name contains this text, ignoring case.
-
first_only(None | bool, default:None) –Optional. When true, only the first matching library part is returned. By default false.
Returns:
-
list[FoundLibraryPart]–The matching library parts.
get_available_library_parts ¶
get_available_library_parts(
filter_by_type_id: LibraryPartType | None = None,
) -> GetAvailableLibraryPartsResult
Lists library parts currently available to the project. Filter by typeId (e.g. 'Door', 'Window', 'Object', 'Lamp').
Parameters:
-
filter_by_type_id(LibraryPartType | None, default:None) –Optional. Only list the library parts of this type, the typeId of the response. 'Pict' and 'Picture' both list the pictures.
Returns:
get_gdl_parameters_of_library_parts ¶
get_gdl_parameters_of_library_parts(
library_parts: list[LibraryPartGDLParameterQuery],
) -> list[ErrorItem | LibraryPartGDLParameters]
Gets the default GDL parameters (name, display name, type, array dimensions, value, flags) of the given library parts by name, read from the library part without placing it or changing any defaults. The output is in the format of GetGDLParametersOfElements, without isLocked and possibleValues, which need a placed element. To read a part by its file name, as SetLibraryPartParameters writes it, use GetLibraryPartParameterValues.
Parameters:
-
library_parts(list[LibraryPartGDLParameterQuery]) –The library parts to read the default GDL parameters of.
Returns:
-
list[ErrorItem | LibraryPartGDLParameters]–The default GDL parameters of each given library part, in the order of the input, or an error for a name that no loaded library part has.
get_gdl_user_globals ¶
get_gdl_user_globals() -> list[GDLUserGlobal]
Returns the current GDL global variables the GDL interpreter gets, with their names, types and values. Available from Archicad 28.
Returns:
-
list[GDLUserGlobal]–The GDL parameters, in the format GetGDLParametersOfElements uses. Separators, titles and dictionary parameters have no value here and are left out.
get_last_valid_embedded_library_part_name ¶
get_last_valid_embedded_library_part_name() -> (
GetLastValidEmbeddedLibraryPartNameResult
)
Gets the name and file path of the last valid library part of the embedded library.
Returns:
get_libraries ¶
get_libraries() -> list[Library]
Gets the list of loaded libraries. From Archicad 28 a library package also gets its package information (ID, versions, minimum Archicad version and dependencies).
Returns:
-
list[Library]–A list of project libraries.
get_libraries_of_lib_parts ¶
get_libraries_of_lib_parts(
library_parts: list[LibraryPartNameOrGuid],
) -> list[LibraryOfLibraryPart]
Gets the library of each given library part (by file name or guid): display name, location, embedded/built-in/package/local/missing flags and the Library Manager tree path. Available from Archicad 29.
Parameters:
-
library_parts(list[LibraryPartNameOrGuid]) –Library parts to look up, each given by exactly one of name and guid.
Returns:
-
list[LibraryOfLibraryPart]–One entry per input library part, in the same order.
get_library_part_2d_primitives ¶
get_library_part_2d_primitives(
name: str,
element_id: ElementId | None = None,
gdl_context: None | int = None,
) -> list[LibraryPart2DPrimitive]
Gets the lines, arcs and polygons (with their holes, and whether they are fills) of the 2D symbol of a loaded library part, drawn with its default parameters or with the parameters of a placed instance.
Parameters:
-
name(str) –The name of the loaded library part, without the file extension (a trailing '.gsm' is accepted too).
-
element_id(ElementId | None, default:None) –Optional. A placed instance of the library part whose parameters are used for drawing the symbol. Without it the default parameters of the library part are used.
-
gdl_context(None | int, default:None) –Optional. The GDL context the 2D symbol is drawn in, the value of the GLOB_CONTEXT GDL global (2 is the floor plan). Default value is 2.
Returns:
-
list[LibraryPart2DPrimitive]–The lines, arcs and polygons of the 2D symbol, in the order Archicad draws them, in the coordinate system of the library part. Other primitives (texts, hotspots, ...) are not returned.
get_library_part_custom_section ¶
get_library_part_custom_section(
name: str, section_id: int, index: None | int = None
) -> GetLibraryPartCustomSectionResult
Gets a custom section of a loaded library part by its section identifier and index: whether it exists, its data version and its content as base64. Available from Archicad 28.
Parameters:
-
name(str) –The name of the loaded library part file with its extension, as returned in the fileName field of GetAvailableLibraryParts (e.g. 'My Door.gsm').
-
section_id(int) –The type identifier of the custom section. A four-character code is given as its integer value, the first character in the highest byte (e.g. 'ABCD' is 1094861636).
-
index(None | int, default:None) –Optional. The index of the section among the sections with the same identifier. By default 0.
Returns:
get_library_part_details ¶
get_library_part_details(
library_parts: list[LibraryPartNameOrIndex],
sub_type_of: None | str = None,
include_scripts: None | bool = None,
) -> list[ErrorItem | LibraryPartDetails]
Gets the details of loaded library parts, by name or index: path, library tree path, containing library, and for GDL objects the GUID, subtype, license, UI default flag, which scripts and pictures they have, and optionally the interface and migration scripts. Can also tell whether each one is in the subtype of another library part. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartNameOrIndex]) –The library parts to read, each by its name or by its index.
-
sub_type_of(None | str, default:None) –Optional. The name of another loaded library part, e.g. a subtype template. When given, the isInSubTypeOf field of each library part tells whether it is in that subtype.
-
include_scripts(None | bool, default:None) –Optional. When true, the interface script and the forward and backward migration scripts are returned too. By default false.
Returns:
-
list[ErrorItem | LibraryPartDetails]–The details of each given library part, or an error, in the order of the input. A field is omitted when Archicad cannot return it for that library part.
get_library_part_file_info ¶
get_library_part_file_info(
files: list[str],
scripts: None
| list[LibraryPartReadableScriptType] = None,
password: None | str = None,
include_parameters: None | bool = None,
) -> list[ErrorItem | LibraryPartFileInfo]
Reads library part files (.gsm) without loading them into the libraries of the project: the unique ID of the part, the unique ID of its subtype, its master, parameter, 2D, 3D and properties scripts, and, with includeParameters, its parameters with their default values and descriptions (in the format of GetLibraryPartParameterValues). Password protected parts need their password. Available from Archicad 28.
Parameters:
-
files(list[str]) –The absolute paths of the library part files (.gsm) to read. The files are read without loading them into the libraries of the project.
-
scripts(None | list[LibraryPartReadableScriptType], default:None) –The scripts to read. All five by default.
-
password(None | str, default:None) –The password of password protected library parts. Reading a script of a protected part without the right password is an error for that file.
-
include_parameters(None | bool, default:None) –Also returns the parameters of each file with their default values and descriptions, in the format of GetLibraryPartParameterValues. Default is false, so a caller that only wants the scripts gets them even when the parameters of a file cannot be read.
Returns:
-
list[ErrorItem | LibraryPartFileInfo]–The information of the files in the order of the input, or an error for a file that cannot be read.
get_library_part_identities ¶
get_library_part_identities(
library_parts: list[LibraryPartIndexOrPath],
) -> list[ErrorItem | LibraryPartIdentity]
Gets the unique ID (main and revision GUID), the reference GUID and the Teamwork lock status of library parts given by index or file path, and whether they are in a server library.
Parameters:
-
library_parts(list[LibraryPartIndexOrPath]) –The library parts, each given by its index or by the path of its file.
Returns:
-
list[ErrorItem | LibraryPartIdentity]–One item for each given library part, in the same order.
get_library_part_metadata ¶
get_library_part_metadata(
library_parts: list[LibraryPartName],
) -> list[ErrorItem | LibraryPartMetadataDetails]
Returns the description, keywords, author and placeable, password protected and hierarchical pages flags of loaded library parts, given by file name. Use it to search library parts by description or keywords and to tell placeable parts from macros. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartName]) –The library parts to read the metadata of.
Returns:
-
list[ErrorItem | LibraryPartMetadataDetails]–The metadata of each given library part, or an error, in the order of the input.
get_library_part_original_locations ¶
get_library_part_original_locations(
library_parts: list[LibraryPartByIndex],
) -> list[ErrorItem | LibraryPartOriginalLocation]
Gets the original location of the given library parts, the file they came from, e.g. before they were embedded into the project. The library parts are given by the index GetAvailableLibraryParts returns. Available from Archicad 27.
Parameters:
-
library_parts(list[LibraryPartByIndex]) –The library parts to look up.
Returns:
-
list[ErrorItem | LibraryPartOriginalLocation]–The original location of each given library part, in the order of the input.
get_library_part_parameter_values ¶
get_library_part_parameter_values(
library_parts: list[LibraryPartParameterValuesByName],
) -> list[ErrorItem | LibraryPartParameterValues]
Returns the parameters of loaded library parts, given by their file name as GetAvailableLibraryParts returns it, with their default values and descriptions, in the format of GetGDLParametersOfElements: the read counterpart of SetLibraryPartParameters. Unlike GetGDLParametersOfLibraryParts, which finds a part by its name and also returns the index, flags and value descriptions of each parameter, it reads through the Library Manager. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartParameterValuesByName]) –The library parts to read.
Returns:
-
list[ErrorItem | LibraryPartParameterValues]–The default parameters of each given library part, in the order of the input, or an error for a library part that could not be read.
get_library_part_pictures ¶
get_library_part_pictures(
name: str,
) -> GetLibraryPartPicturesResult
Gets the preview picture and the GDL pictures of a loaded library part, given by its fileName or documentName as returned by GetAvailableLibraryParts, as base64 encoded PNGs, and from Archicad 29 also their dark user interface variants. A GDL picture section that cannot be read is left out and its error is returned next to the other pictures. Available from Archicad 28.
Parameters:
-
name(str) –The name of the loaded library part file with its extension, as returned in the fileName field of GetAvailableLibraryParts (e.g. 'My Door.gsm').
Returns:
get_library_part_scripts ¶
get_library_part_scripts(
library_parts: list[
LibraryPartScriptQueryByElement
| LibraryPartScriptQueryByName
],
scripts: None
| list[LibraryPartReadableScriptType] = None,
password: None | str = None,
) -> list[ErrorItem | LibraryPartScriptsDetails]
Gets the master, parameter, 2D, 3D and properties scripts of loaded library parts, given by name or by an element placed from them, with the unique ID of each part. A script section the part does not have is reported as not present. Password protected parts need their password. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartScriptQueryByElement | LibraryPartScriptQueryByName]) –The library parts to read, each given by its name or by an element placed from it.
-
scripts(None | list[LibraryPartReadableScriptType], default:None) –The scripts to read. All five by default.
-
password(None | str, default:None) –The password of password protected library parts. Reading a script of a protected part without the right password is an error for that part.
Returns:
-
list[ErrorItem | LibraryPartScriptsDetails]–The scripts of the library parts in the order of the input, or an error for a library part that cannot be read.
get_library_part_section ¶
get_library_part_section(
index: int,
section_type: str,
sub_ident: None | int = None,
password: None | str = None,
) -> str
Reads the text of a text section (a script or the comment) of a library part given by index, without opening it in the GDL editor. Takes the password of a protected library part.
Parameters:
-
index(int) –The index of a loaded library part, as GetAvailableLibraryParts returns it.
-
section_type(str) –The four-character code of the section type, as GetLibraryPartSections returns it. A shorter code is padded with spaces.
-
sub_ident(None | int, default:None) –The sub-identifier of the section, as GetLibraryPartSections returns it. 0 when not given.
-
password(None | str, default:None) –The password of a protected library part.
Returns:
-
str–The text of the section.
get_library_part_sections ¶
get_library_part_sections(
library_parts: list[LibraryPartIndexAndPassword],
) -> list[ErrorItem | LibraryPartSections]
Lists the sections of library parts given by index: their four-character type code, sub- identifier, size and whether they are text (scripts, comments) or binary (previews).
Parameters:
-
library_parts(list[LibraryPartIndexAndPassword]) –The library parts to list the sections of.
Returns:
-
list[ErrorItem | LibraryPartSections]–One item for each given library part, in the same order.
get_library_part_type_details ¶
get_library_part_type_details(
library_parts: list[LibraryPartIdentifier],
) -> list[ErrorItem | LibraryPartTypeDetails]
Returns the type details of the given library parts (ACAPI_LibraryPart_GetDetails): full unique ID and its direct parent's, type, the detail flags of objects, lamps, labels and zones, the frame and orientation settings of doors and windows, and the element type and variation of the tool that places the library part. For their path, library, GUID, license and scripts see GetLibraryPartDetails.
Parameters:
-
library_parts(list[LibraryPartIdentifier]) –The library parts to get the details of.
Returns:
-
list[ErrorItem | LibraryPartTypeDetails]–The details of the library parts, in the order of the input, or an error for a library part that was not found.
get_missing_lib_part_names ¶
get_missing_lib_part_names(
elements: list[ElementIdArrayItem],
) -> list[ErrorItem | MissingLibraryPartName]
Gets the library part name of the given placed Object, Lamp, Window or Door elements, even if the library containing the part is not loaded. Use it to find the parts of elements that are shown as dots because their library part is missing.
Parameters:
-
elements(list[ElementIdArrayItem]) –A list of elements.
Returns:
-
list[ErrorItem | MissingLibraryPartName]–The library part name of each given element, in the order of the input, or an error.
get_unused_library_parts ¶
get_unused_library_parts(
filter_by_type_id: LibraryPartType | None = None,
include_not_placeable: None | bool = None,
) -> GetUnusedLibraryPartsResult
Lists the loaded library parts that no element of the project is placed from. Read only. The Archicad API does not tell which library parts are used, so every element of the floor plan and of every view and layout is checked: objects, lamps, doors, windows, skylights, zone stamps, symbol labels, drawing titles, curtain wall parts, and the markers of doors, windows, skylights, sections, elevations, details and worksheets. A library part used only in another way (called as a macro, linked as a property object, as an interior elevation marker, in stairs and railings, in the tool defaults or in Favorites) is listed as unused. Library parts that cannot be placed (e.g. macros) are only listed with includeNotPlaceable.
Parameters:
-
filter_by_type_id(LibraryPartType | None, default:None) –Optional. Only list the unused library parts of this type (the typeId of GetAvailableLibraryParts).
-
include_not_placeable(None | bool, default:None) –Also list the library parts that cannot be placed (macros, pictures, property objects, list schemes and the like), which are never placed on their own. Default: false.
Returns:
interpret_gdl_script_3d ¶
interpret_gdl_script_3d(
script: None | str = None,
library_part_name: None | str = None,
) -> InterpretGDLScript3DResult
Runs a GDL 3D script, given as text or as the master and 3D scripts of a loaded library part with its default parameters, with the settings of the GDL editor, and returns whether it ran without a GDL error, how many 3D model elements it generated and their bounding box. The API returns no GDL error message or line number.
Parameters:
-
script(None | str, default:None) –The GDL 3D script to run. Either script or libraryPartName is required.
-
library_part_name(None | str, default:None) –A loaded library part, by its fileName (with extension) or documentName as GetAvailableLibraryParts returns them. Its default parameters are used; without script, its master script followed by its 3D script is run.
Returns:
is_library_part_subtype_of ¶
is_library_part_subtype_of(
library_parts: list[LibraryPartIdentifier],
ancestor: LibraryPartIdentifier,
match_ancestor_by_main_id: None | bool = None,
) -> IsLibraryPartSubtypeOfResult
Checks for each of the given library parts whether the given ancestor is anywhere up its subtype hierarchy (e.g. whether a part is a kind of furniture), independent of its name. A library part is not a subtype of itself. With matchAncestorByMainId any revision of the ancestor matches.
Parameters:
-
library_parts(list[LibraryPartIdentifier]) –The library parts to check.
-
ancestor(LibraryPartIdentifier) –The subtype to check against. Given by unId, it is used as it is, without checking that such a library part is loaded.
-
match_ancestor_by_main_id(None | bool, default:None) –Optional, false by default. When true, only the main GUID of the ancestor's unique ID is compared, so any revision of the ancestor matches; when false, the full unique ID (main and revision GUID) must match.
Returns:
is_usable_gdl_string ¶
is_usable_gdl_string(strings: list[str]) -> list[bool]
Checks whether each of the given strings is usable in GDL, e.g. before writing it into a GDL parameter or script. Returns one boolean for each string.
Parameters:
-
strings(list[str]) –The strings to check.
Returns:
-
list[bool]–One item for each given string, in the same order: true if Archicad accepts the string for use in GDL, false otherwise.
modify_library_list ¶
modify_library_list(
add: None | list[LibraryLocation] = None,
remove: None | list[LibraryToRemove] = None,
) -> ModifyLibraryListResult
Adds libraries by path and removes loaded libraries by name or path, in one change of the library list. Returns the result of each addition and removal. Available from Archicad 28.
Parameters:
-
add(None | list[LibraryLocation], default:None) –Library folders or container files to add, by absolute path.
-
remove(None | list[LibraryToRemove], default:None) –Loaded libraries to remove, each by its name or by its path.
Returns:
open_library_part_in_editor ¶
open_library_part_in_editor(
name: str,
) -> SuccessfulExecutionResult
Opens a loaded library part, given by its fileName or documentName as returned by GetAvailableLibraryParts, in Archicad's library part editor. Available from Archicad 27.
Parameters:
-
name(str) –The name of the loaded library part to open: its fileName (with extension, e.g. 'My Object.gsm') or its documentName, as returned by GetAvailableLibraryParts.
Returns:
reload_libraries ¶
reload_libraries() -> SuccessfulExecutionResult
reset_libraries ¶
reset_libraries() -> SuccessfulExecutionResult
Resets the loaded libraries with the Archicad API's library reset.
Returns:
search_library_parts ¶
search_library_parts(
ancestor_un_id: str, pattern: str
) -> list[LibraryPartSearchResult]
Finds the loaded library parts derived from an ancestor library part (by its unique ID) whose name matches a pattern with * wildcards. Archicad returns at most 50 of them.
Parameters:
-
ancestor_un_id(str) –The unique ID of the ancestor library part, '{main GUID}-{revision GUID}', as GetLibraryPartIdentities returns it. Only the library parts derived from it are found.
-
pattern(str) –The name pattern to match, with * as wildcard, for example 'Chair'. Use '' to find every library part derived from the ancestor.
Returns:
-
list[LibraryPartSearchResult]–The library parts found. Archicad returns at most 50.
set_gdl_date ¶
set_gdl_date(date: GDLDate) -> SuccessfulExecutionResult
Sets the date GDL scripts see: year, month, day, hour, minute and second, as GetGDLDate returns them. Useful to test date-dependent library parts; set the value read with GetGDLDate back to restore it.
Parameters:
-
date(GDLDate) –The date GDL scripts should see, in the format GetGDLDate returns.
Returns:
set_libraries ¶
set_libraries(
libraries: list[LibraryLocation],
) -> SuccessfulExecutionResult
Makes the given folders the project's local libraries; built-in, embedded, server and web libraries are kept. Set the libraries before opening a file that needs them and the missing-library dialog does not appear.
Parameters:
-
libraries(list[LibraryLocation]) –Local library folders or container files, by absolute path.
Returns:
set_library_part_custom_section ¶
set_library_part_custom_section(
name: str,
section_id: int,
index: None | int = None,
data_version: None | int = None,
data: None | str = None,
delete: None | bool = None,
) -> SuccessfulExecutionResult
Creates, replaces or deletes a custom section of a loaded library part. The content is given as base64. A library part that is not editable is refused and left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
name(str) –The name of the loaded library part file with its extension, as returned in the fileName field of GetAvailableLibraryParts (e.g. 'My Door.gsm').
-
section_id(int) –The type identifier of the custom section. A four-character code is given as its integer value, the first character in the highest byte (e.g. 'ABCD' is 1094861636).
-
index(None | int, default:None) –Optional. The index of the section among the sections with the same identifier. By default 0.
-
data_version(None | int, default:None) –Optional. The data version stored with the section. By default 0. Only used with data.
-
data(None | str, default:None) –The new content of the section, base64 encoded. The section is created when it does not exist, otherwise replaced. Give either data or delete.
-
delete(None | bool, default:None) –When true, the section is deleted. Give either data or delete.
Returns:
set_library_part_metadata ¶
set_library_part_metadata(
library_parts: list[LibraryPartMetadataUpdate],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Sets the author, keywords, license, license version, password and the placeable, UI default, subtype and hierarchical pages flags of loaded library parts. Only the given fields are changed. A library part that is not editable (e.g. a part of a library package or a read-only library) is refused and left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartMetadataUpdate]) –The library parts to modify and the metadata to set in each.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
set_library_part_parameters ¶
set_library_part_parameters(
library_parts: list[LibraryPartParametersUpdate],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Sets the parameter values, and optionally the parameter descriptions, of loaded library parts, in the format of SetGDLParametersOfElements. Only the given parameters are changed; with merge, the changed list is merged into the parameters of the part instead of replacing them. A library part that is not editable, or with an invalid value given, is left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartParametersUpdate]) –The library parts to modify and the parameter values to set in each.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
set_library_part_picture_images ¶
set_library_part_picture_images(
name: str,
preview_picture: None | str = None,
gdl_pictures: None | list[str] = None,
dark_preview_picture: None | str = None,
dark_gdl_pictures: None | list[str] = None,
) -> SuccessfulExecutionResult
Sets the preview picture and the GDL pictures of a loaded library part from base64 encoded PNGs, and from Archicad 29 also their dark user interface variants. All pictures are set in one step; an invalid picture changes nothing. A library part that is not editable is refused and left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
name(str) –The name of the loaded library part file with its extension, as returned in the fileName field of GetAvailableLibraryParts (e.g. 'My Door.gsm').
-
preview_picture(None | str, default:None) –Optional. The new preview picture as a base64 encoded PNG.
-
gdl_pictures(None | list[str], default:None) –Optional. The new GDL pictures, each a base64 encoded PNG. They replace all GDL pictures of the library part.
-
dark_preview_picture(None | str, default:None) –Optional. The new preview picture for the dark user interface as a base64 encoded PNG. Requires Archicad 29 or newer.
-
dark_gdl_pictures(None | list[str], default:None) –Optional. The new GDL pictures for the dark user interface, each a base64 encoded PNG. They replace all dark GDL pictures of the library part. Requires Archicad 29 or newer.
Returns:
set_library_part_pictures ¶
set_library_part_pictures(
name: str,
delete_preview_picture: None | bool = None,
delete_dark_preview_picture: None | bool = None,
delete_gdl_pictures: None | bool = None,
delete_dark_gdl_pictures: None | bool = None,
copy_2d_symbol_from: None | str = None,
delete_2d_symbol: None | bool = None,
) -> SuccessfulExecutionResult
Deletes the preview picture, the GDL pictures (and from Archicad 29 their dark variants) or the 2D symbol of a loaded library part, or copies the 2D symbol from another library part. A library part that is not editable is refused and left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
name(str) –The name of the loaded library part file with its extension, as returned in the fileName field of GetAvailableLibraryParts (e.g. 'My Door.gsm').
-
delete_preview_picture(None | bool, default:None) –Optional. When true, the preview picture is deleted.
-
delete_dark_preview_picture(None | bool, default:None) –Optional. When true, the preview picture for the dark user interface is deleted. Requires Archicad 29 or newer.
-
delete_gdl_pictures(None | bool, default:None) –Optional. When true, all GDL pictures are deleted.
-
delete_dark_gdl_pictures(None | bool, default:None) –Optional. When true, all GDL pictures for the dark user interface are deleted. Requires Archicad 29 or newer.
-
copy_2d_symbol_from(None | str, default:None) –Optional. The name of another loaded library part (fileName with extension); its 2D symbol (the drawn 2D vector image) replaces this part's 2D symbol.
-
delete_2d_symbol(None | bool, default:None) –Optional. When true, the 2D symbol (the drawn 2D vector image) is deleted. Cannot be combined with copy2DSymbolFrom.
Returns:
set_library_part_scripts ¶
set_library_part_scripts(
library_parts: list[LibraryPartScriptsUpdate],
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Sets and deletes the master, parameter, 2D, 3D, properties, interface and forward and backward migration scripts of loaded library parts. Only the given scripts are changed; an empty script makes the section empty, deleteScripts removes it. A library part that is not editable (e.g. a part of a library package or a read-only library) is refused and left unchanged. A part of the embedded library that Archicad does not report editable, as in a saved project, is changed in a temporary copy that then replaces it, keeping its main GUID, and the libraries are reloaded. Available from Archicad 28.
Parameters:
-
library_parts(list[LibraryPartScriptsUpdate]) –The library parts to modify, with the scripts to set and to delete in each.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
update_library_part_sections ¶
update_library_part_sections(
name: str, sections: list[LibraryPartSectionUpdate]
) -> list[
FailedExecutionResult | SuccessfulExecutionResult
]
Replaces the text of existing sections (scripts, comment, keywords, copyright) of a loaded library part, found by its name. Each section is read back after the update, and the output has one execution result per section.
Parameters:
-
name(str) –The name of the loaded library part, without the file extension (a trailing '.gsm' is accepted too).
-
sections(list[LibraryPartSectionUpdate]) –The sections to replace. Each section must already exist in the library part; this command does not add new sections.
Returns:
-
list[FailedExecutionResult | SuccessfulExecutionResult]–A list of execution results.
Related types¶
These include the parameter and result models used inside the client. The command signatures above show what to pass and what is returned.
AddFilesToEmbeddedLibraryParametersAddFilesToEmbeddedLibraryResultAddLibrariesParametersCompareLibraryPartUnIdsParametersCompareLibraryPartUnIdsResultCopyFilesIntoEmbeddedLibraryParametersCopyLibraryPartsParametersCopyLibraryPartsResultCreateFolderInEmbeddedLibraryParametersCreateLibraryPartFromElementsParametersCreateLibraryPartFromElementsResultCreateLibraryPartParametersCreateLibraryPartResultCreateLibraryPartsParametersCreateLibraryPartsResultDeleteEmbeddedLibraryItemsParametersDeleteEmbeddedLibraryItemsResultFindLibraryPartsParametersFindLibraryPartsResultGetAvailableLibraryPartsParametersGetAvailableLibraryPartsResultGetGDLDateResultGetGDLParametersOfLibraryPartsParametersGetGDLParametersOfLibraryPartsResultGetGDLUserGlobalsResultGetLastValidEmbeddedLibraryPartNameResultGetLibrariesOfLibPartsParametersGetLibrariesOfLibPartsResultGetLibrariesResultGetLibraryPart2DPrimitivesParametersGetLibraryPart2DPrimitivesResultGetLibraryPartCustomSectionParametersGetLibraryPartCustomSectionResultGetLibraryPartDetailsParametersGetLibraryPartDetailsResultGetLibraryPartFileInfoParametersGetLibraryPartFileInfoResultGetLibraryPartIdentitiesParametersGetLibraryPartIdentitiesResultGetLibraryPartMetadataParametersGetLibraryPartMetadataResultGetLibraryPartOriginalLocationsParametersGetLibraryPartOriginalLocationsResultGetLibraryPartParameterValuesParametersGetLibraryPartParameterValuesResultGetLibraryPartPicturesParametersGetLibraryPartPicturesResultGetLibraryPartScriptsParametersGetLibraryPartScriptsResultGetLibraryPartSectionParametersGetLibraryPartSectionResultGetLibraryPartSectionsParametersGetLibraryPartSectionsResultGetLibraryPartTypeDetailsParametersGetLibraryPartTypeDetailsResultGetMissingLibPartNamesParametersGetMissingLibPartNamesResultGetUnusedLibraryPartsParametersGetUnusedLibraryPartsResultInterpretGDLScript3DParametersInterpretGDLScript3DResultIsLibraryPartSubtypeOfParametersIsLibraryPartSubtypeOfResultIsUsableGDLStringParametersIsUsableGDLStringResultModifyLibraryListParametersModifyLibraryListResultOpenLibraryPartInEditorParametersSearchLibraryPartsParametersSearchLibraryPartsResultSetGDLDateParametersSetLibrariesParametersSetLibraryPartCustomSectionParametersSetLibraryPartMetadataParametersSetLibraryPartMetadataResultSetLibraryPartParametersParametersSetLibraryPartParametersResultSetLibraryPartPictureImagesParametersSetLibraryPartPicturesParametersSetLibraryPartScriptsParametersSetLibraryPartScriptsResultUpdateLibraryPartSectionsParametersUpdateLibraryPartSectionsResultElementIdElementIdArrayItemEmbeddedLibraryFileEmbeddedLibraryItemErrorItemFailedExecutionResultFoundLibraryPartGDLDateGDLUserGlobalLibraryLibraryFileAdditionLibraryLocationLibraryOfLibraryPartLibraryPart2DPrimitiveLibraryPartByIndexLibraryPartCopyDataLibraryPartCreationDetailsLibraryPartDataLibraryPartDetailsLibraryPartFileInfoLibraryPartGDLParameterQueryLibraryPartGDLParametersLibraryPartIdentifierLibraryPartIdentityLibraryPartIndexAndPasswordLibraryPartIndexOrPathLibraryPartKindLibraryPartMetadataDetailsLibraryPartMetadataUpdateLibraryPartNameLibraryPartNameOrGuidLibraryPartNameOrIndexLibraryPartOriginalLocationLibraryPartParameterValuesLibraryPartParameterValuesByNameLibraryPartParametersUpdateLibraryPartReadableScriptTypeLibraryPartScriptQueryByElementLibraryPartScriptQueryByNameLibraryPartScriptsDetailsLibraryPartScriptsUpdateLibraryPartSearchResultLibraryPartSectionUpdateLibraryPartSectionsLibraryPartTypeLibraryPartTypeDetailsLibraryToRemoveMissingLibraryPartNameScriptsSuccessfulExecutionResult