Skip to main content

I wrote a macro to do this but it is slow (line by line).  Is there a build-in method to do this?  I can’t find it in the user manual.

 

Thanks!

 

sub clear_all_lenses
    num_s = nsur()
    if (num_s > 2)
        for i, num_s-1, 1, -1
            !print "delete surface ",i
            delete i
        next
    endif
return

@gsun86 

 

Not sure that helps but when you press File..New, OpticStudio usually uses a file LENS.zos. This file has only 3 surfaces. Could you load this file with this command?

LOADLENS "LENS.zos"

It will erase all the content of the lens data editor, but it will also close all other windows, which probably you don’t want.

Anyway, just an idea.

Take care,


David


File->New also resets all of your settings in the system explorer, so it may be more work than selecting the surfaces in the file editor and then deleting them.


@Ray

That’s true, I guess one could save an empty file with only two surfaces, but the correct System Explorer settings and session file, and load that file instead.

Take care,


David

 


Thanks Dave & Ray,

New file with the correct settings is a practical option.  We can also write the settings as macro functions as well - it will make the settings clear as a record.  


Reply