def fromString(cls, string): # [n1-0.123-1-0.321-0.2] type, intensity, size, genoverlay, chooverlay
        while string[0] == " ":
            string = string[1:]
        while string[0] == "\n":
            string = string[1:]
        while string[-1] == " ":
            string = string[:-1]
        while string[-1] == "\0":
            string = string[:-1]
        while string[-1] == "\n":
            string = string[:-1]
        if len(string)<8:
            raise ValueError("Invalid Part string: "+string)
        if string[0] == "[" and string[-1] == "]":
            string = string[1:-1]
        else:
            raise ValueError("Invalid Part string: "+string)
        typ = string[:2]
        string = string[3:]
        if not typ in ("n1", "n2", "bg", "ch", "ge"):
            raise ValueError("Invalid Part Type string: "+typ)
        valstrings = str.split(string, "-")
        inten = eval(valstrings[0])
        size = eval(valstrings[1])
        gen = eval(valstrings[2])
        cho = eval(valstrings[3])
        return cls(typ, inten, size, gen, cho)