private void CreateTypeProject(UIDocument uidoc, Application app, FamilyTypeData Type) { if (string.IsNullOrEmpty(Type.Name)) { return; } int slashInsex = Type.Path.LastIndexOf("\\"); var familyName = Type.Path.Substring(slashInsex + 1); familyName = familyName.Substring(0, familyName.Length - 4); // MessageBox.Show(familyName); var NewDoc = app.NewProjectDocument(UnitSystem.Metric); string Path = "D:\\TypesForWeb_0.1\\" + familyName + "" + Type.Name + ".rvt"; if (!File.Exists(Path)) { PutTypeIntoProject(uidoc, NewDoc, Type); try { NewDoc.SaveAs(Path); } catch (Exception e) { TaskDialog.Show("File not created", Type.Name + e.Message); } } }