civilpy.general.bentley package

Submodules

civilpy.general.bentley.projectwise module

This script provides a library for interacting with the native ProjectWise API (dmscli.dll, dmawin.dll) from Python.

It includes a PW_SESSION context manager to handle safe login/logout, and functions for building an in-memory map of the project structure for fast lookups.

class civilpy.general.bentley.projectwise.PW_SESSION(datasource_name='OhioDOT-pw.bentley.com:OhioDOT-pw-02')[source]

Bases: object

A context manager to handle ProjectWise API login and logout.

Usage:
with PW_SESSION() as s: # Defaults to the ODOT datasource

# Your PW API calls go here pass

__init__(datasource_name='OhioDOT-pw.bentley.com:OhioDOT-pw-02')[source]

Initializes the session with a datasource name.

Parameters:

datasource_name (str, optional) – The datasource to connect to. Defaults to “OhioDOT-pw.bentley.com:OhioDOT-pw-02”.

civilpy.general.bentley.projectwise.build_project_map(max_depth=4)[source]

Builds an in-memory map of the ProjectWise folder structure for fast lookups.

Parameters:

max_depth (int) – How many levels deep to map the folder structure.

Returns:

A tuple containing two dictionaries:

(hierarchical_map, flat_pid_map)

Return type:

tuple

civilpy.general.bentley.projectwise.display_project_properties(properties)[source]

Nicely prints the dictionary of project properties.

civilpy.general.bentley.projectwise.get_project_properties(project_id)[source]

Selects a project and extracts a dictionary of its key metadata.

civilpy.general.bentley.projectwise.get_pw_path()[source]

Finds the ProjectWise installation path by searching the Windows Registry.

civilpy.general.bentley.projectwise.get_user_name(user_id)[source]

Helper function to retrieve a user’s name from their ID.

civilpy.general.bentley.projectwise.load_pw_dlls()[source]

Finds the PW bin directory and loads the necessary DLLs, defining function prototypes.

Module contents