Tagged: polyline2polygon, pcurve, generic bend
- This topic has 3 replies, 3 voices, and was last updated 6 years, 4 months ago by
Douglas.
-
AuthorPosts
-
26 October 2018 at 18:09 #5225
Douglas
ParticipantHi,
I am having issues to use the generic_bend module.
when using angled output and input waveguides, I see problems on the output GDS. Is there a way to upload images on this forum? I did not find it…
My code is below.
Thanks!
Doug
__________________________________________________
import nazca as nd import nazca.generic_bend as gb #============================================================================= # Connecting bent waveguides #============================================================================= # Defining bends bend1=nd.bend(radius=10,angle=-30 ,width=2).put(0,0) b = nd.strt(length=1,width=2).put(70,0) bend2=nd.bend(radius=10,angle=30,width=2).put(b.pin['a0']) # Generic bend connection xya = nd.diff(bend1.pin['b0'],nd.Node.rotate(bend2.pin['b0'],180)) A, B, L, Rmin = gb.gb_coefficients(xya,Rin=30, Rout=30) # Curve parameters xy = gb.curve2polyline(gb.gb_point,xya,0.000001, (A, B, L)) # Curve points nd.Polyline(layer=10,width=2,points=xy).put(bend1.pin['b0']) #============================================================================= # Connecting straight waveguides #============================================================================= # Defining straights straight1 = nd.strt(length=10 , width=2).put(0,20) straight2 = nd.strt(length=10, width=2).put(60,40) # Generic bend connection xya = nd.diff(straight1.pin['b0'],nd.Node.rotate(straight2.pin['a0'],180)) A, B, L, Rmin = gb.gb_coefficients(xya,Rin=30, Rout=30) # Curve parameters xy = gb.curve2polyline(gb.gb_point,xya,0.000001, (A, B, L)) # Curve points nd.Polyline(layer=10,width=2,points=xy).put(straight1.pin['b0']) nd.export_gds(filename='issue1.gds')
26 October 2018 at 19:07 #5227Ronald
KeymasterDear Douglas,
I’ll have to check how you can add an image. I see I have that option.
As for the syntax, note you never need to use the Node class directly:
# works xya = nd.diff(bend1.pin['b0'], nd.Node.rotate(bend2.pin['b0'], 180)) # but this is shorter and more direct: xya = nd.diff(bend1.pin['b0'], bend2.pin['b0'].rot(180))
As for the generic bend. Use it with care as it is a more or less intended as an internal function for the ‘pcurve’ (parametric curve). The mechanism can be reused for other types of parameteric curves.
First a path is created, and that is what you export in your example. However, the path’s discretization is not well defined, e.g. if you send it to a foundry. Therefore, there is a nd.util.polyline2polygon method which takes care of the discretization and creating a polygon first. A tutorial on this topic would be helpful.
Ronald
27 October 2018 at 10:08 #5231Xaveer
ModeratorDear Douglas,
Your approach is much more complex (and error prone) than it needs to be. You better use the interconnect module to provide you with a pcurve connection.
Here is how it can be used for your problem:
import nazca as nd import nazca.generic_bend as gb # Define interconnect myIC = nd.interconnects.Interconnect(radius=10, width=2, layer=10) # Defining bends bend1 = nd.bend(radius=10, angle=-30, width=2).put(0,0) b = nd.strt(length=1, width=2).put(70,0) bend2 = nd.bend(radius=10, angle=30, width=2).put(b.pin['a0']) myIC.pcurve_p2p(bend1.pin['b0'], Rin=10, Rout=10).put() # Defining straights straight1 = nd.strt(length=10, width=2).put(0,20) straight2 = nd.strt(length=10, width=2).put(60,40) myIC.pcurve_p2p(straight1.pin['b0'], straight2.pin['a0']).put() nd.export_gds(filename='no_issue1.gds')
Also note that the radius (Rin,Rout) you specify in the pcurve_p2p() function need to match the radius of the curves you connect to (with the proper sign).
Xaveer
29 October 2018 at 11:36 #5240Douglas
ParticipantThanks Ronald and Xaveer! All working now!
Thanks for the tip Xaveer, will do that way now. I have a special affection to the generic_bend module, that’s why I started working directly from it =).
Regards,
Doug
-
AuthorPosts
- You must be logged in to reply to this topic.