Skip to content

Commit

Permalink
proper Speckle client
Browse files Browse the repository at this point in the history
  • Loading branch information
KatKatKateryna committed Nov 11, 2023
1 parent 6e274a3 commit 663e624
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 3 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ def automate_function(
"""
# the context provides a conveniet way, to receive the triggering version
try:

projInfo = query_version_info(automate_context)
if not projInfo.speckle_type.endswith("Revit.ProjectInfo"):
automate_context.mark_run_failed(
"Not a valid 'Revit.ProjectInfo' provided"
)
automate_context.mark_run_failed("Not a valid 'Revit.ProjectInfo' provided")

lon = np.rad2deg(projInfo["longitude"])
lat = np.rad2deg(projInfo["latitude"])
Expand All @@ -88,7 +85,7 @@ def automate_function(
source_data="© OpenStreetMap",
source_url="https://www.openstreetmap.org/",
)
r'''
r"""
roads_line_layer = Collection(
elements=roads_lines,
units="m",
Expand All @@ -97,7 +94,7 @@ def automate_function(
source_data="© OpenStreetMap",
source_url="https://www.openstreetmap.org/",
)
'''
"""
roads_mesh_layer = Collection(
elements=roads_meshes,
units="m",
Expand Down
8 changes: 2 additions & 6 deletions utils/utils_server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@


from specklepy.api.wrapper import StreamWrapper
from gql import gql


def query_version_info(automate_context):
automation_run_data = automate_context.automation_run_data
# get branch name
Expand All @@ -19,10 +18,7 @@ def query_version_info(automate_context):
}
"""
)
sw = StreamWrapper(
f"{automation_run_data.speckle_server_url}/projects/{automation_run_data.project_id}"
)
client = sw.get_client()
client = automate_context.speckle_client
params = {
"project_id": automation_run_data.project_id,
"model_id": automation_run_data.model_id,
Expand Down

0 comments on commit 663e624

Please sign in to comment.