genpattern script