# Write .glance file

**URL:** https://discourse.paraview.org/t/write-glance-file/6167
**Category:** Web Support
**Tags:** python
**Created:** [January 4, 2021, 9:29pm UTC](https://discourse.paraview.org/t/write-glance-file/6167 "2021-01-04T21:29:47Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 4, 2021, 9:29pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/1 "2021-01-04T21:29:47Z")

</div>

Is it possible to write a .glance file using Python? In the following image,I see that a scalar is selected in the drop down menu when the file is loaded. I believe this behaviour comes from a saved state in the glance file. I would like to know if it’s possible to define a .glance file that I can use to load several files using the same settings.

 ![scalar](https://discourse.paraview.org/uploads/default/original/2X/5/5efe87bf52249fc70659be6f9f2f37098b55bed5.png)

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 4, 2021, 9:36pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/2 "2021-01-04T21:36:02Z")

</div>

I would think so. But the glance file capture which url/file needs to be loaded with which settings. So you can not reuse a glance file with other files unless you rely on a template for the Python generator to properly generate several glance files, 1 for each file you want to load.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 4, 2021, 9:37pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/3 "2021-01-04T21:37:15Z")

</div>

You can unzip the file from [here](https://github.com/Kitware/paraview-glance/blob/master/data/202-t.glance) to see the syntax of such file.

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 4, 2021, 10:07pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/4 "2021-01-04T22:07:05Z")

</div>

This is good. I am generating similar files using a vtk python package. Now the question is, Can I generate .glance file from vtk python package? If not then, I will have to swap the polydata in a sample glance file. Is that correct?

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 4, 2021, 10:09pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/5 "2021-01-04T22:09:01Z")

</div>

Is there a schema for state.json files?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 4, 2021, 10:29pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/6 "2021-01-04T22:29:31Z")

</div>

No defined schema but mostly match source/representation/view logic with props values of the various proxies.

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 17, 2021, 1:07am UTC](https://discourse.paraview.org/t/write-glance-file/6167/7 "2021-01-17T01:07:48Z")

</div>

Hi @jourdain,  
Is there a class in vtk that writes the props that we see in a glance(state.json) file?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 17, 2021, 4:58pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/8 "2021-01-17T16:58:52Z")

</div>

This is the output of `servermanager.getState()` but you don’t have a servermanager on your side and most of its content is driven by configuration files that dictate which properties that you expose from the vtk objects. So no class will handle that since is will be based on Glance configs. But generating it by hand should be trivial since only few props needs to be provided. All the defaults values can be ignored.

---

<div class="post-metadata">

### Author: ![devngc](https://discourse.paraview.org/user_avatar/discourse.paraview.org/devngc/32/5514_2.png) [@devngc](https://discourse.paraview.org/u/devngc)
#### Post date: [January 17, 2021, 6:31pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/9 "2021-01-17T18:31:34Z")

</div>

Thank you again for answering my questions on several threads @jourdain. It seems that replacing props in state.json using some script is the option I have left since there’s no other way to directly generate the source/dataset for a vtk/vtp file that I can directly use in state.json. Is my understanding correct?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [January 18, 2021, 4:19pm UTC](https://discourse.paraview.org/t/write-glance-file/6167/10 "2021-01-18T16:19:28Z")

</div>

yes, but you can use a template and just replace the part that you want to change (url, colorBy field)
