# Creating column on a point using NewFamilyInstance

**URL:** <https://forum.dynamobim.com/t/creating-column-on-a-point-using-newfamilyinstance/82225>\
**Category:** Revit\
**Tags:** python, dynamo, cpython3\
**Created:** [October 19, 2022, 11:19am UTC](https://forum.dynamobim.com/t/creating-column-on-a-point-using-newfamilyinstance/82225 "2022-10-19T11:19:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Aradhya\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@Aradhya\_Singh](https://forum.dynamobim.com/u/Aradhya_Singh)\
**Post date:** [October 19, 2022, 5:22pm UTC](https://forum.dynamobim.com/t/creating-column-on-a-point-using-newfamilyinstance/82225/4 "2022-10-19T17:22:46Z")

</div>

Thank you for your suggestions, @Daan.

I’m using a Python node to do this because I want to create a framed structure based on the number of levels input by the user, as the end product. So, I thought to create the columns in a script and do a **for** loop for repeating it in the other levels. I’m not sure if there’s an OOTB node that can act in place of a **for** loop.

Now, if supplying a reference level means passing a level in the arguments for the Create.NewFamilyInstance command, then yes I’m doing it.

```auto
import clr 
import sys  
import System 

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes") 

import Revit 
clr.ImportExtensions(Revit.Elements) 
clr.ImportExtensions(Revit.GeometryConversion) 

clr.AddReference("RevitServices") 
import RevitServices 
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI") 

import Autodesk 
from Autodesk.Revit.DB import * 
from Autodesk.Revit.DB.Structure import *
  

doc = DocumentManager.Instance.CurrentDBDocument 

#Inputs to node

#famtype=UnwrapElement(IN[0])
points =UnwrapElement(IN[1])

columns=FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsElementType().ToElements()#get all column types

levels=FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()

TransactionManager.Instance.EnsureInTransaction(doc)

for column in columns: 
	column_name=column.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString()
	#if column_name=="UC-Universal Columns-Column":
	column_type=column
	
if column_type.IsActive == False:
    column_type.Activate()
    doc.Regenerate()

point = points[0]
    
mycolumn=doc.Create.NewFamilyInstance(XYZ(point.X, point.Y, point.Z), column_type, levels[0], Structure.StructuralType.Column)

TransactionManager.Instance.TransactionTaskDone()

OUT = mycolumn

```

I should’ve pasted the code in the question also to make it easier to see I guess.

I also added a Transaction.End node after creating the levels but I still get the error.  
Another [thread](https://forum.dynamobim.com/t/transaction-start-and-end/1971/9) suggested connecting the output of the Transaction.End to a dummy input in the python node, so that it’s computed only after the levels are created. That didn’t work too.

 ![Screenshot (9)](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/b/dbb8cc21aa2e3bb12df5030ad9bbadb06379f66f.png)

Please let me know if I can try something else too.

---

_[View the full topic](https://forum.dynamobim.com/t/creating-column-on-a-point-using-newfamilyinstance/82225)._
