Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0724c7d06 | |||
| 1414a3611b | |||
| a553c17c43 | |||
| 0be3fac6ab |
@@ -124,6 +124,7 @@ class SpeckleClient:
|
||||
account {Account} -- the account object which can be found with `get_default_account` or `get_local_accounts`
|
||||
"""
|
||||
self.account = account
|
||||
self._set_up_client()
|
||||
|
||||
def _set_up_client(self) -> None:
|
||||
headers = {
|
||||
|
||||
@@ -21,7 +21,7 @@ class StreamWrapper:
|
||||
local account for the server.
|
||||
|
||||
```py
|
||||
from specklepy.api.credentials import StreamWrapper
|
||||
from specklepy.api.wrapper import StreamWrapper
|
||||
|
||||
# provide any stream, branch, commit, object, or globals url
|
||||
wrapper = StreamWrapper("https://speckle.xyz/streams/3073b96e86/commits/604bea8cc6")
|
||||
@@ -98,6 +98,10 @@ class StreamWrapper:
|
||||
f"Cannot parse {url} into a stream wrapper class - no stream id found."
|
||||
)
|
||||
|
||||
@property
|
||||
def server_url(self):
|
||||
return f"{'https' if self.use_ssl else 'http'}://{self.host}"
|
||||
|
||||
def get_account(self, token: str = None) -> Account:
|
||||
"""
|
||||
Gets an account object for this server from the local accounts db (added via Speckle Manager or a json file)
|
||||
@@ -111,7 +115,7 @@ class StreamWrapper:
|
||||
)
|
||||
|
||||
if not self._account:
|
||||
self._account = get_account_from_token(token, self.host)
|
||||
self._account = get_account_from_token(token, self.server_url)
|
||||
|
||||
if self._client:
|
||||
self._client.authenticate_with_account(self._account)
|
||||
|
||||
@@ -632,7 +632,7 @@ class Brep(
|
||||
bbox: Box = None
|
||||
area: float = None
|
||||
volume: float = None
|
||||
displayValue: Mesh = None
|
||||
_displayValue: List[Mesh] = None
|
||||
Surfaces: List[Surface] = None
|
||||
Curve3D: List[Base] = None
|
||||
Curve2D: List[Base] = None
|
||||
@@ -648,6 +648,18 @@ class Brep(
|
||||
child._Brep = self
|
||||
return children
|
||||
|
||||
# set as prop for now for backwards compatibility
|
||||
@property
|
||||
def displayValue(self) -> List[Mesh]:
|
||||
return self._displayValue
|
||||
|
||||
@displayValue.setter
|
||||
def displayValue(self, value):
|
||||
if isinstance(value, Mesh):
|
||||
self._displayValue = [value]
|
||||
elif isinstance(value, list):
|
||||
self._displayValue = value
|
||||
|
||||
@property
|
||||
def Edges(self) -> List[BrepEdge]:
|
||||
return self._inject_self_into_children(self._Edges)
|
||||
|
||||
@@ -198,7 +198,7 @@ class BaseObjectSerializer:
|
||||
|
||||
elif isinstance(obj, dict):
|
||||
for k, v in obj.items():
|
||||
if isinstance(v, PRIMITIVES):
|
||||
if isinstance(v, PRIMITIVES) or v is None:
|
||||
continue
|
||||
else:
|
||||
obj[k] = self.traverse_value(v)
|
||||
|
||||
@@ -102,6 +102,8 @@ def base():
|
||||
base = Base()
|
||||
base.name = "my_base"
|
||||
base.units = "millimetres"
|
||||
base.null_val = None
|
||||
base.null_dict = {"a null val": None}
|
||||
base.vertices = [random.uniform(0, 10) for _ in range(1, 120)]
|
||||
base.test_bases = [Base(name=i) for i in range(1, 22)]
|
||||
base["@detach"] = Base(name="detached base")
|
||||
|
||||
Reference in New Issue
Block a user