Skip to main content
Solved

Proplmes using New_RayTrace (ZOS API sequential ray trace, single ray trace analysis)

  • November 1, 2020
  • 1 reply
  • 179 views

Forum|alt.badge.img

I am having trouble changing settings in the ZOS API when trying to do a single ray trace in Python.

My code:

        ray_trace = self.theSystem.Analyses.New_RayTrace()
        if ray_trace.IsRunning():
            ray_trace.WaitForCompletion()
        settings = ray_trace.GetSettings()

When I try to set the Py to 0, I get

settings.Py = 0
*** AttributeError: '' object has no attribute 'Py'

How do I change settings for a single ray trace?

 

Best answer by Sandrine Auriol

Hi Tony

The RayTrace analysis has dedicated settings:

I have tried the following commands using Python.NET and it works correctly:

RayTrace=TheSystem.Analyses.New_RayTrace();
Settings=RayTrace.GetSettings ();
Settings.Py
1.0

So I would recommend checking with the Interactive Extension to understand what is going on. You can also check the types of the variables returned:

And last thing. Are you using Python.NET or Python using the COM communication?

If you are using the COM communication, then this might be why you have an error. You will need to cast the settings. Have a look at that article:  ZOS-API using Python. You will need to write something like

thesettings_RayTrace = CastTo(Settings, 'IAS_RayTrace') 

Let us know if that helps and do not hesitate if you have any further questions.

Sandrine

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+2

Hi Tony

The RayTrace analysis has dedicated settings:

I have tried the following commands using Python.NET and it works correctly:

RayTrace=TheSystem.Analyses.New_RayTrace();
Settings=RayTrace.GetSettings ();
Settings.Py
1.0

So I would recommend checking with the Interactive Extension to understand what is going on. You can also check the types of the variables returned:

And last thing. Are you using Python.NET or Python using the COM communication?

If you are using the COM communication, then this might be why you have an error. You will need to cast the settings. Have a look at that article:  ZOS-API using Python. You will need to write something like

thesettings_RayTrace = CastTo(Settings, 'IAS_RayTrace') 

Let us know if that helps and do not hesitate if you have any further questions.

Sandrine


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings