# How to create colums in Dynamo using the python code block node?

**URL:** <https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079>\
**Category:** Revit\
**Tags:** revit, python, dynamo\
**Created:** [June 13, 2021, 6:09pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079 "2021-06-13T18:09:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mochilas.wayuu14](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mochilas.wayuu14](https://forum.dynamobim.com/u/mochilas.wayuu14)\
**Post date:** [June 13, 2021, 6:09pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/1 "2021-06-13T18:09:15Z")

</div>

Hi

I have 2 point grids for each level and I would like to create structural columns between each vertical matching point . How could I do this using the python code block?

 ![sss](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cdfc5cdf113d529e9585d1ec1197c1d71a849f50.jpeg)

Any suggestion would be highly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [June 13, 2021, 6:30pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/2 "2021-06-13T18:30:35Z")

</div>

Hi @mochilas.wayuu14,

I don’t think you need python for this, you can use OOTB nodes to place column families and then edit parameters like height, thickness, etc. afterwards (all in 1 script).

Could you maybe elaborate why you think a python script is needed?

Kind regards,  
Daan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [June 13, 2021, 7:03pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/3 "2021-06-13T19:03:29Z")

</div>

I agree - no need for Python here.

[https://dictionary.dynamobim.com/#/Revit/Elements/StructuralFraming/Create/ColumnByCurve](https://dictionary.dynamobim.com/#/Revit/Elements/StructuralFraming/Create/ColumnByCurve)

---

<div class="post-metadata">

**Author:** ![mochilas.wayuu14](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mochilas.wayuu14](https://forum.dynamobim.com/u/mochilas.wayuu14)\
**Post date:** [June 13, 2021, 7:04pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/4 "2021-06-13T19:04:46Z")

</div>

Hi , thanks for your answer, I would like to use the python node since I have a script that updates the amount of points every time the number of subdivisions for every portico changes. Every point has its matching pair on the level immediately above it. So I would find it more convenient if I could automatically call the revit api method to create columns inside my script.

---

<div class="post-metadata">

**Author:** ![mochilas.wayuu14](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mochilas.wayuu14](https://forum.dynamobim.com/u/mochilas.wayuu14)\
**Post date:** [June 13, 2021, 7:33pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/5 "2021-06-13T19:33:45Z")

</div>

Thanks for your suggestion , but I would still find it very useful to use either the preinstalled OOTB nodes or the Revit Api Methods to create the colums inside my python script. Would you happen to know if its possible to use the OOTB nodes inside the python node?

Thanks

---

<div class="post-metadata">

**Author:** ![mochilas.wayuu14](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@mochilas.wayuu14](https://forum.dynamobim.com/u/mochilas.wayuu14)\
**Post date:** [June 13, 2021, 8:52pm UTC](https://forum.dynamobim.com/t/how-to-create-colums-in-dynamo-using-the-python-code-block-node/65079/6 "2021-06-13T20:52:16Z")

</div>

```auto
import clr 
import sys  
import System 

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 

famType=UnwrapElement(IN[0])# get the column family type to use

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

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

for column in columns: #get all column types and select a specific type for the new column
	column_name=column.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString()
	if column_name=="Pilar HEB":#select the appropriate column name
		column_type=column
		
TransactionManager.Instance.EnsureInTransaction(doc)

if famType.IsActive == False:#sometimes you need to first activate the familysymbol for the column type that you are using
	famType.Activate()
	doc.Regenerate()

column_=doc.Create.NewFamilyInstance(XYZ(20,0,levels[0].Elevation),columns[0],levels[0],Structure.StructuralType.Column)
top_offset=column_.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM)
top_offset.Set(0)#set to no offset from level immediately above

TransactionManager.Instance.TransactionTaskDone()

OUT=column_

```
