heitzmann / gdspy

Python module for creating GDSII stream files, usually CAD layouts.
Boost Software License 1.0
352 stars 128 forks source link

str' object has no attribute 'get_svg_classes' #202

Closed ghost closed 2 years ago

ghost commented 2 years ago

I am trying to convert gds file into svg file. But facing error "str' object has no attribute 'get_svg_classes' ". I was not able to understand how to resolve this issue, it would be great if you could help me to resolve this issue.

image

import gdspy import numpy import sys import copy

import os os.environ['path'] += r';C:\Program Files\UniConvertor-2.0rc5\dlls' import cairosvg

layout= gdspy.GdsLibrary(infile='C:\Users\pooja\Downloads\p1.gds') cellList = layout.cells cellList for val in cellList: cell = cellList[val] cell.remove_paths(lambda path: path.layers[0] != val) cell.remove_labels(lambda label: label.layer != val) print(f"Processing {cell}") cell.write_svg('C:\Users\pooja\svg\AA_project_layout.svg')

heitzmann commented 2 years ago

Thanks for the report. I've pushed a fix in the latest commit. Can you check if it works for you, @poojabeniwal?

ghost commented 2 years ago

Thank you for your response. Now I am getting another error.

image
heitzmann commented 2 years ago

This error looks strange, because ref is assigned on the previous line. Can you share the GDSII file and the script that reproduces the error so that I can investigate the problem?

ghost commented 2 years ago

When there are no references in gds (train.gds and test.gds) it works fine But when there are references in gds (all other gds) it's throwing an error.

I have attached the script and the all gds

gds_to_svg.zip

heitzmann commented 2 years ago

The files you sent are working fine. Have you restarted your notebook kernel after reinstalling gdspy?

ghost commented 2 years ago

Thank you, It's working now. I really appreciate your help.