unihd-cag / skillbridge

A seamless python to Cadence Virtuoso Skill interface
https://unihd-cag.github.io/skillbridge/
GNU Lesser General Public License v3.0
181 stars 38 forks source link

Global Variables merge multiple filter #193

Closed DMKun closed 2 years ago

DMKun commented 2 years ago
ws = Workspace.open()

my_globals = ws.globals('my_globals')
my_globals.shapes << ws.ge.get_sel_set.var()

# get the boxes
my_globals.boxes << my_globals.shapes.map(loop_var.b_box)

# filter rectangles
my_globals.shapes << my_globals.shapes.filter(loop_var.obj_type == 'rect')
my_globals.shapes << my_globals.shapes.filter(loop_var.isRect==True)
my_globals.shapes << my_globals.shapes.filter(loop_var.isHole!=True)

How to merge multiple filter.

nielsbuwen commented 2 years ago

Hi, do you want to filter on multiple conditions? You can use | and & for that.

my_globals.shapes.filter((loop_var.obj_type == 'rect') | (loop_var.obj_type == 'path'))

That means all shapes that are rects or paths.

The and (&) works identically.

DMKun commented 2 years ago

It's work, thanks.