<?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 error when duplicate family symbol ! in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781282#M5186</link>
    <description>&lt;P&gt;Please help me! oput of this mistake??&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-18 032506.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1364005i366BB0606966DDD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-18 032506.png" alt="Screenshot 2024-05-18 032506.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (Transaction pf = new Transaction(doc))&lt;BR /&gt;{&lt;BR /&gt;pf.Start("Place Instance");&lt;BR /&gt;&lt;BR /&gt;foreach (PolyLine pLine in pLines)&lt;BR /&gt;{&lt;BR /&gt;XYZ firstP = pLine.GetOutline().MaximumPoint;&lt;/P&gt;&lt;P&gt;XYZ lastP = pLine.GetOutline().MinimumPoint;&lt;/P&gt;&lt;P&gt;XYZ midP = new XYZ((firstP.X+ lastP.X)/2 , (firstP.Y+ lastP.Y)/2, (firstP.Z + lastP.Z)/2);&lt;/P&gt;&lt;P&gt;IList&amp;lt;XYZ&amp;gt; PLineXYZ = pLine.GetCoordinates();&lt;/P&gt;&lt;P&gt;double l1 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[0].DistanceTo(PLineXYZ[1]), UnitTypeId.Millimeters),0);&lt;/P&gt;&lt;P&gt;double l2 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[1].DistanceTo(PLineXYZ[2]), UnitTypeId.Millimeters), 0);&lt;/P&gt;&lt;P&gt;double Length = l1 &amp;gt; l2 ? l1 : l2;&lt;/P&gt;&lt;P&gt;double Width = l1 &amp;lt; l2 ? l1 : l2;&lt;/P&gt;&lt;P&gt;string symName = Length.ToString() + "x" + Width.ToString() + "x500mm";&lt;/P&gt;&lt;P&gt;FamilySymbol sym = (syms.Where(s =&amp;gt; s.Name == symName).FirstOrDefault()) ?? syms[0].Duplicate(symName) as FamilySymbol;&lt;/P&gt;&lt;P&gt;if (!sym.IsActive) sym.Activate();&lt;/P&gt;&lt;P&gt;FamilyInstance instance = doc.Create.NewFamilyInstance(midP, sym, level, StructuralType.Footing);&lt;BR /&gt;}&lt;BR /&gt;pf.Commit();&lt;BR /&gt;}&lt;BR /&gt;return Result.Succeeded;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 21:10:32 GMT</pubDate>
    <dc:creator>hanogkufu</dc:creator>
    <dc:date>2024-05-17T21:10:32Z</dc:date>
    <item>
      <title>error when duplicate family symbol !</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781282#M5186</link>
      <description>&lt;P&gt;Please help me! oput of this mistake??&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-18 032506.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1364005i366BB0606966DDD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-18 032506.png" alt="Screenshot 2024-05-18 032506.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (Transaction pf = new Transaction(doc))&lt;BR /&gt;{&lt;BR /&gt;pf.Start("Place Instance");&lt;BR /&gt;&lt;BR /&gt;foreach (PolyLine pLine in pLines)&lt;BR /&gt;{&lt;BR /&gt;XYZ firstP = pLine.GetOutline().MaximumPoint;&lt;/P&gt;&lt;P&gt;XYZ lastP = pLine.GetOutline().MinimumPoint;&lt;/P&gt;&lt;P&gt;XYZ midP = new XYZ((firstP.X+ lastP.X)/2 , (firstP.Y+ lastP.Y)/2, (firstP.Z + lastP.Z)/2);&lt;/P&gt;&lt;P&gt;IList&amp;lt;XYZ&amp;gt; PLineXYZ = pLine.GetCoordinates();&lt;/P&gt;&lt;P&gt;double l1 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[0].DistanceTo(PLineXYZ[1]), UnitTypeId.Millimeters),0);&lt;/P&gt;&lt;P&gt;double l2 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[1].DistanceTo(PLineXYZ[2]), UnitTypeId.Millimeters), 0);&lt;/P&gt;&lt;P&gt;double Length = l1 &amp;gt; l2 ? l1 : l2;&lt;/P&gt;&lt;P&gt;double Width = l1 &amp;lt; l2 ? l1 : l2;&lt;/P&gt;&lt;P&gt;string symName = Length.ToString() + "x" + Width.ToString() + "x500mm";&lt;/P&gt;&lt;P&gt;FamilySymbol sym = (syms.Where(s =&amp;gt; s.Name == symName).FirstOrDefault()) ?? syms[0].Duplicate(symName) as FamilySymbol;&lt;/P&gt;&lt;P&gt;if (!sym.IsActive) sym.Activate();&lt;/P&gt;&lt;P&gt;FamilyInstance instance = doc.Create.NewFamilyInstance(midP, sym, level, StructuralType.Footing);&lt;BR /&gt;}&lt;BR /&gt;pf.Commit();&lt;BR /&gt;}&lt;BR /&gt;return Result.Succeeded;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 21:10:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781282#M5186</guid>
      <dc:creator>hanogkufu</dc:creator>
      <dc:date>2024-05-17T21:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: error when duplicate family symbol !</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781516#M5187</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3916511"&gt;@hanogkufu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; You are trying to duplicate with existing family symbol name. so the error is popping up. The name which you’re using for duplicate must be unique and no family symbol should use that name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 00:18:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781516#M5187</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-05-18T00:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: error when duplicate family symbol !</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781705#M5188</link>
      <description>&lt;P&gt;Thank for your answer! But i do the condition above, if the "name" existing it must be assign to&amp;nbsp; the sym before and didn't create new family symbol&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 03:47:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12781705#M5188</guid>
      <dc:creator>hanogkufu</dc:creator>
      <dc:date>2024-05-18T03:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: error when duplicate family symbol !</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12782050#M5189</link>
      <description>&lt;P&gt;I think you missed filling back the syms collection with the new created symbol&lt;/P&gt;&lt;P&gt;you need to amend your code to something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;FamilySymbol sym = (syms.Where(s =&amp;gt; s.Name == symName).FirstOrDefault());
if (sym == null)
{
    sym = syms[0].Duplicate(symName) as FamilySymbol;
    syms.Add(sym);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 11:01:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12782050#M5189</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2024-05-18T11:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: error when duplicate family symbol !</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12782718#M5190</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/549406"&gt;@Moustafa_K&lt;/a&gt;&amp;nbsp; yes it is ! thank you so much!&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 00:10:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/error-when-duplicate-family-symbol/m-p/12782718#M5190</guid>
      <dc:creator>hanogkufu</dc:creator>
      <dc:date>2024-05-19T00:10:44Z</dc:date>
    </item>
  </channel>
</rss>

