Closed DMKun closed 1 year ago
This is tricky. Your inner loop is some kind of find
action. As you probably already discovered, we only mapped the map
, filter
and for_each
actions. I will investigate if such a function exists in SKILL.
There is an exists
function. Your inner loop would look like that: car(exists(item items item->layer == "..."))
. The car
part is a bit annoying, but you should be able to write that python loop completely lazy.
car = ws['car'].var
exists = ws['exists'].var
item = Var('item')
# inner loop var outer loop var
# v v
apd.boxes = apd.die_info.map(car(exists(item, loop_var.children, item.layer == 'COMPONENT ...')))
print(apd.boxes()) # the list of boxes
Unfortunately, I cannot try this out at the moment. I hope this helps.
This might help you:
https://unihd-cag.github.io/skillbridge/examples/lazy_lists.html#handling-large-lists
globals var is similar to lazy_lists. So I don't think it's useful for nested loops.
There is an
exists
function. Your inner loop would look like that:car(exists(item items item->layer == "..."))
. Thecar
part is a bit annoying, but you should be able to write that python loop completely lazy.car = ws['car'].var exists = ws['exists'].var item = Var('item') # inner loop var outer loop var # v v apd.boxes = apd.die_info.map(car(exists(item, loop_var.children, item.layer == 'COMPONENT ...'))) print(apd.boxes()) # the list of boxes
Unfortunately, I cannot try this out at the moment. I hope this helps.
I got it. But it's not quite what I expected. It still requires the developer to have skill development experience. But this should be the best option for now.
我有一个函数,获取IC和IC边框大小信息。这个函数现在涉及到了双重循环。我应该如何提升函数的执行性能。 已知的方式是将get_die_rect函数变为skill代码,然后通过ws['getDieRect']获取制定对象。
I have a function that return information of the IC and IC border. This function now involves double looping. How can I improve the performance of the function?
One known way is to convert the 'get_die_rect' function into Skill code and then access the specified object through 'ws['getDieRect']'.
Is there a way to improve the performance solely through Python code?