Skip to main content
Question

Feature Request: ZOS-API Layouts Exports Completion

  • November 29, 2024
  • 5 replies
  • 260 views

David.Nguyen
Luminary
Forum|alt.badge.img+2

One year ago, ​@Xianglei wrote a topic (thanks a lot!) about:

Since its been quite painful to generate such plots with ZPL (thanks to ​@Erin.Elliott, we might get a fix in 2025 🤞):

I’ve been using the ZOS-API option more and more to create animations. It is more stable, but currently lacks a couple of options. Since we’re approaching the Christmas period 🎅, this is my wish list to improve the ZOS-API Layout Exports feature (in order of importance):

  1. As far as I understand, we cannot specify the file type of the export. I’ve tried to use multiple extensions in OutputFileName (.JPG, .PNG, ...etc.) but the file size remains the same. Based on the file size, which is rather small (for a given image size), I’m assuming the export is made in .JPG regardless of the extension specified. Can the file type be added to the ZOS-API?
  2. Could we get a vector graphics file type?
  3. Although there’s a property RaysLineThickness, for me, it doesn’t seem to have an effect. If someone is anyway going to look at this, would it be possible to have a line width (integer) property instead?
  4. Could you also add a property to disable the RGB axis at the bottom-left corner of the layout?

Thanks a lot,

 

David

5 replies

Forum|alt.badge.img+1
  • Zemax Staff
  • December 2, 2024

Hi, David.  1 and 3 sound like possible bugs.  Could you work with Support, so they can check those and submit, if needed?


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Author
  • Luminary
  • December 2, 2024

Thanks ​@Erin.Elliott. Does the ZEMAX support address still work? Because I have an academic license and last time I checked I couldn’t login support tickets.

Take care,


David


Angel Morales
En-Lightened
Forum|alt.badge.img+1
  • En-Lightened
  • December 5, 2024

Hi ​@David.Nguyen, thanks for the post here and the questions. We’re looking into the points 1 and 3 mentioned by Erin. Looking at 3., it does indeed have an effect for me, same as the Layout plots in the GUI. We are taking a closer look at 1 as well.

To speak to the question of support, in general, academic license questions indeed need to go through our forums (see the section Academic Support in the link). For OpticStudio questions, at the moment we are monitoring questions here on community.zemax.com, but questions can also be asked at our Ansys Learning Forums.

That said, if bug-related issues arise and there is a need to hand-off confidential data to investigate the bug, we can open a discussion separately (that is, not public) to preserve proprietary/sensitive information.

Regarding your issue with the rays thickness not changing, how are you accessing the ZOS-API -- Python, MATLAB, etc.? I checked with Python and it seemed to work fine, so checking in your language would be the next thing I should do.

Thanks, and looking forward to hearing back!


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Author
  • Luminary
  • December 5, 2024

Hi ​@Angel Morales, good to hear from you.

 

Regarding 3. I’m actually using ZOSPy, and I don’t want to add to the confusion by sharing my code here (unless necessary). I tested again today, and you are right that RaysLineThickness works. Its just that the difference between thickest and thinnest isn’t obvious (zoomed-in screenshots below).

Ray Line Thickness = Thickest
Ray Line Thickness = Thinnest

I’m using pixel width/height of 3840/2160. There is no bug in that sense, but if we could have a bit more control over the thickness of the rays that would be awesome 😃

Take care,


David


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Author
  • Luminary
  • September 1, 2026

@Erin.Elliott ​@Angel Morales 

 

I hope you are both well. I was wondering if there had been any progress with this topic.

I am back at making some animations and face similar issues. Here are the things I checked (some are new).

This is my code so far using ZOSPy.

import zospy as zp

zos = zp.ZOS()
oss = zos.connect()
oss.load("remote_scanning.zmx")

shaded_model_export = oss.Tools.Layouts.OpenNSCShadedModelExport()
shaded_model_export.SaveImageAsFile = True
shaded_model_export.OutputFileName = r"...\shaded_model.jpg"
shaded_model_export.Background = zp.constants.Tools.Layouts.BackgroundOptions.Black
shaded_model_export.CameraViewpointAngleX = 0
shaded_model_export.RaysLineThickness = zp.constants.Tools.Layouts.LineThicknessOptions.Thickest
shaded_model_export.OutputPixelWidth = 1920
shaded_model_export.OutputPixelHeight = 1080
shaded_model_export.Filter = "(H12&H16)|(H4&X_HITS(0,2))|(H12&H18)"
shaded_model_export.ColorRaysBy = zp.constants.Tools.Layouts.ColorRaysByNSCOptions.WaveNumber
shaded_model_export.SplitNSCRays = True
shaded_model_export.ScatterNSCRays = True
shaded_model_export.ConfigurationAll = True
shaded_model_export.RunAndWaitForCompletion()
shaded_model_export.Close()

File format specification

As far as I understood, simply changing the extension in OutputFileName should be enough to change the file format. I tried the same file name and changing only the extension: .jpg, .bmp, .png. However, all the files have the exact same size, and when doing a binary comparison of the file, only uuid and updatedAt are different, the content is the same. I was trying to use IsValidFileName but this seem to always be False. Also, I can use any extension and a file will be created.

PDF format output

I like the new PDF format for saving the layouts, but it is not available in the API.

Change in colors

This is minor but the colors for me are not exactly the same as in OpticStudio when exported (the colors are inverted but at this point it is not so important).

Thanks for your help and take care,

 

David