gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
27 stars 10 forks source link

add to_um and to_dbu into KCLayout #380

Closed sebastian-goeldi closed 3 weeks ago

sebastian-goeldi commented 3 weeks ago

Allows the following:

>>> import kfactory as kf
>>> b = kf.kdb.DBox(100.0005, 100.0005)
>>> print(b)
(-50.00025,-50.00025;50.00025,50.00025)
>>> print(kf.kcl.to_dbu(b))
(-50000,-50000;50000,50000)
>>> print(kf.kcl.to_um(kf.kcl.to_dbu(b)))
(-50,-50;50,50)
>>> print(kf.kcl.to_um(kf.kcl.to_dbu(5.00005)))
5.0

This works for the following types:

int
| kdb.Point
| kdb.Vector
| kdb.Box
| kdb.Polygon
| kdb.Path
| kdb.Text

<->

float
| kdb.DPoint
| kdb.DVector
| kdb.DBox
| kdb.DPolygon
| kdb.DPath
| kdb.DText
sebastian-goeldi commented 3 weeks ago

@gdspaul probably something you will like quite a bit ;)

gdspaul commented 3 weeks ago

I do!

Sent from my iPhone

On Jun 6, 2024, at 6:37 AM, Sebastian Goeldi @.***> wrote:



[EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.

Merged #380https://github.com/gdsfactory/kfactory/pull/380 into main.

— Reply to this email directly, view it on GitHubhttps://github.com/gdsfactory/kfactory/pull/380#event-13066922724, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5CULE44GTQ62D54PPXZ2OLZGBQYXAVCNFSM6AAAAABI4XJ5N2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGA3DMOJSGI3TENA. You are receiving this because you were mentioned.Message ID: @.***>