Commit 66c2a0df authored by Daniel Brown's avatar Daniel Brown
Browse files

adding lens power option

parent aeaad51a
Pipeline #1196 failed with stage
......@@ -3,7 +3,7 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__version__ = "1.0.6"
__version__ = "1.0.7"
# This flag is used to switch on the gui features in pkat at import time
USE_GUI = False
......@@ -994,11 +994,30 @@ class lens(Component):
self._svgItem = None
self.__f = Param("f", self, SIfloat(f))
self.__p = Param("p", self, None)
def f(self): return self.__f
def f(self):
if self.__f is not None:
return self.__f
return 1/self.__p
def f(self, value): self.__f.value = SIfloat(value)
def f(self, value):
self.__f.value = SIfloat(value)
self.__p.value = None
def p(self):
if self.__p is not None:
return self.__p
return 1/self.__f
def p(self, value):
self.__p.value = SIfloat(value)
self.__f.value = None
def parseFinesseText(text):
......@@ -1015,7 +1034,10 @@ class lens(Component):
raise pkex.BasePyKatException("Lens Finesse code format incorrect '{0}'".format(text))
def getFinesseText(self):
rtn = ['lens {0} {1} {2} {3}'.format(, self.f.value, self.nodes[0].name, self.nodes[1].name)]
if self.__p is None:
rtn = ['lens {0} {1} {2} {3}'.format(, self.f.value, self.nodes[0].name, self.nodes[1].name)]
rtn = ['lens* {0} {1} {2} {3}'.format(, self.p.value, self.nodes[0].name, self.nodes[1].name)]
for p in self._params:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment