S Skandha Deepsita | da8b219 | 2021-06-25 00:43:52 +0530 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2020 Efabless Corporation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # SPDX-License-Identifier: Apache-2.0 |
| 15 | |
| 16 | import pya |
| 17 | import re |
| 18 | import os |
| 19 | |
| 20 | WIDTH = 2048 |
| 21 | HEIGHT = 2048 |
| 22 | |
| 23 | app = pya.Application.instance() |
| 24 | win = app.main_window() |
| 25 | |
| 26 | # Load technology file |
| 27 | print('[INFO] Reading tech file: ' + str(tech_file)) |
| 28 | tech = pya.Technology() |
| 29 | tech.load(tech_file) |
| 30 | |
| 31 | layoutOptions = tech.load_layout_options |
| 32 | |
| 33 | # Load def file in the main window |
| 34 | print('[INFO] Reading Layout file: ' + str(input_layout)) |
| 35 | cell_view = win.load_layout(input_layout, layoutOptions, 0) |
| 36 | layout_view = cell_view.view() |
| 37 | |
| 38 | layout_view.load_layer_props(os.path.splitext(tech_file)[0]+'.lyp') |
| 39 | |
| 40 | layout_view.max_hier() |
| 41 | # layout_view.clear_layers() |
| 42 | |
| 43 | # Hide layers with these purposes |
| 44 | hidden_purposes = [0, 4, 5] |
| 45 | |
| 46 | li = layout_view.begin_layers() |
| 47 | while not li.at_end(): |
| 48 | lp = li.current() |
| 49 | if lp.source_datatype in hidden_purposes: |
| 50 | new_lp = lp.dup() |
| 51 | new_lp.visible = False |
| 52 | layout_view.set_layer_properties(li, new_lp) |
| 53 | |
| 54 | li.next() |
| 55 | |
| 56 | print("[INFO] Writing out PNG screenshot '{0}'".format(input_layout+".png")) |
| 57 | layout_view.save_image(input_layout+".png", WIDTH, HEIGHT) |
| 58 | print("Done") |
| 59 | app.exit(0) |