<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating Pipe Placeholder from line in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914159#M4039</link>
    <description>&lt;P&gt;Thank you, your old post helped me a lot. I don't understand why I needed to declare the variables as 'var' and not as 'PipeSystems' or 'PipeSegments', but it just works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the final version so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the given view's level for beam creation&lt;BR /&gt;Level level = uiDoc.ActiveView.GenLevel;&lt;/P&gt;&lt;P&gt;//SYSTEM TYPE&lt;BR /&gt;var systemType = new FilteredElementCollector(doc).OfClass(typeof(PipingSystemType)).FirstElementId();&lt;BR /&gt;//FilteredElementCollector collector = new FilteredElementCollector(document).OfClass(typeof(MEPSystem));&lt;/P&gt;&lt;P&gt;ElementId sysId = systemType;&lt;BR /&gt;Boolean teste = Pipe.IsPipingSystemTypeId(document, sysId);&lt;/P&gt;&lt;P&gt;//foreach (MEPSystem syselement in collector)&lt;BR /&gt;//{&lt;BR /&gt;// ElementId sysId1 = syselement.Id as ElementId;&lt;BR /&gt;// Boolean teste = Pipe.IsPipingSystemTypeId(document, sysId1);&lt;BR /&gt;// if (teste == true)&lt;BR /&gt;// {&lt;BR /&gt;// sysId = sysId1;&lt;BR /&gt;// }&lt;/P&gt;&lt;P&gt;//}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//MEPSystem systemType = collector.FirstElement() as MEPSystem;&lt;BR /&gt;//SEGMENT TYPE&lt;BR /&gt;//FilteredElementCollector collector2 = new FilteredElementCollector(document)&lt;BR /&gt;// .OfClass(typeof(PipeSegment));&lt;/P&gt;&lt;P&gt;//PipeSegment pipeType = collector2.FirstElement() as PipeSegment;&lt;BR /&gt;var pipeTypeId = new FilteredElementCollector(document).OfClass(typeof(PipeType)).FirstElementId();&lt;BR /&gt;// need this part to return some value&lt;BR /&gt;LocationCurve c = element.Location as LocationCurve;&lt;BR /&gt;XYZ start = c.Curve.GetEndPoint(0);&lt;BR /&gt;XYZ end = c.Curve.GetEndPoint(1);&lt;BR /&gt;Curve beamLine = Line.CreateBound(start, end);&lt;/P&gt;&lt;P&gt;// create a new beam&lt;BR /&gt;Pipe placeholder = Pipe.CreatePlaceholder(doc, sysId, pipeTypeId, level.Id, start, end);&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 10:06:58 GMT</pubDate>
    <dc:creator>h.f.h</dc:creator>
    <dc:date>2024-07-23T10:06:58Z</dc:date>
    <item>
      <title>Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12911712#M4035</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble creating pipe placeholders in Revit. The function always returns an error stating 'The systemTypeId is not a valid piping system type.' I've tried using all possible system types, but the issue persists. Can someone assist me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code so far:&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&lt;BR /&gt;ElementId levelId = view.LevelId as ElementId;&lt;/P&gt;&lt;P&gt;//&lt;BR /&gt;FilteredElementCollector collector = new FilteredElementCollector(document)&lt;BR /&gt;.OfClass(typeof(MEPSystem));&lt;/P&gt;&lt;P&gt;ElementId sysId = null;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;foreach (MEPSystem syselement in collector)&lt;BR /&gt;{&lt;BR /&gt;ElementId sysId1 = syselement.Id as ElementId;&lt;BR /&gt;Boolean teste = Pipe.IsPipingSystemTypeId(document, sysId1);&lt;BR /&gt;if (teste == true)&lt;BR /&gt;{&lt;BR /&gt;sysId = sysId1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//MEPSystem systemType = collector.FirstElement() as MEPSystem;&lt;BR /&gt;//SEGMENT TYPE&lt;BR /&gt;FilteredElementCollector collector2 = new FilteredElementCollector(document)&lt;BR /&gt;.OfClass(typeof(PipeSegment));&lt;/P&gt;&lt;P&gt;PipeSegment pipeType = collector2.FirstElement() as PipeSegment;&lt;BR /&gt;&lt;BR /&gt;//&amp;nbsp;&lt;BR /&gt;LocationCurve c = element.Location as LocationCurve;&lt;BR /&gt;XYZ start = c.Curve.GetEndPoint(0);&lt;BR /&gt;XYZ end = c.Curve.GetEndPoint(1);&lt;BR /&gt;Curve beamLine = Line.CreateBound(start, end);&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&lt;BR /&gt;Pipe placeholder = Pipe.CreatePlaceholder(doc, sysId, pipeType.Id, levelId, start, end);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return placeholder;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 20:11:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12911712#M4035</guid>
      <dc:creator>h.f.h</dc:creator>
      <dc:date>2024-07-22T20:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12912417#M4036</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt; :&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;FilteredElementCollector collector2 = new FilteredElementCollector(document) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;.OfClass(typeof(Pipe)).OfCategory(&lt;EM&gt;&lt;STRONG&gt;BuiltInCategory.OST_PipeSegments&lt;/STRONG&gt;&lt;/EM&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;You don't get the PipeType, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;you must use:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FilteredElementCollector collector2 = new FilteredElementCollector(&lt;SPAN&gt;document&lt;/SPAN&gt;)&lt;BR /&gt;.OfClass(typeof(PipeType));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or you can use directly:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//Get PipeType&lt;BR /&gt;var pipeType = new FilteredElementCollector(document).OfClass(typeof(PipeType)).FirstElementId();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 14:40:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12912417#M4036</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-07-22T14:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12913070#M4037</link>
      <description>&lt;P&gt;Sorry, I've posted an early version of the code. Just updated. Thank you, by the way.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 20:13:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12913070#M4037</guid>
      <dc:creator>h.f.h</dc:creator>
      <dc:date>2024-07-22T20:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914040#M4038</link>
      <description>&lt;LI-CODE lang="general"&gt;public void CreatePipe(UIDocument uidoc)
{
    Document doc = uidoc.Document;

    ElementId getElementId = uidoc.Selection.GetElementIds().FirstOrDefault();

    XYZ starPoint = null;
    XYZ endPoint = null;

    CurveElement curveElement = null;

    if (doc.GetElement(getElementId) is CurveElement)
    {
        curveElement = doc.GetElement(getElementId) as CurveElement;

       Curve curve = curveElement.GeometryCurve;

         starPoint = curve.GetEndPoint(0);
         endPoint = curve.GetEndPoint(1);
    } 


    //Get Level
    var level = uidoc.ActiveView.GenLevel;

    //Get PipingSystemType
    PipingSystemType systemType = (from PipingSystemType x in new FilteredElementCollector(doc).OfClass(typeof(PipingSystemType))
                                   where x.SystemClassification == MEPSystemClassification.DomesticColdWater
                                   select x).First();


    //Get PipeType
    var pipeType = new FilteredElementCollector(doc).OfClass(typeof(PipeType)).FirstElementId();

    using (Transaction curves = new Transaction(doc, "Create P1pe"))
    {
        curves.Start();
        //doc.Regenerate();
        Pipe pipeHolder = Pipe.CreatePlaceholder(doc, systemType.Id, pipeType, level.Id, starPoint, endPoint);
        //Adicionar Diametro
        Parameter param = pipeHolder.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
        double valor = 0.4921259842519685;// 150 mm
        param.Set(valor);
        
        doc.Regenerate();
        doc.Delete(curveElement.Id);

        curves.Commit();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;I hope it helps you.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 09:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914040#M4038</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-07-23T09:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914159#M4039</link>
      <description>&lt;P&gt;Thank you, your old post helped me a lot. I don't understand why I needed to declare the variables as 'var' and not as 'PipeSystems' or 'PipeSegments', but it just works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the final version so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// get the given view's level for beam creation&lt;BR /&gt;Level level = uiDoc.ActiveView.GenLevel;&lt;/P&gt;&lt;P&gt;//SYSTEM TYPE&lt;BR /&gt;var systemType = new FilteredElementCollector(doc).OfClass(typeof(PipingSystemType)).FirstElementId();&lt;BR /&gt;//FilteredElementCollector collector = new FilteredElementCollector(document).OfClass(typeof(MEPSystem));&lt;/P&gt;&lt;P&gt;ElementId sysId = systemType;&lt;BR /&gt;Boolean teste = Pipe.IsPipingSystemTypeId(document, sysId);&lt;/P&gt;&lt;P&gt;//foreach (MEPSystem syselement in collector)&lt;BR /&gt;//{&lt;BR /&gt;// ElementId sysId1 = syselement.Id as ElementId;&lt;BR /&gt;// Boolean teste = Pipe.IsPipingSystemTypeId(document, sysId1);&lt;BR /&gt;// if (teste == true)&lt;BR /&gt;// {&lt;BR /&gt;// sysId = sysId1;&lt;BR /&gt;// }&lt;/P&gt;&lt;P&gt;//}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//MEPSystem systemType = collector.FirstElement() as MEPSystem;&lt;BR /&gt;//SEGMENT TYPE&lt;BR /&gt;//FilteredElementCollector collector2 = new FilteredElementCollector(document)&lt;BR /&gt;// .OfClass(typeof(PipeSegment));&lt;/P&gt;&lt;P&gt;//PipeSegment pipeType = collector2.FirstElement() as PipeSegment;&lt;BR /&gt;var pipeTypeId = new FilteredElementCollector(document).OfClass(typeof(PipeType)).FirstElementId();&lt;BR /&gt;// need this part to return some value&lt;BR /&gt;LocationCurve c = element.Location as LocationCurve;&lt;BR /&gt;XYZ start = c.Curve.GetEndPoint(0);&lt;BR /&gt;XYZ end = c.Curve.GetEndPoint(1);&lt;BR /&gt;Curve beamLine = Line.CreateBound(start, end);&lt;/P&gt;&lt;P&gt;// create a new beam&lt;BR /&gt;Pipe placeholder = Pipe.CreatePlaceholder(doc, sysId, pipeTypeId, level.Id, start, end);&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 10:06:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914159#M4039</guid>
      <dc:creator>h.f.h</dc:creator>
      <dc:date>2024-07-23T10:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914198#M4040</link>
      <description>It seems to me that you should see the API Documentation, so you can see how a PlaceHolder is created&lt;BR /&gt;&lt;A href="https://www.revitapidocs.com/2024/f291f914-aa0c-f6b0-c824-3fffe0191aba.htm" target="_blank"&gt;https://www.revitapidocs.com/2024/f291f914-aa0c-f6b0-c824-3fffe0191aba.htm&lt;/A&gt;.</description>
      <pubDate>Tue, 23 Jul 2024 10:35:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914198#M4040</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-07-23T10:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914207#M4041</link>
      <description>I think you should see the API Documentation, so you can see how to create a PlaceHolder.&lt;BR /&gt;But the interesting thing would be how to add the elbows and the tee, since, if you are looking for PlumbingUtils, there are two methods, to make these additions, that is, select, when it is a tee and when it is an elbow, in the same path where these lines meet.</description>
      <pubDate>Tue, 23 Jul 2024 10:44:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914207#M4041</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-07-23T10:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914213#M4042</link>
      <description>&lt;P&gt;I know that and I also checked the project browser in visual studio. But for exemple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FilteredElementCollector collector2 = new FilteredElementCollector(document).OfClass(typeof(PipeSegment));

PipeSegment pipeType = collector2.FirstElement() as PipeSegment;  ----&amp;gt; than ---&amp;gt; pipeType.Id at the createplaceholder method (GOT AN ERROR)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for this it&amp;nbsp;works :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;var pipeTypeId = new FilteredElementCollector(document).OfClass(typeof(PipeType)).FirstElementId(); &lt;/LI-CODE&gt;&lt;P&gt;Can't see why. Missing something here.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 10:49:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914213#M4042</guid>
      <dc:creator>h.f.h</dc:creator>
      <dc:date>2024-07-23T10:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Pipe Placeholder from line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914236#M4043</link>
      <description>To create the PlaceHolder, you need the PipeType and not the pipeSegment.See the documentation:&lt;BR /&gt;CreatePlaceholder Method:&lt;BR /&gt;Creates a new placeholder pipe.&lt;BR /&gt;C#&lt;BR /&gt;public static Pipe CreatePlaceholder(&lt;BR /&gt;Document document,&lt;BR /&gt;ElementId systemTypeId,&lt;BR /&gt;ElementId pipeTypeId,&lt;BR /&gt;ElementId levelId,&lt;BR /&gt;XYZ startPoint,&lt;BR /&gt;XYZ endPoint&lt;BR /&gt;)&lt;BR /&gt;Parameters&lt;BR /&gt;document&lt;BR /&gt;Type: Autodesk.Revit.DB Document&lt;BR /&gt;The document.&lt;BR /&gt;systemTypeId&lt;BR /&gt;Type: Autodesk.Revit.DB ElementId&lt;BR /&gt;The ElementId of the piping system type.&lt;BR /&gt;pipeTypeId&lt;BR /&gt;Type: Autodesk.Revit.DB ElementId&lt;BR /&gt;The ElementId of the pipe type.&lt;BR /&gt;levelId&lt;BR /&gt;Type: Autodesk.Revit.DB ElementId&lt;BR /&gt;The level id for the pipe.&lt;BR /&gt;startPoint&lt;BR /&gt;Type: Autodesk.Revit.DB XYZ&lt;BR /&gt;The first point of the placeholder line.&lt;BR /&gt;endPoint&lt;BR /&gt;Type: Autodesk.Revit.DB XYZ&lt;BR /&gt;The second point of the placeholder line.</description>
      <pubDate>Tue, 23 Jul 2024 11:01:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/m-p/12914236#M4043</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-07-23T11:01:22Z</dc:date>
    </item>
  </channel>
</rss>

