Uploading segmented meshes into single commit with customized id

Hellooo,
I’m new to speckle, and I am currently looking into using specklepy to customize object id for each upload meshes from our lidar scans. There are some layers to what I am struggling with:

  1. how does one upload an .obj file from their personal directory? would I need to define a class scan_mesh(base) with file location as attribute?

  2. is it possible to customize object_id (scan_1, scan_2 etc.) so that when retrieved and re-pushed to the stream we can keep track of the same object id?

  3. lastly, as we have segmented our scans to three different meshes and a point, how would one group them to one commit (it would be like uploading a building with columns, floors, and xyz_home_coordinate)?

I believe for #1 and #3, these are built in grasshopper and rhino. But due to our need to customize the attributes and object_id name, we have resorted to checking out specklepy. Any insight would be hugely appreciated.

Thank you!

1 Like

Hey @aims_where , welcome to these parts!

The first thing to probably clarify is how the Speckle id works: this is not an arbitrary identifier set by the client or server, it is instead a hash of the object itself, and therefore, you should not override it.
You can read more about this topic in our docs: The Base Object | Speckle Docs

But given all Speckle objects are also extensible, so you can definitely add a new property myCustomObjId='abc123'.

Replying to your questions:

  1. In GH you can probably just load up the mesh, and the connector will take care of converting it automatically for you. In python, I’m afraid there is no helper method to convert from a file, so you’ll need to manually parse the obj file and create a Speckle mesh object. But @Jedd will correct me if I’m wrong :slight_smile:
  2. You can extend the Speckle mesh object both in GH and python and add all the props that you want. For GH with the Extend Speckle Object node, and in Python, just by using the dictionary syntax.
  3. In GH just structure your data as you wish and plug it into a sender; in Python, create a Base object that will be your data sent to Speckle, and add to it all the props and sub-objects to create your desired structure

Let us know if the above makes sense; otherwise, we’ll be happy to share screenshots and code snippets too :slight_smile:

PS
Would love to know more about what you’re building!

1 Like

Hi! Many thanks for your response!

Yes, the grasshopper version is very straightforward and easy to navigate. For now, we are proceeding with grasshopper with, as you said, giving it a custom_id as property.

I am still curious to about how the obj files should be parsed to be legible in speckle as mesh object, as we are processing the scanned data with python (open3d) before converting them to mesh. Where might I find the format for speckle mesh objects, or how it should be structured?

PS:
We are trying to figure out what is the best way to store a point cloud or mesh data of the scans of discarded wood pieces. It is still at an early stage :slight_smile:

Hey @aims_where

The obj to Speckle mesh processing logic is currently implemented on the Speckle server side. It uses specklepy, so you should be able to base your logic on this.

Parsing logic:

Lemme know if you need more help :slightly_smiling_face:

3 Likes

This will be a good place to start for me.
Thanks!

1 Like