blob: 6eb282e586c88a0320a782b7df7a44e2d4c2a4f3 [file] [log] [blame]
S Skandha Deepsitada8b2192021-06-25 00:43:52 +05301# 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
16import pya
17import re
18import os
19
20WIDTH = 2048
21HEIGHT = 2048
22
23app = pya.Application.instance()
24win = app.main_window()
25
26# Load technology file
27print('[INFO] Reading tech file: ' + str(tech_file))
28tech = pya.Technology()
29tech.load(tech_file)
30
31layoutOptions = tech.load_layout_options
32
33# Load def file in the main window
34print('[INFO] Reading Layout file: ' + str(input_layout))
35cell_view = win.load_layout(input_layout, layoutOptions, 0)
36layout_view = cell_view.view()
37
38layout_view.load_layer_props(os.path.splitext(tech_file)[0]+'.lyp')
39
40layout_view.max_hier()
41# layout_view.clear_layers()
42
43# Hide layers with these purposes
44hidden_purposes = [0, 4, 5]
45
46li = layout_view.begin_layers()
47while 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
56print("[INFO] Writing out PNG screenshot '{0}'".format(input_layout+".png"))
57layout_view.save_image(input_layout+".png", WIDTH, HEIGHT)
58print("Done")
59app.exit(0)