The Autodesk.Revit.DB.Fabrication.FabricationUtils
class provides a set of utilities for working with fabrication parts in Revit.
This method returns a mapping of part ids (Autodesk.Revit.DB.Fabrication.PartId
) to fabrication part ids (Autodesk.Revit.DB.Fabrication.FabricationPartId
) for a given set of element ids (Autodesk.Revit.DB.ElementId
) corresponding to fabrication parts. The element ids should belong to a fabrication service (Autodesk.Revit.DB.Fabrication.FabricationService
).
Document
: The Revit document.IEnumerable<ElementId>
: An enumerable set of element ids corresponding to fabrication parts.A dictionary mapping part ids to fabrication part ids.
This method returns the fabrication service (Autodesk.Revit.DB.Fabrication.FabricationService
) of the specified type (Autodesk.Revit.DB.Fabrication.FabricationServiceType
) in the given Revit document.
Document
: The Revit document.FabricationServiceType
: The type of the fabrication service to retrieve.The fabrication service of the specified type.
This method determines whether the given element (Autodesk.Revit.DB.Element
) belongs to a fabrication service (Autodesk.Revit.DB.Fabrication.FabricationService
).
Element
: The Revit element.True
if the element belongs to a fabrication service, False
otherwise.
import Autodesk.Revit.DB as DB
doc = __revit__.ActiveUIDocument.Document
# Get a list of element ids for fabrication parts
part_ids = [element.Id for element in DB.FilteredElementCollector(doc).OfCategory(
DB.BuiltInCategory.OST_Parts).WhereElementIsNotElementType()]
# Get a mapping of part ids to fabrication part ids
part_mapping = DB.Fabrication.FabricationUtils.GetPartMappings(doc, part_ids)
# Get a fabrication service of type `DB.Fabrication.FabricationServiceType.Plumbing`
service = DB.Fabrication.FabricationUtils.GetService(doc, DB.Fabrication.FabricationServiceType.Plumbing)
# Determine if an element belongs to a fabrication service
is_part = DB.Fabrication.FabricationUtils.IsPartService(element)
Autodesk.Revit.DB.Fabrication.FabricationPartId
: Represents the identifier of a fabrication part.Autodesk.Revit.DB.Fabrication.FabricationService
: Represents a service in a Revit document that provides fabrication functionality.Autodesk.Revit.DB.Fabrication.PartId
: Represents the identifier of a part in a fabrication service.Autodesk.Revit.DB.FilteredElementCollector
: A class for filtering and querying Revit elements.