1

I am planning to use Azure Digital twin for representing a factory model. I am planning to load a 3d model in GLTF or GLB format and attach properties to each machine or asset in the 3d Model. The machines in the model are named properly. So is there anyway I can interact with the 3d model in Azure programmatically. I am expecting an API to create properties for each element. I already have a Database with the machine id and properties, I just have to write a program to identify the asset in the 3d diagram using the id and attach the properties to it. If some API is exposed for this purpose, please let me know.

Kailas J C
  • 139
  • 3
  • 8
  • Hi Kailas, I'm not sure about your question, if you want to update the properties in the 3d diagram, you should define elements in the 3d diagram (in Azure Twins Scene editor) and with some azure function get the data from some source and send to the 3d diagram. please see this blog entry https://sandervandevelde.wordpress.com/2022/08/04/extending-the-az-220-digital-twins-hands-on-lab-with-3d-visualization/ – Luis Molina Oct 27 '22 at 08:22

1 Answers1

0

You can edit .gtlf file in the blob store just like any dataset:

Using gtlflib

from gltflib import GLTF
import pandas as pd
import yaml
gltf = GLTF.load('..\data\OutdoorTanks.gltf')

gltf.model.nodes[0]

will produce a list of nodes, which can be piped into a dataframe:

colnames = ["extensions", "extras", "name", "camera", "children", "skin", "matrix", "mesh", "rotation", "scale", "translation", "weights"]
pd.DataFrame([[n.extensions,n.extras,n.name,n.camera,n.children,n.skin,n.matrix,n.mesh,n.rotation,n.scale,n.translation,n.weights] for n in gltf.model.nodes],columns=colnames)

enter image description here

How do you productionalize that?:

  • Azure function that operates on a trigger of your choosing
  • Fetching gtlf from blob store
  • Operate on whatever automated thing that you need.

Alternatively, you could use databricks or another lagre scale processing step. Anything that can a) access the blob store and b) run some python code can do this.

Additionally, if you get into manipulating GTLF files this doc is a good read

billmanH
  • 1,298
  • 1
  • 14
  • 25