<?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 new family from existing in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560816#M63002</link>
    <description>&lt;P&gt;Hello, Jeremy. I am your fan). I think, that using Duplicate method will not solve my problem. I do not need to create new symbol. I want to create new family, based on source family. For example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    [Transaction(TransactionMode.Manual)]
    class CmdCreateFamily : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            Family sourceFamily = null;

            using (var trans = new Transaction(doc))
            {
                trans.Start("Select family");

                // Prompt user to select some family instance. SelectSingleElementOfType is my own method.
                var sourceFamilyInstance = uidoc.SelectSingleElementOfType&amp;lt;FamilyInstance&amp;gt;("Select FamilyInstance");
                
                // Get Family object from family instance
                sourceFamily = sourceFamilyInstance?.Symbol.Family;

                if (sourceFamily == null)
                    return Result.Failed;

                /*
                 * here I need to call something like:
                 * 
                 * var destFamily = sourceFamily.Clone();
                 * destFamily.Name = destFamily.Name + " dest";
                 * destFamily.SomeParam = "New value";
                 * destFamily.SaveToCurrentDrawing()
                 */

                trans.Commit();
            }

            return Result.Succeeded;
        }
    }&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Sep 2016 06:05:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-09-14T06:05:38Z</dc:date>
    <item>
      <title>Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6559414#M63000</link>
      <description>&lt;P&gt;Hello. I want to implement such feature:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;User places some component family instance on the drawing&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Then user selects it.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Program should extract the family object of the selected instance&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Program should create the copy of the extracted family, modify some parameter of the family (create new family on the base of existing), and place instance of newly created family on the drawing&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;I do not know how to create in-memory clone of the source family object and save it in current project (or separate .rfa file). How can I implement this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:20:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6559414#M63000</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-13T15:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560025#M63001</link>
      <description>&lt;P&gt;Use the Duplicate method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Discussed in 2008:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2008/11/creating-a-new-family-symbol.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2008/11/creating-a-new-family-symbol.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 19:11:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560025#M63001</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-13T19:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560816#M63002</link>
      <description>&lt;P&gt;Hello, Jeremy. I am your fan). I think, that using Duplicate method will not solve my problem. I do not need to create new symbol. I want to create new family, based on source family. For example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    [Transaction(TransactionMode.Manual)]
    class CmdCreateFamily : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            Family sourceFamily = null;

            using (var trans = new Transaction(doc))
            {
                trans.Start("Select family");

                // Prompt user to select some family instance. SelectSingleElementOfType is my own method.
                var sourceFamilyInstance = uidoc.SelectSingleElementOfType&amp;lt;FamilyInstance&amp;gt;("Select FamilyInstance");
                
                // Get Family object from family instance
                sourceFamily = sourceFamilyInstance?.Symbol.Family;

                if (sourceFamily == null)
                    return Result.Failed;

                /*
                 * here I need to call something like:
                 * 
                 * var destFamily = sourceFamily.Clone();
                 * destFamily.Name = destFamily.Name + " dest";
                 * destFamily.SomeParam = "New value";
                 * destFamily.SaveToCurrentDrawing()
                 */

                trans.Commit();
            }

            return Result.Succeeded;
        }
    }&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Sep 2016 06:05:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560816#M63002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T06:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560825#M63003</link>
      <description>&lt;P&gt;Wow, cool, thank you for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case you can use the EditFamily method to obtain the family definition document from the project in which an instance has been placed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On&amp;nbsp;the family document object, you can call SaveAs.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 06:12:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560825#M63003</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-14T06:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560901#M63004</link>
      <description>&lt;P&gt;And if I do not want to save new rfa file? If I want to do all this stuff in memory?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 07:16:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560901#M63004</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T07:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560942#M63005</link>
      <description>&lt;P&gt;Go ahead and try it out.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 07:49:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6560942#M63005</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-14T07:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561022#M63006</link>
      <description>&lt;P&gt;I am trying to do this for two days. And I do not know, how to implement this, that is why I am asking for help. As far as I understand:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;When I call var familyDoc =&amp;nbsp;doc.EditFamily(sourceFamily), Revit creates an independent copy of family for editing. But family document is the same as source family document&lt;/LI&gt;&lt;LI&gt;If I modify something in edited document, independent copy of the family is modified, and modfications are saved in family document.&lt;/LI&gt;&lt;LI&gt;And I do not understand, how can I load modified family in project as new family, without calling SaveAs on family doc (without creating new family doc on disk.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In general new in-memory family doc could be created, as you shown &lt;A href="http://thebuildingcoder.typepad.com/blog/2015/09/svg-in-memory-family-creation-and-revitlookup-bounding-box-1.html#5" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;. But I do not see the way to create new family document based on another family document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only solution I see, is to create new family document , and paste there all family symbols from source family, using Duplicate() method. And then modify copied family and load updated family in the project from new in-memory doc. But new family document could be created only using some family template. And again, I do not know, how to choose correct family template for new family doc, that corresponds to the family template of the source family.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 08:48:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561022#M63006</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T08:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561029#M63007</link>
      <description>&lt;P&gt;To modify the duplicate family without affecting the existing one, it needs to have a new, different name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The family name seems to be inextricably linked with the RFA filename.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, I suggest you use SaveAs to a file, rename the file to the new different name, a reload that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should work right there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot suggest any other approach off-hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 08:58:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561029#M63007</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-14T08:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create new family from existing</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561035#M63008</link>
      <description>&lt;P&gt;Thank you. Calling SaveAs works , of course. And I will try to find out another solution&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 09:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-from-existing/m-p/6561035#M63008</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T09:02:55Z</dc:date>
    </item>
  </channel>
</rss>

