/// <summary> /// Internals the type of the set piping system. /// </summary> /// <param name="type">The type.</param> private void InternalSetPipingSystemType(Autodesk.Revit.DB.Plumbing.PipingSystemType type) { if (InternalMEPCurve.MEPSystem.GetTypeId().IntegerValue.Equals(type.Id.IntegerValue)) { return; } TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); InternalMEPCurve.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM).Set(type.Id); TransactionManager.Instance.TransactionTaskDone(); }
/// <summary> /// Initialize a Pipe element /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="pipingSystemType">Type of the piping system.</param> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <param name="level">The level.</param> private void InitObject(Autodesk.Revit.DB.Plumbing.PipeType pipeType, Autodesk.Revit.DB.Plumbing.PipingSystemType pipingSystemType, 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.Plumbing.Pipe.Create(DocumentManager.Instance.CurrentDBDocument, pipingSystemType.Id, pipeType.Id, level.Id, start, end); } InternalSetMEPCurve(fi); TransactionManager.Instance.TransactionTaskDone(); ElementBinder.SetElementForTrace(InternalElement); }
/// <summary> /// Initializes a new instance of the <see cref="Pipe"/> 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 Pipe(Autodesk.Revit.DB.Plumbing.PipeType pipeType, Autodesk.Revit.DB.Plumbing.PipingSystemType systemType, XYZ start, XYZ end, Autodesk.Revit.DB.Level level) { InitObject(pipeType, systemType, start, end, level); }