Finding file path of family types and deleting them

revit
dynamo

#1

I’ve been working on a script to create, delete, and alter Family Types.

It’s working fine, the only step I yet have to take is deleting the files.
Now, I’ve already managed to get the right Family Type to delete through the FamilyType.ByName node, and I know there’s a File.Delete node to get rid of specific files.

The big question is how to get from a Family Type output to a file path so I can delete that specific file. If that’s the right way to go about it of course.

Thanks in advance!


#2

Try Directory.Contents (see also the one in DanEdu package)


#3

I do have both these nodes. I however do not have the knowledge how exactly these work. I’m also not exactly comfortable experimenting with them as I wouldn’t want to delete some file somewhere that has nothing to do with what I’m doing in Revit.


#4

The testing phase is best done on test files, but I am not sure you could delete these files directly from Dynamo anyway…


#5

Certainly.
I don’t know how this search function works exactly so I’m afraid I’d delete something that’s in a whole other project.


#6

The other problem with this node is that it loads in a file, not a path to one.


#7

Try to type “file path” in the Dictionary:
http://dictionary.dynamobim.com/#/Core/File/FilePath


#8

The annoyance is that there’s easy ways to get a file from a path, you can use these nodes you adviced to also find files.
Just getting the path is the problem.


#9

Use String.Contains (Beaker has also interesting nodes for this kind of tasks) and then Filter.ByBooleanMask. See also if the Primer can’t help…