Request

Response

    Update an Exchange Container

    The Data Exchange SDK facilitates the updating of the exchange container through modifications to the element’s parameters, transformations, and geometry. It also has the ability to delete existing parameters and update their values.

    Update Parameters

    The Element class features an UpdateInstanceParameter method designed for parameter updates. This method requires “SchemaId” and updated “Value”.

        Element.UpdateParameter("SchemaId","Value");
    

    Delete Parameters

    To delete a parameter you can call the DeleteInstanceParameter method on the Element class. This method requires the SchemaId to facilitate the deletion of a parameter.

        Element.DeleteParameter("SchemaId");
    

    Update Transformation

    To modify the transformation of an element, ElementDataModel offers the UpdateElement function, which needs the element’s ID and an instance of ElementProperties. Within ElementProperties, there exists an attribute named Transformation.

        ElementDataModel.UpdateElement("ElementId", new ElementProperties()
                   {
                       Transformation = new Transformation
                       {
                           Matrix = new Matrix4d(new double[]
                           {
                               0.525321989, -0.8509035245341184, 0, 2,
                               0.8509035245341184, 0.525321989, 0, 2,
                               0, 0, 1, 2,
                               0, 0, 0, 1
                           })
                       }
                   });
    
    Show More

    Update Geometry

    Primitive, Brep/Mesh: We have seen how to use the method ElementDataModel.SetElementGeometryByElement to associate geometry with an element. This same function can also be used to update the geometry associated with the element.

        ElementDataModel.SetElementGeometryByElement(OldElement, NewElementGeometry);
    

    This function will substitute the existing geometry with the new one.

    Publish

    After data has been updated in the ElementDataModel wrapper, these updates will need to be published/synced to the Data Exchange, as at this point all the updates are done on the local ElementDataModel wrapper only.

    To sync the updates to the DataExchange call the SyncExchangeDataAsync on the IClient interface.

        var ExchangeIdentifier = new DataExchangeIdentifier
                    {
                        CollectionId = CollectionID,
                        ExchangeId = ExchangeID,
                        HubId = hubId
                    };
        var UpdatedExchangeData = ElementDataModel.ExchangeData;
        IClient.SyncExchangeDataAsync(ExchangeIdentifier, UpdatedExchangeData);
    
    Show More

    Viewable generation

    Once the exchange data has been updated, you can generate an updated viewable (visual representation of the exchange model) by calling the GenerateViewableAsync method.

        IClient.GenerateViewableAsync(ExchangeId, CollectionId);
    

    Delete Data Exchange

    To remove an exchange, you can make use of the function/API offered by the hosting provider. The IClient does not possess any capabilities for deleting exchanges. We are entirely dependent on the functionality/API provided by the hosting provider.