<?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: a gap between  sprinkle and pipe even connect in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192397#M38060</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4284051"&gt;@1368026189&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hey, i think i can tell what is going on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know you do not want to transform anything in your code, but it is literally one line and since these sprinklers are not attached it should not affect anything. Connectors have to already have the same origin for ConnectTo() to work, you can guarantee that by doing something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System.Linq;&lt;BR /&gt;&lt;BR /&gt;//my new create&amp;nbsp;Sprinkle
var fi = doc.Create.NewFamilyInstance(pt, fs, level, StructuralType.NonStructural);

var conSprinkler = fi.MEPModel.ConnectorManager.Connectors&lt;BR /&gt;.OfType&amp;lt;Connector&amp;gt;()&lt;BR /&gt;.First(); //(optional change) you said sprinklers only have 1 connector, this is the fastest way to get it i know of.&lt;BR /&gt;&lt;BR /&gt;con.Owner.Location.Move(connector.Origin - con.Origin); //this line &lt;BR /&gt;
con.ConnectTo(connector);//connector is the needed connector of my pipe&amp;nbsp;

//doc.Regenerate()//does not make any difference

return fi;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be surprised if this did not fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if these are FabricationParts there is a different function to use to connect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matt&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>Tue, 10 Dec 2019 04:14:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-12-10T04:14:33Z</dc:date>
    <item>
      <title>a gap between  sprinkle and pipe even connect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192379#M38059</link>
      <description>&lt;P&gt;i have to move slightly to make it show right ,like in the gif ,&lt;/P&gt;&lt;P&gt;but i do not want to transform anything in my code,&lt;/P&gt;&lt;P&gt;i s there any other way to solve?&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;&lt;PRE&gt;//my new create&amp;nbsp;Sprinkle
var fi = doc.Create.NewFamilyInstance(pt, fs, level, StructuralType.NonStructural);

var conSet = fi.MEPModel.ConnectorManager.Connectors;
foreach (Connector con in conSet) //Sprinkle only has one connector
{
con.ConnectTo(connector);//connector is the needed connector of my pipe&amp;nbsp;

//doc.regernerate()//does not make any difference
break;
}

return fi;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 03:55:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192379#M38059</guid>
      <dc:creator>1368026189</dc:creator>
      <dc:date>2019-12-10T03:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: a gap between  sprinkle and pipe even connect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192397#M38060</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4284051"&gt;@1368026189&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hey, i think i can tell what is going on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know you do not want to transform anything in your code, but it is literally one line and since these sprinklers are not attached it should not affect anything. Connectors have to already have the same origin for ConnectTo() to work, you can guarantee that by doing something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System.Linq;&lt;BR /&gt;&lt;BR /&gt;//my new create&amp;nbsp;Sprinkle
var fi = doc.Create.NewFamilyInstance(pt, fs, level, StructuralType.NonStructural);

var conSprinkler = fi.MEPModel.ConnectorManager.Connectors&lt;BR /&gt;.OfType&amp;lt;Connector&amp;gt;()&lt;BR /&gt;.First(); //(optional change) you said sprinklers only have 1 connector, this is the fastest way to get it i know of.&lt;BR /&gt;&lt;BR /&gt;con.Owner.Location.Move(connector.Origin - con.Origin); //this line &lt;BR /&gt;
con.ConnectTo(connector);//connector is the needed connector of my pipe&amp;nbsp;

//doc.Regenerate()//does not make any difference

return fi;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be surprised if this did not fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if these are FabricationParts there is a different function to use to connect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matt&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>Tue, 10 Dec 2019 04:14:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192397#M38060</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-10T04:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: a gap between  sprinkle and pipe even connect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192453#M38061</link>
      <description>&lt;P&gt;Hi @Anonymous :&lt;/P&gt;&lt;P&gt;OfType&amp;lt;T&amp;gt;() extension method and First() extension method are all from .NET LINQ lib, which I do not think of as very fast way to fetch a connector from Revit DB.&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var iterator = ConnectorManager.Connectors.ForwardIterator;
if (iterator.MoveNext())
{
    var connector = iterator.Current as Connector;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I do not suggest Location.Move() method. Sometimes LocationCurve elements will not be correct until I Commit the entire Transaction, even I called Document.Regenerate().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ElementTransformUtils.MoveElement()&lt;/PRE&gt;&lt;P&gt;method works much better. As far as the usage in MEP domain, MoveELement() will automatically calculate other MEPCurve elements that will following the element you have just moved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I strongly disagree connecting connectors via ConnectTo() method.&lt;/P&gt;&lt;P&gt;Wanna connec a Pipe to a Sprinkler? Get a pair of face-to-face connectors, of which one is from the Pipe and the other is from Sprinkler. Make sure they are face-to-face, and parallel!&lt;/P&gt;&lt;P&gt;Use&lt;/P&gt;&lt;DIV&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;Document&lt;SPAN class="languageSpecificText"&gt;&lt;SPAN class="cs"&gt;.&lt;/SPAN&gt;&lt;SPAN class="vb"&gt;.&lt;/SPAN&gt;&lt;SPAN class="cpp"&gt;::&lt;/SPAN&gt;&lt;SPAN class="nu"&gt;.&lt;/SPAN&gt;&lt;SPAN class="fs"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;NewTransitionFitting Method &lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;to connect these 2 connectors.&lt;/P&gt;&lt;P&gt;This method requires 2 parallel and face to face connectors. &lt;EM&gt;Actually, Revit&amp;nbsp; API allows 0.1 degree inaccuracy.&lt;/EM&gt; This method does not care if they are far away from each other. The Pipe will &lt;STRONG&gt;fit itself&lt;/STRONG&gt; to meet the generation of a possible Transition fitting.&lt;/P&gt;&lt;P&gt;Revit will automatically decide if it's necessary to insert a Transition fitting or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Violently using ConnecTo() is annoying&lt;/STRONG&gt;, which causes lots of protential error in the future.&lt;/P&gt;&lt;P&gt;Suppose today you use ConnectTo() method to connect two connectors which are not strictly at the same point (maybe 1mm far away from each other), or not strictly parallel to each other.&lt;/P&gt;&lt;P&gt;In the future, you might wanna check if Pipes and Elbows, Tees are "correctly" connected. In this case, you might wanna check if the Connector.Origin are at the same X,Y,Z point? You also might wanna check if 2 connectors are parallel to each other. Then what? You have to face lots of ridiculous errors, which are caused by abuse using ConnectTo() method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last but not least, I mean no offence to no one! We have run into such issues for hundreds of times while testing our product in some RVT documents generated by some other company's&amp;nbsp; products, which contains countless above-mentioned errors.!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nice working day. Let's make all MEP developers' life easier.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 10 Dec 2019 05:44:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9192453#M38061</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-12-10T05:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: a gap between  sprinkle and pipe even connect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9198248#M38062</link>
      <description>thanks a lot friend！</description>
      <pubDate>Thu, 12 Dec 2019 10:24:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9198248#M38062</guid>
      <dc:creator>1368026189</dc:creator>
      <dc:date>2019-12-12T10:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: a gap between  sprinkle and pipe even connect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9200442#M38063</link>
      <description>&lt;P&gt;哈哈！不客气！&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 08:14:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-gap-between-sprinkle-and-pipe-even-connect/m-p/9200442#M38063</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-12-13T08:14:57Z</dc:date>
    </item>
  </channel>
</rss>

