Skip to content

Commit

Permalink
standartize units on send; send Degrees as None (so it can be receive…
Browse files Browse the repository at this point in the history
…d in Sharp connectors)
  • Loading branch information
KatKatKateryna committed Nov 29, 2023
1 parent 83d9492 commit bfcfdd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions speckle_qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
import sip

from specklepy.core.api import operations
from specklepy.logging.exceptions import SpeckleException, GraphQLException
from specklepy.logging.exceptions import SpeckleException, GraphQLException, SpeckleInvalidUnitException
from specklepy.core.api.models import Stream, Branch, Commit
from specklepy.core.api.wrapper import StreamWrapper
from specklepy.objects import Base
from specklepy.objects.other import Collection
from specklepy.objects.units import get_units_from_string
from specklepy.transports.server import ServerTransport
from specklepy.core.api.credentials import (
Account,
Expand Down Expand Up @@ -486,8 +487,10 @@ def onSend(self, message: str):

units = str(QgsUnitTypes.encodeUnit(projectCRS.mapUnits()))
self.dataStorage.latestActionUnits = units
if units is None or units == "degrees":
units = "m"
try:
units = get_units_from_string(units)
except SpeckleInvalidUnitException:
units = 'none'
self.dataStorage.currentUnits = units

if (
Expand Down

0 comments on commit bfcfdd2

Please sign in to comment.