End goal is to pass the ElementId of the PipeType I want (Plex Wire) to Pipe.Create, but I don't know how to select the correct PipeType ElementId in a project with no Pipe instances to inspect.
In a test project, I have used Transfer Project Standards to bring over the PipeType I want to use, and manually created a few Pipe instances to inspect...
>>> import Autodesk.Revit as R
>>> types=R.DB.FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PipeCurves).WhereElementIsElementType().ToElements()
>>> elems=R.DB.FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PipeCurves).WhereElementIsNotElementType().ToElements()
>>> for i in elems: print(i.Name)
...
Default
Default
Default
Plex Wire
>>> for i in types: print(i.Name)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: Name
...but as I mentioned, I'd like to be able to use Pipe.Create from a project which contains the desired PipeTypes (from a Project Template), but has no pre-existing Pipe instances.
Thanks
Use the ElementType
FamilyName
property introduced in Revit 2015.
Before that, the simplest option used to be to use the temporary transaction trick: open a transaction, insert a dummy instance, grab the desired name, and roll back the transaction.