<?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 Instance in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954933#M29444</link>
    <description>&lt;P&gt;Maybe use "PromptForFamilyInstancePlacement"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see:&amp;nbsp;&lt;A title="PromptForFamilyInstancePlacement Method" href="https://www.revitapidocs.com/2020/b05a17df-3f63-9172-8e49-d2e1e6b8e9e2.htm" target="_blank" rel="noopener"&gt;PromptForFamilyInstancePlacement Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Michel&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2020 22:45:41 GMT</pubDate>
    <dc:creator>TripleM-Dev.net</dc:creator>
    <dc:date>2020-12-21T22:45:41Z</dc:date>
    <item>
      <title>Create New Family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954555#M29442</link>
      <description>&lt;P&gt;I have been researching and learning python to write code to perform this task using pyrevit to build my tab and buttons.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting create a pushbutton tool to insert a generic annotation symbol into the active view within revit. I have had success with creating the pushbutton and getting the tool to insert the family using XYZ(0,0,0). What I would like to have happen is to have the user place the symbol using the mouse instead of a coordinate system because it could be multiple places and not always the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My second issue that this currently does not work with nested families. When using the tool it places every type within the family in the same location. I would like to be able to use the same family but create different buttons for each family type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I got from this site on a post from about two years ago and that post is now locked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone could take a look and offer some advice or help modify the code below that would be awesome.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import clr
clr.AddReference('RevitAPI') 
clr.AddReference('RevitAPIUI') 
from Autodesk.Revit.DB import *

app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
 
t = Transaction(doc, 'Create family instance.')
 
t.Start()
 
#Family symbol name to place.
symbName = 'CN_AIRFLOW ARROW'
 
#create a filtered element collector set to Category OST_Mass and Class FamilySymbol 
collector = FilteredElementCollector(doc)
collector.OfCategory(BuiltInCategory.OST_GenericAnnotation)
collector.OfClass(FamilySymbol)
 
famtypeitr = collector.GetElementIdIterator()
famtypeitr.Reset()
 
#Search Family Symbols in document.
for item in famtypeitr:
    famtypeID = item
    famsymb = doc.GetElement(famtypeID)
 
    #If the FamilySymbol is the name we are looking for, create a new instance.
    if famsymb.Family.Name == symbName:
 
        #location to place family
        loc = XYZ(0,0,0)
 
        #NewFamilyInstance()
        familyInst = doc.Create.NewFamilyInstance(loc, famsymb, doc.ActiveView)
 
t.Commit()&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 19:27:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954555#M29442</guid>
      <dc:creator>george_kaline</dc:creator>
      <dc:date>2020-12-21T19:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create New Family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954633#M29443</link>
      <description>&lt;P&gt;You should be able to use pickpoint to allow the user to click the mouse where they want the element inserted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;loc = XYZ(0,0,0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use something like this ( I don't use python, so you may have to edit this to get it to work);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;loc = pickpoint()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 20:07:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954633#M29443</guid>
      <dc:creator>sragan</dc:creator>
      <dc:date>2020-12-21T20:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create New Family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954933#M29444</link>
      <description>&lt;P&gt;Maybe use "PromptForFamilyInstancePlacement"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see:&amp;nbsp;&lt;A title="PromptForFamilyInstancePlacement Method" href="https://www.revitapidocs.com/2020/b05a17df-3f63-9172-8e49-d2e1e6b8e9e2.htm" target="_blank" rel="noopener"&gt;PromptForFamilyInstancePlacement Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Michel&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 22:45:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/9954933#M29444</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-12-21T22:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create New Family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/10052300#M29445</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use Selection.PickPoint() and save the value on the &lt;STRONG&gt;loc&lt;/STRONG&gt; variable before running your method to place the family.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;loc = Selection.PickPoint()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another alternative is to use the method&amp;nbsp;&lt;STRONG&gt;PostRequestForElementTypePlacement&amp;nbsp;&lt;/STRONG&gt;to select the FamilyType you want to insert. It makes sense if you going to insert just one family every time you run the tool.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;uiDoc.PostRequestForElementTypePlacement(YourElementType)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will select the type on the UI, then you pick the point and the element will be inserted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first alternative, you pick the point, and then the element is created using API logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second alternative, you just select the Type automatically (as you usually do from the UI), and then when you pick a point, the element is placed, without an API method. I think it should solve the problem you have with the nested family.&amp;nbsp; If you use this alternative, you will not be able to place multiple families at once as you could do using point and the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you could check if some of the nested families need to be Activated.&lt;/P&gt;&lt;P&gt;If that is the case, use the Activate() method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 22:12:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/10052300#M29445</guid>
      <dc:creator>franciscopossetto</dc:creator>
      <dc:date>2021-02-02T22:12:51Z</dc:date>
    </item>
    <item>
      <title>Betreff: Create New Family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/13335960#M29446</link>
      <description>&lt;P&gt;Is it possible to use, for the location, coordinates Like AutoCAD?&lt;/P&gt;&lt;P&gt;For example (1200, 300.0).&lt;/P&gt;&lt;P&gt;1200 mm in X coordinate,&amp;nbsp;300 mm in Y coordinate and&amp;nbsp;0 mm in Z coordinate.&lt;/P&gt;&lt;P&gt;Is a conversion or something like that necessary?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 09:43:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-new-family-instance/m-p/13335960#M29446</guid>
      <dc:creator>cesar_mayorine362SG</dc:creator>
      <dc:date>2025-02-24T09:43:14Z</dc:date>
    </item>
  </channel>
</rss>

