0

I try to use different pointMeshes of the dataVizExtn when I using the invalidateViewables(). enter image description here

Because I try to have different size of the sprite ,I create two ViewableDatas. enter image description here

enter image description here

I also finish() them respectively, so I get two pointMeshs of the dataVizExtn. enter image description here

I think it will let me have some errors when I using invalidateViewables(), because the function have default this.pointMeshs .Is there any way to assign new index of the pointMesh-array? Or other way to deal with this situation?

Tim Huang
  • 31
  • 5

1 Answers1

0

Unfortunately, the DataViz extension doesn't support adding multiple viewable data currently. It was reported as LMV-6574 by me a few months ago.

See also: Use Data Visualization Extension multiple times

To set two different viewable data, we can create a new extension inheriting the DataViz extension like below as a workaround to separate the class scope.

const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");

const DataVisualizationExtClass = Autodesk.Viewing.theExtensionManager.getExtensionClass('Autodesk.DataVisualization');

class MyDataVisualization extends DataVisualizationExtClass {
    constructor(viewer, options = {}) {
        super(viewer, options);
    }
}
Autodesk.Viewing.theExtensionManager.registerExtension('MyDataVisualization', MyDataVisualization);

const myDataVisualizationExt = awiat viewer.loadExtension('MyDataVisualization');


const viewableData1 = new DataVizCore.ViewableData();
viewableData1.spriteSize = 24;

// ... do some configurations
await viewableData1.finish();

dataVizExtn.addViewables( viewableData1 );

const viewableData2 = new DataVizCore.ViewableData();
viewableData2.spriteSize = 48; 

// ... do some configurations
await viewableData2.finish();

myDataVisualizationExt.addViewables( viewableData2 );

Eason Kang
  • 6,155
  • 1
  • 7
  • 24