-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Description
The following code gives an error when run with the attached layout:
lv = RBA::Application.instance.main_window.current_view
lay = lv.cellview(lv.active_cellview_index).layout
top = lay.top_cell
top.each_inst do |ci|
cname = ci.cell.name
if (cname.start_with?("Circle"))
ci.flatten
end
endThis solution works fine:
lv = RBA::Application.instance.main_window.current_view
lay = lv.cellview(lv.active_cellview_index).layout
top = lay.top_cell
insts_to_flatten = []
top.each_inst do |ci|
cname = ci.cell.name
if (cname.start_with?("Circle"))
insts_to_flatten << ci
end
end
insts_to_flatten.each do |ci|
ci.flatten(8)
endIn general, iteration of a container (the instances) is unsafe while it's modified (in flatten which removes instances). However, in this case, the duplicate cell instance seems to cause the issue.
Maybe there is a reason to rectify this issue and allow iteration during manipulation. This would be more intuitive.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels