Updating Speckle Streams from JS

Does anyone know of any examples of creating a commit to modify objects from a web client.

For example if I want to add/edit a Speckle object in a web client, do I need to be using the GraphQL API directly. Is there a JS API similar to Python/C#?

2 Likes

Hi @kgoulding! Unfortunately not. There is a way to create objects directly from the gql api (via the objectCreate mutation), nevertheless there’s a bit of legwork required and you need to exercise caution, especially if you modify an object inside a larger tree (inside another object), as all the correct closures need to be “handcrafted” and updated. This is easy inside a collection wrapper, but more difficult in a more structured object.

What’s your direct use case? If something easy, we can try and write a quick POC.

You’ll have to watch David’s presentation tomorrow for the full use case :wink:

Basically we are pulling polylines into a Google Map and then want to be able to trace elements on an aerial to pull back into a Speckle Stream (destination CAD / Rhino).

Another use case would be adding metadata to the geometry (e.g. classifications for landuse/density) that we’d want to persist in the stream.

4 Likes

Will definitely tune in for @haitheredavid 's show :sunglasses:

I gotcha - use cases are clear. Creating from scratch shouldn’t be a problem, but a mini SDK wouldn’t hurt here. @izzylys has some incipient stuff in JS that was born for the SketchUp connector’s needs (mini spoiler here). Let’s regroup after the conf and work things out!

5 Likes

You could have a look at how we create Globals as well:

2 Likes