hohlraum / gdsCAD

A simple but powerful Python package for creating photolithography masks in the GDSII format.
GNU General Public License v3.0
88 stars 52 forks source link

Unique name in def #49

Closed floRoth closed 7 years ago

floRoth commented 7 years ago

Some programs can´t open cells with characters ?$ in the cellname. So i just replaced it with ab. In core.py line 2213

Should work now.

Greetings Flo

def _compact_id(obj): """ Return the id of the object as an ascii string.

This is guaranteed to be unique, and uses only characters that are permitted
in valid GDSII names.
"""

i=bin(id(obj))[2:]
#chars=string.ascii_uppercase+string.ascii_lowercase+string.digits+'?$'
chars=string.ascii_uppercase+string.ascii_lowercase+string.digits+'ab'
out=''
while len(i):
    s=int(i[-6:], base=2)
    out+=chars[s]
    i=i[:-6]

return out[::-1]
floRoth commented 7 years ago

Solution see above.