ViewerApi
Python SDK: the Viewer operations, 1 method, each with its parameters, result and a complete example.
Python SDK · bimworks · class · 1 method
What the viewers need to place and load models
Construct it with the client of the connect step: bimworks.ViewerApi(client). Each method is one operation of the API part, where it runs on its page.
| Method | Operation | Description |
|---|---|---|
get_geometry_meta_data | GetGeometryMetaData | What a viewer needs to place and load models |
get_geometry_meta_data#
def get_geometry_meta_data(self, get_geometry_meta_data_request: GetGeometryMetaDataRequest) -> Dict[str, Dict[str, object]]What a viewer needs to place and load models. Per Version (keyed by its uuid): the metadata of its geometry (bounds, units, the unquantization, the file types and the geometry encoding the viewer should load), and its placement (georeference, anchor point, alignment, grid convergence). The keys follow the indexed-model metadata, which the viewers read as they are.
| Operation | GetGeometryMetaData · POST /openapi/viewer/GetGeometryMetaData |
|---|---|
| Scope | geometry:read |
Parameters#
| Name | Type | Description |
|---|---|---|
get_geometry_meta_data_request | GetGeometryMetaDataRequestrequired | The request: its properties are those of the model, its JSON that of GetGeometryMetaData's request body. |
Returns#
Dict[str, Dict[str, object]] — The metadata per Version uuid
Example#
import json
import bimworks
# 1. Connect to BIM.works and log in with your API token
client = bimworks.ApiClient(bimworks.Configuration(host="https://bim.works/openapi"))
auth = bimworks.AuthApi(client).login_with_api_token(
bimworks.LoginWithApiTokenRequest(token="<your API token>"))
client.configuration.access_token = auth.actual_instance.var_base64
# 2. The request
request = bimworks.GetGeometryMetaDataRequest.from_json(r"""
{
"models": [
{
"type": "UrlModelIdentifier"
}
]
}
""")
# 3. The call
result = bimworks.ViewerApi(client).get_geometry_meta_data(request)
# 4. The result
print(json.dumps(client.sanitize_for_serialization(result), indent=2))