<?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: Family Instance Already Exist in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602235#M62673</link>
    <description>&lt;P&gt;"In this case only 5% to 30% chance to detect already placed instances before placement."&lt;BR /&gt;I don't know from where you take this %.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public bool InstanceExist(Document document, XYZ point)
{
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document).OfClass(typeof(Instance));

      foreach (Instance instance in filteredElementCollector)
      {
       Element element = instance as Element;
       Location loc = instance.Location;
       LocationPoint locpoint = loc as LocationPoint;
           if (locpoint.Point.IsAlmostEqualTo(point, 0.001))
           {
            return true;
           }
      }
return false;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is importent to use IsAlmostEqualTo() in Revit for points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2016 08:09:24 GMT</pubDate>
    <dc:creator>MarryTookMyCoffe</dc:creator>
    <dc:date>2016-10-05T08:09:24Z</dc:date>
    <item>
      <title>Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6593940#M62669</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings for the Day..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to check a family instance is already present at a specific location (that is at XYZ location) in revit document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kailash&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 07:21:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6593940#M62669</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-30T07:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6593969#M62670</link>
      <description>&lt;P&gt;Dear Kailash,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use failure processing event to catch "&lt;SPAN&gt;&lt;STRONG&gt;family instance is already exist. &lt;/STRONG&gt;You never get before placing.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 07:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6593969#M62670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-30T07:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6594133#M62671</link>
      <description>&lt;P&gt;Thanks manish for the reply, but any other way is there rather than you mentioned.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 09:42:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6594133#M62671</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-30T09:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6595078#M62672</link>
      <description>As i know there is no other way. Because warning message trigger only when such event occurs. We need to catch them and act properly as you want.&lt;BR /&gt;&lt;BR /&gt;Another way tried but that way is not effective and it increase processing time to a great extent.&lt;BR /&gt;&lt;BR /&gt;Tried trick......&lt;BR /&gt;Making list of already placed element and check there placement.&lt;BR /&gt;&lt;BR /&gt;In this case only 5% to 30% chance to detect already placed instances before placement.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Sep 2016 16:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6595078#M62672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-30T16:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602235#M62673</link>
      <description>&lt;P&gt;"In this case only 5% to 30% chance to detect already placed instances before placement."&lt;BR /&gt;I don't know from where you take this %.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public bool InstanceExist(Document document, XYZ point)
{
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document).OfClass(typeof(Instance));

      foreach (Instance instance in filteredElementCollector)
      {
       Element element = instance as Element;
       Location loc = instance.Location;
       LocationPoint locpoint = loc as LocationPoint;
           if (locpoint.Point.IsAlmostEqualTo(point, 0.001))
           {
            return true;
           }
      }
return false;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is importent to use IsAlmostEqualTo() in Revit for points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 08:09:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602235#M62673</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2016-10-05T08:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602339#M62674</link>
      <description>&lt;P&gt;Dear Marry,&lt;BR /&gt;&lt;BR /&gt;This % is based on observation that i did of course this may vary to various scenario. But the best way to do this is catching warning.&lt;BR /&gt;&lt;BR /&gt;Before placement if you want to check instance is available or not for that Making list of location is not a best way.&lt;BR /&gt;&lt;BR /&gt;Due to following reason.&lt;BR /&gt;&lt;BR /&gt;1. Whenever you created a list while placing element. If Some modification is done the location will change so you need to modify the used list.&lt;BR /&gt;Hard to maintain (For big files).&lt;BR /&gt;&lt;BR /&gt;2. Your calculation of Location(XYZ) is based on decimal point that need tolerance.&lt;BR /&gt;3. You do not decide how much tolerance is good. You get exception for every assumed tolerance for some element.&lt;BR /&gt;4. Some time you also get some element have Z-location reported as zero.But actually it not zero. It depend on family.&lt;BR /&gt;&lt;BR /&gt;Yes i&amp;nbsp;accept % is not good to tell. It may different in various scenario.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 09:24:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602339#M62674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-05T09:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602617#M62675</link>
      <description>I feel like you miss the point. What he what to know if he can put instance in this place(he will be fine as long as he will no try to put the same thing over and over in one transaction). What I gave him was example to try.&lt;BR /&gt;I chose what tolerance is fine with me, as he can he. No one need perfect tolerance.&lt;BR /&gt;four sounds like a bug&lt;BR /&gt;&lt;BR /&gt;BTW: if you don't what to use the entire nickname, than don't use it at all.</description>
      <pubDate>Wed, 05 Oct 2016 12:19:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6602617#M62675</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2016-10-05T12:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6616954#M62676</link>
      <description>&lt;P&gt;Thanks Marry,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution which you provided is suitable for my scenario and its working like charm...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;thanks once again..&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 09:19:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6616954#M62676</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-12T09:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Already Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6622769#M62677</link>
      <description>np, glad I could help</description>
      <pubDate>Fri, 14 Oct 2016 13:34:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-already-exist/m-p/6622769#M62677</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2016-10-14T13:34:21Z</dc:date>
    </item>
  </channel>
</rss>

