QuanticParis / HFSSdrawpy

Draw HFSS designs using python
MIT License
17 stars 23 forks source link

Fillet problem using the "path" function #26

Closed marianneld closed 4 years ago

marianneld commented 4 years ago

I am trying to use the "path" function but i get an error from HFSS when I put a fillet which is different from 0. Here is an example:

from HFSSdrawpy import Modeler, Body, Port from HFSSdrawpy.parameters import TRACK, GAP

pm = Modeler('hfss') chip1 = Body(pm, name='chip1') a=pm.set_variable('100um') width=pm.set_variable('50um') fillet_radius=pm.set_variable('5um')

points=[(0,0),(a,0),(a,a)] port0=Port(chip1, 'port0', [0,0], [1,0], [width], ['gap'], [GAP], [0], False) gap = chip1.path(points,port0,fillet=fillet_radius,name='gap')

marianneld commented 4 years ago

Also to make the gds writing work, i need to change the path function in the gds_modeler. it works when i change the corner option of gds.FlexPath to "natural" instead of "circular bend", which cancels all fillet parameters.

rlescanne commented 4 years ago

Basically, your problem is that you are trying to do a fillet radius which is smaller than half the width of the path. Hence the internal radius of the bend gets "negative" which results in an error. We can add a more meaningful exception to prevent this. The code with the following arguments should work for instance

width=pm.set_variable('5um')
fillet_radius=pm.set_variable('50um')

As for the natural/circularbend, it's up to you, you can add the option to choose from if you want rectangular corners.

marianneld commented 4 years ago

Ok thanks. So in my case, i think i would need rectangular corners first and then fillet the final design with a small radius. For the gds modeler, as it is now, the path function is always calling corners="circular bend". Is it possible to add a few lines to the path functions in "body" so that when the fillet is 0, it changes the corner option to "natural"?

rlescanne commented 4 years ago

Sure, just branch from master, implement your modifications and submit a pull request !