Python bindings
Note that the geodms bindings are a work in progress and currently only available for python versions 3.9.xx.
GeoDMS version 15.0.1 introduces the geodms module for python. This document describes through code examples how to use the currently exposed set of geodms functionalities.
In order to import the geodms module in python make sure the installation folder is added to your path so that the module can be found:
import sys
sys.path.append('C:/"Program Files"/ObjectVision/GeoDms14.15.2')
from geodms import *
Retrieving the geodms version:
dms_version = version()
Initializing the geodms module:
dms_engine = Engine()
Loading a dms configuration:
dms_config = dms_engine.load_config('./prj/config.dms')
Get the root item of a loaded dms configuration:
root = dms_config.root()
Finding an item in a loaded dms configuration from the root item:
parameters = root.find("/parameters")
Testing if the item is found by asserting that it is not null:
if (parameters.is_null()):
raise Exception(f"Cannot find output item: '/parameters'")
Get the name of a found item:
item_name = parameters.name()
Get the dms expression of a found item:
item_expr = parameters.expr()
Change the expression of a found item:
out_dir = root.find("/parameters/input/OutDir")
out_dir.set_expr("path/to/new/out/dir")
Update an item:
target_item_fullname = "dms/target/item"
target_item = root.find(target_item_fullname)
if target_item.is_null():
raise Exception(f"Cannot find output item: {target_item}")
target_item.update()