Adding text actor to Scene

Hey all,

I am interested in writing text to a vtkjs file. My proces of generating a vtkjs file is following;

  1. generate dataset folders using vtkJSONDataSetWriter
  2. Reference the folders in the index.json
  3. Zip everything and rename the extension to .vtkjs

The above process has been working fine. Now I want to add text to it. I see that I can add vtkVectorText as polydata and therefore I can write to a file. This is an example. sunpath.vtkjs (36.5 KB)

As you will see in the file. The text starts from the bottom left and that does not work in all cases. I see several examples where text can be added to a scene to be rendered in a window. Can I add text actor to the index.json I am using to create a vtkjs?

The following shows first object in the “Scene” in index.json. Can I add text as actors here?

"scene": [
        {
            "name": "Hourly_Analemmas",
            "type": "httpDataSetReader",
            "httpDataSetReader": {
                "url": "Hourly_Analemmas"
            },
            "actor": {
                "origin": [
                    0,
                    0,
                    0
                ],
                "scale": [
                    1,
                    1,
                    1
                ],
                "position": [
                    0,
                    0,
                    0
                ]
            },
            "actorRotation": [
                0,
                0,
                0,
                1
            ],
            "mapper": {
                "colorByArrayName": "",
                "colorMode": 0,
                "scalarMode": 4
            },
            "property": {
                "representation": 2,
                "edgeVisibility": 0,
                "diffuseColor": [
                    0,
                    0,
                    0
                ],
                "pointSize": 5,
                "opacity": 1
            },
            "legends": []
        },

Not yet but @Sankhesh_Jhaveri is currently working on a Mapper2D which should allow TextActor to be used if I’m not mistaken. Once available, you will indeed be able to do what you are suggesting.

1 Like