Skip to content

Speckle BHoM integration

Alessio Lombardi edited this page Feb 21, 2024 · 4 revisions

Please see: https://github.com/BHoM/Speckle_Toolkit/wiki


Export of BHoMObjects with Visualisation in SpeckleViewer

0

1

2

3

Improvements

How does it work

We want 3 things:

  1. The visualisation of the objects with some geometry in the SpeckleViewer
  2. the navigation of the serialised properties of the BHoMObjects within speckleViewer
  3. The deserialisation of BHoM data on the received end with all the information.

Current approach:

  1. Create a SpeckleMesh (or speckleLine, etc) with the geometry representation of the BHoMObject (e.g. for a Bar, the extrusion mesh)
  2. Use the SpeckleCore serialiser to serialise bhom data and append it to the SpeckleMesh
    // Add the BHoMObject to the SpeckleObject Properties Dictionary via the Speckle Serialisation
    speckleObject.Properties.Add("BHoM", SpeckleCore.Converter.Serialise(bhomObject));

This poses a problem on the receiving end, because receiving the object and deserialising with SpeckleCore.Converter.Serialise creates:

Meshes/extrusions

We're exporting the geometry as meshes. Heavy.

  • How does SpeckleExtrusion work?
public SpeckleExtrusion(SpeckleObject profile, double length, bool capped, string applicationId = null, Dictionary<string, object> properties = null);

how should the SpeckleObject be created? As SpeckleCurve? How can I define the extrusion direction?

How does it work

In order to allow the navigation of the properties in the BHoMObjects, we

SpeckleCore serialiser is slow with BHoMObjects.

This is for the portal frame example: 5 bars 2 nodes, where it took about 8 seconds to export:

image

This doesn't allow to append "speckleSerialised" BHoM data to the objects when we have many of them.

The following objects have bhom data serialised as JSON only and appended to the SpeckleObject.Properties dictionary:

image image image