Topic: Creating a user-defined surface using DLLs
Live solution reveal and Q&A: May 19th, 8am - 9am PDT (See the attachments for a calendar invite.)
Engineer:
This month, Ask an Engineer looks a little different! Give the challenge a try to learn more about DLLs, then come back on May 19th to discuss! Submit your solution or questions as a reply to this thread.
Challenge opens: May 2nd
Submit your code as a reply by: May 18th, EOD
Challenge: OpticStudio surfaces are typically represented with continuous curves - either given by a smooth sag equation, or a spline which connects individual sag points. However, discrete steps may be needed to best represent an optical surface. For example, when manufacturing an optic with a 3D printer or lathe, the tool may generate the shape through the use of different zones of sag data, instead of a smooth profile, and you may want to represent a rough first-pass prototype in your simulation. In this case, a User Defined surface is preferable over, say, a Grid Sag as it will allow for this type of non-continuous sag information.
This month, we challenge you to create a User Defined Surface which has a sag profile that is step-wise in YZ. The profile should be given by an external TXT file. When viewing the surface in the Surface Sag plot, the output should be similar to the following:
Files:
- Calendar invite for May 19th. This will connect you to the Teams meeting where
@Sandrine Auriol will present her solution and answer your questions. - A sample TXT file representing the radial sag information the DLL should refer to.
Resources/Tips:
- General overview of DLLs: Custom DLLs in OpticStudio: An overview of user-defined surfaces, objects, and other DLL types
- Also see the Help System file “The Setup Tab...Editors Group (Setup Tab)...Lens Data Editor...Sequential Surfaces (lens data editor)...User Defined”
- Information on how to use an external data file with a DLL: How to read a static data file into a user-defined surface
- As a starting point, check out US_FILT_FILE.CPP
- How to compile a User-Defined DLL
- How to debug a DLL or EXE
- This DLL does not require any additional parameters, so focus on editing Case 3 and Case 5 of the CPP code.
Questions? Comments? Ready to submit your code? Reply to this thread. Replies may be posted in any supported language (English, Chinese, Japanese). Once the event is concluded, the thread will be closed.
The Ask an Engineer live event will be limited to discussing this challenge and general DLL questions. For questions on troubleshooting personal DLLs or OpticStudio files, please submit a ticket with Zemax Support. In that case, your license support status will be considered.