<?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: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786713#M5177</link>
    <description>&lt;P&gt;And also edit Routing Preference. Here is the image:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-21 112122.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365051iD0F66D5880386F7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-21 112122.png" alt="Captura de pantalla 2024-05-21 112122.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2024 08:25:32 GMT</pubDate>
    <dc:creator>reylorente1</dc:creator>
    <dc:date>2024-05-21T08:25:32Z</dc:date>
    <item>
      <title>Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12785924#M5174</link>
      <description>&lt;P&gt;From a CAD, I am creating piping of a defined layer, using&lt;BR /&gt;the method Pipe.CreatePlaceholder(doc,......)&lt;/P&gt;&lt;P&gt;It works well for me, but it gives me a warning, that I should check, PipeSegment, since it gives me null&lt;/P&gt;&lt;P&gt;Try this way,&lt;BR /&gt;// ........&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using (Transaction curves = new Transaction(doc, "Create P1pe"))
{
    curves.Start();
    try
    {
        foreach (Curve c in curves11)
        {
            XYZ start = c.GetEndPoint(0);
            XYZ end = c.GetEndPoint(1);
            if (pipeType != null)
            {

                //dl = doc.Create.NewDetailCurve(doc.ActiveView, c);
                Pipe pipeHolder = Pipe.CreatePlaceholder(doc, systemType.Id, pipeType.Id, level, start, end);
                Parameter param = pipeHolder.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
                param.Set(0.041666666);
                string pipeSegmentNames = "PVC_ATA - Serie 40";
                var dfg = pipeHolder.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).AsValueString();
                dfg = pipeSegmentNames;
                listPlaceholder.Add(pipeHolder.Id);
            }
        }
        doc.Regenerate();
    }
    catch (System.Exception ex)
    {
        TaskDialog.Show("Info", ex.Message);
    }
    curves.Commit();

PipeSegment = null&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;// ..........&lt;/P&gt;&lt;P&gt;I made another change, adding RoutingPreferenceManager as I show below and it also gives me that the Pipe Segment = null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;PipeType pipeType = (from PipeType x in new FilteredElementCollector(doc).OfClass(typeof(PipeType))
                     where x.Name == "PVC - HID"
                     select x).First();
RoutingPreferenceManager rpm = pipeType.RoutingPreferenceManager;

int segmentCount = rpm.GetNumberOfRules(RoutingPreferenceRuleGroupType.Segments);

for (int index = 0; index != segmentCount; ++index)
{
    RoutingPreferenceRule segmentRule = rpm.GetRule(RoutingPreferenceRuleGroupType.Segments, index);
    Segment segment = doc.GetElement(segmentRule.MEPPartId) as Segment;

    string nombre = segment.Name; 
//.....
    
}&lt;/LI-CODE&gt;&lt;P&gt;I really don't know how to continue...&lt;BR /&gt;Any ideas....??&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 21:55:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12785924#M5174</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-05-20T21:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786232#M5175</link>
      <description>&lt;P&gt;Can you check the pipe segment name is a valid name and does exists in your project.&lt;/P&gt;&lt;PRE&gt;string pipeSegmentNames = "PVC_ATA - Serie 40";&lt;/PRE&gt;&lt;P&gt;your method works fine for me when i set the name correctly, if i used any other name, it indeed returns a null segment without giving any error&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 02:32:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786232#M5175</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2024-05-21T02:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786689#M5176</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, yes it is correct, here in the image I show you that it exists. Hello, yes it is correct, here I show you in the images, that it exists&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-21 101525.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365024iF90A01E464E93B2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-21 101525.png" alt="Captura de pantalla 2024-05-21 101525.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-21 101629.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365025iAB5858EE42F00F4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-21 101629.png" alt="Captura de pantalla 2024-05-21 101629.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the third image, it is the warning that it gives me&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-21 101735.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365026iA43B6D6FF1714CC6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-21 101735.png" alt="Captura de pantalla 2024-05-21 101735.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Also, I added this, but it gives me the same error:&lt;/P&gt;&lt;P&gt;string pipeSegmentNames = new FilteredElementCollector(doc)&lt;BR /&gt;.OfClass(typeof(PipeSegment))&lt;BR /&gt;.Cast&amp;lt;PipeSegment&amp;gt;()&lt;BR /&gt;.Where(s =&amp;gt; s.Name == "PVC_ATA - Serie 40")&lt;BR /&gt;.Select(s =&amp;gt; s.Name).First();&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 08:18:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786689#M5176</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-05-21T08:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786713#M5177</link>
      <description>&lt;P&gt;And also edit Routing Preference. Here is the image:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-21 112122.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365051iD0F66D5880386F7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-21 112122.png" alt="Captura de pantalla 2024-05-21 112122.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 08:25:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786713#M5177</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-05-21T08:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786880#M5178</link>
      <description>&lt;P&gt;1)it look more like you try to set diameter that is not in pipie segement size.&lt;BR /&gt;try to turn off setting diameter and see if it will repeat. Revit can be annoying with dangling double.&lt;BR /&gt;2)I would check in Revit look up how segments look up.&lt;BR /&gt;3) try to cast it as PipeSegment it shouldn't make difference but revit api can be weird sometimes, and we will try to catch everything we can&lt;/P&gt;&lt;P&gt;4) if it is null try to create it and see what will happen, maybe it is problem with string coding&lt;/P&gt;&lt;P&gt;5) see if setting culture to en-US for some thing it help&lt;/P&gt;&lt;P&gt;I honestly don't see anything wrong in code, that would make problem&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 10:00:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12786880#M5178</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2024-05-21T10:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12789445#M5179</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I was reading your recommendation; I did a little test. I created a pipe from two points, and the result seemed a little strange to me.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the code (Test):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void CreatePipe(UIDocument uidoc)
{
    Document doc = uidoc.Document;
    //UnitSystem unitsSystem = UnitSystem.Imperial;
    
    //Get PipingSystemType
    var systemType = new FilteredElementCollector(doc).OfClass(typeof(PipingSystemType)).FirstElementId();

    Level level = uidoc.ActiveView.GenLevel;

    //Get PipeType
    var pipeTypeId = new FilteredElementCollector(doc).OfClass(typeof(PipeType)).FirstElementId();

    string val = GetNameSegmentPipeTypeFromDocument(doc, pipeTypeId);

    XYZ StarPoint = new XYZ(0,0,0);
    XYZ EndPoint = new XYZ(60,0,0);

    using (Transaction curves = new Transaction(doc, "Create P1pe"))
    {
        curves.Start();
        Pipe pipeHolder = Pipe.Create(doc, systemType, pipeTypeId, level.Id, StarPoint, EndPoint);
        doc.Regenerate();
        curves.Commit();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I first opened it with a metric template and it kept giving me the same no result (PipeSegment = empty)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Plumbing-Default_Metric.rte&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-22 114016.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365670i603BA44DEB50E7BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-22 114016.png" alt="Captura de pantalla 2024-05-22 114016.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then I opened it with an Imperial screen and then it works, that is, the result appears.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Plumbing-Default.rte&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-05-22 114233.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365671i463ADA4DEA0B8990/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-05-22 114233.png" alt="Captura de pantalla 2024-05-22 114233.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And then it could be a Revit problem or something is missing in the code, so that it recognizes the value?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 08:45:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12789445#M5179</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2024-05-22T08:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pipe from CAD, using the Pipe.Create Placeholder method (PipeSegment = null).Why?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12913195#M5180</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hey there, I found this post because I am trying to do basically the same but for plumbing porpoises. Do you have any thoughts to share? I am stuck on the pipe system, the program always returns an error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just published something &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/td-p/12911712" target="_blank" rel="noopener"&gt;here&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/td-p/12911712" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/creating-pipe-placeholder-from-line/td-p/12911712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 21:42:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-pipe-from-cad-using-the-pipe-create-placeholder-method/m-p/12913195#M5180</guid>
      <dc:creator>h.f.h</dc:creator>
      <dc:date>2024-07-22T21:42:12Z</dc:date>
    </item>
  </channel>
</rss>

