/// <summary> /// Internals the type of the set piping system. /// </summary> /// <param name="type">The type.</param> private void InternalSetPipingSystemType(Autodesk.Revit.DB.Mechanical.MechanicalSystemType type) { if (InternalMEPCurve.MEPSystem.GetTypeId().IntegerValue.Equals(type.Id.IntegerValue)) { return; } TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); InternalMEPCurve.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM).Set(type.Id); TransactionManager.Instance.TransactionTaskDone(); }
/// <summary> /// Initialize a Duct element /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="systemType">Type of the system.</param> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <param name="level">The level.</param> private void InitPipe(Autodesk.Revit.DB.Mechanical.DuctType pipeType, Autodesk.Revit.DB.Mechanical.MechanicalSystemType systemType, XYZ start, XYZ end, Autodesk.Revit.DB.Level level) { //Phase 1 - Check to see if the object exists and should be rebound var oldFam = ElementBinder.GetElementFromTrace <Autodesk.Revit.DB.MEPCurve>(DocumentManager.Instance.CurrentDBDocument); //There was a point, rebind to that, and adjust its position if (oldFam != null) { InternalSetMEPCurve(oldFam); InternalSetMEPCurveType(pipeType); InternalSetPosition(start, end); return; } //Phase 2- There was no existing point, create one TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); Autodesk.Revit.DB.MEPCurve fi; if (DocumentManager.Instance.CurrentDBDocument.IsFamilyDocument) { fi = null; } else { fi = Autodesk.Revit.DB.Mechanical.Duct.Create(DocumentManager.Instance.CurrentDBDocument, systemType.Id, pipeType.Id, level.Id, start, end); } InternalSetMEPCurve(fi); TransactionManager.Instance.TransactionTaskDone(); ElementBinder.SetElementForTrace(InternalElement); }
/// <summary> /// Initializes a new instance of the <see cref="Duct"/> class. /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="systemType">Type of the system.</param> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <param name="level">The level.</param> internal Duct(Autodesk.Revit.DB.Mechanical.DuctType pipeType, Autodesk.Revit.DB.Mechanical.MechanicalSystemType systemType, XYZ start, XYZ end, Autodesk.Revit.DB.Level level) { InitPipe(pipeType, systemType, start, end, level); }