trying to cobble together a few samples but I cant get the actual mesh to show up. the stream is created, the properties are there. but the viewer online has no geometry
def CreateCube():
# Create a SpeckleMesh
sm = so.Mesh()
sm.vertices = [0,0,0,1,0,0,1,1,0,0,1,0]
sm.faces=[1,0,1,2,3]
sm.name = "the mesh"
return sm
class Block(Base):
length: float
width: float
height: float
origin: so.Point = None
def __init__(self, length=1.0, width=1.0, height=1.0, origin=so.Point(), **kwargs) -> None:
super().__init__(**kwargs)
# mark the origin as a detachable attribute
cube = CreateCube()
self.add_detachable_attrs({"cube"})
self.length = length
self.width = width
self.height = height
self.origin = origin
what is the best way to send a list of objects over
I currently have this
# next create a server transport - this is the vehicle through which you will send and receive
transport = ServerTransport(client, new_stream_id)
# this serialises the block and sends it to the transport
hash = operations.send(base=convertedMeshes[0], transports=[transport])
# you can now create a commit on your stream with this object
commid_id = client.commit.create(
stream_id= new_stream_id,
object_id= hash,
message= "this is a block I made in speckle-py",
)
ConvertedMeshes is an array, it works for 1 but how about many? maybe point to a sample?
from what I saw in the documents you just output a list of ints for the face list, is this not right, what should the face list look like? is it [[0,2,1], [2.4.1]] like that?
It shows n=1 for quads and n=0 for triangles, which was our older system before we supported n-gons.
n = 1 and n = 4 are equivalent, as is 0 and 3 to retain backwards compatiblity.
As a note though - @Jedd made me check just now - we haven’t really gotten to implement that in the viewer yet:
We’re still stuck with the 1 for quads and 0s for triangles. I can prob push a very fast hotfix now, but it will only be deployed on to our staging server.