OptiCore icon indicating copy to clipboard operation
OptiCore copied to clipboard

[Feature Request] Add Python API / operator to programmatically create lenses

Open yourwanghao opened this issue 9 months ago • 1 comments

Hi and thank you for this amazing plugin!

I'm using OptiCore for academic/professional optical simulation work inside Blender, and I find it very helpful for visualizing lens systems.

Currently, lenses can only be created manually through the "Add > OptiCore Optics > Lens" UI menu. However, for automation purposes (e.g., creating parameter sweeps, generating many different lens + sensor configurations programmatically), it would be very useful to expose lens creation as a Python-accessible operator.

For example, it would be ideal to have something like:

bpy.ops.opticore.lens_add(radius1=0.05, radius2=-0.05, thickness=0.005, diameter=0.025, ior=1.52)

yourwanghao avatar Apr 08 '25 14:04 yourwanghao

Hi,

thanks for the suggestion. I had not considered exposing it thorugh this kind of API channel so far, I will take it on my list to look in to.

This would also tie nicely with the option to couple multiple lenses as in Issue https://github.com/CodeFHD/OptiCore/issues/19

CodeFHD avatar Apr 10 '25 11:04 CodeFHD