Speckle Object Keys:Values - Characters Not Allowed

Hi Speckle 2.0 Team!

I’m testing out v2.0 today in detail. I’ve been testing how to create my own Speckle Objects and put KEY:VALUE data into it. I have some questions:

1 - Where to put Geometry
In a Speckle Object, does this get attached to a geometry? Or do I have to put the Geometry (example: polyline) into the Key:Value list?

2 - Speckle Object Automatically removes 0 or Null values
Is it the case that the “create Speckle Object” component removes “0” values or empty “{}” objects? This is not good for our use case, that we want to have the option of empty Key:Value fields that can be updated later.

3 - Character Not Allowed Error
I’ve come across the issue that the “/” backslash character is NOT allowed. Is this a feature or bug? I changed the Key inputs from “/” to a “|” pipe character and it works. But I would prefer not to do this.

Can you please give me guidance? Thanks!

Hi @Maketank!

Re 3), it’s not a bug, but it might a too cautious approach on our end. The main bottleneck is ensuring that you’ll be able to query server side by various keys, and, depending on driver, strange chars can throw things off (e.g., . is disallowed because it links two subfields). We’ll look into it!

Re 2), yes, we do not serialise empty lists/nulls. Re the component, we could look into this more. We’ll have a think, and get back to you on this one. If i understand the use case correctly, later on in the grasshopper definition you’d want to edit that object and set those initially created props, that are null to start with?

Re 1) there’s several approaches:

Create a custom speckle object with a geometry prop, and all the other values you need:

Here’s how it looks like:
https://speckle.xyz/streams/a41c7ea120/objects/6e2d98b8f9239be26b5e3cdddfd60f28

Extend a speckle object:
First convert your geometry to a speckle, and then add extra keys to it:

Here’s how it looks like: Speckle

1 Like

@dimitrie

Thank you for the helpful feedback.

Re 3) - I’ve updated our code to use “|” instead of “/”. This was probably necessary anyways because it would have conflicted with our own JSON schema files. This works.

Re 2) - I guess this is still a challenge for my use case. My workaround is to replace empty items with a string of text “null”. Not ideal, but that is more my problem than yours. I have ideas of how I could solve this as well for different needs, so it’s up to you of course. Do as you see fit. I understand why you want to remove empty/null items.

Re 1) - This helps me understand better. I should also rather use the Create Speckle Object which is the better route.


New Questions

  1. In your speckle JSON exports, why do you use @geometry, @Keys and @Values. Is the @ sign used for the web app in terms of JSON-LD? Or is it merely used to avoid schema clashing (ex. you want to reserve these values).
  2. What do you use the BBox (Bounding Box) for? Why do you create all this data in the JSON?
  3. What is the TotalChildrenCount used for? I tried searching the Docs, but the Doc search only search on pre-defined search filters. Is the for geometry contained within other geometry? Ex. a polygon within a polygon to create an island hole within?

Thanks!

Hey @Maketank ,

Jumping in with some quick answers:

  1. the @ is prepended to detachable properties, you can read here some techy bits on what it means
  2. the BBox is used in the 3d viewer to zoom on objects properly when they are selected etc
  3. TotalChildrenCount represents the number of object inside the current one, where only detached objects are counted. This is primarily used by our clients and APIs to display progress, paginate etc

We’ll make sure to add these info to our docs, any other questions just ask!

1 Like