# StructuralFraming.BeamByCurve in python

**URL:** <https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133>\
**Category:** Developers\
**Tags:** python\
**Created:** [August 23, 2018, 5:17am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133 "2018-08-23T05:17:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![1056291511](https://avatars.discourse-cdn.com/v4/letter/1/6de8d8/32.png) [@1056291511](https://forum.dynamobim.com/u/1056291511)\
**Post date:** [August 23, 2018, 5:17am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/1 "2018-08-23T05:17:36Z")

</div>

Hi，I want to use “StructuralFraming.BeamByCurve” in python. Now I can use curve and FamilyType in python,but meet a mistake when using Level

import clr  
clr.AddReference("RevitAPI")  
clr.AddReference("RevitAPIUI")  
import Autodesk  
from Autodesk.Revit.DB import \*  
from Autodesk.Revit.UI import \*  
clr.AddReference("ProtoGeometry")  
from Autodesk.DesignScript.Geometry import \*  
clr.AddReference("RevitNodes")  
from Revit.Elements import \*  
import Revit  
clr.ImportExtensions(Revit.GeometryConversion)  
clr.ImportExtensions(Revit.Elements)  
clr.AddReference("RevitServices")  
import RevitServices  
from RevitServices.Persistence import DocumentManager  
doc = DocumentManager.Instance.CurrentDBDocument  
lv=IN[0]  
a=Point.ByCoordinates(5,5,0)  
b=Point.ByCoordinates(25,0,0)  
line=Line.ByStartPointEndPoint(a,b)  
Family=FamilyType.ByName("25mT梁")  
level=FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST\_Levels).WhereElementIsNotElementType().ToElements()[0]  
beam=StructuralFraming.BeamByCurve(line,level,Family)  
OUT=beam

 ![mistake](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/6/16d3cdaf89bfbdbc0cd207d9daf71bbaa89841b1.png)

Line 41 means “beam=StructuralFraming.BeamByCurve(line,level,Family)”  
Any Idea why?

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [August 23, 2018, 5:22am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/2 "2018-08-23T05:22:06Z")

</div>

I would be very careful about using known commands as variable names, things like `Family =` and `level =` as it can conflict with the commands using the same name. Start by changing the variable names into something more unique.

Another problem seems to be conflicting types between the Revit element Level and the Dynamo element Level. You are collecting the Revit element Level through the doc but the Dynamo command  
`StructuralFraming.BeamByCurve()` wants the Dynamo version. I think the command for that is .ToDSType()

---

<div class="post-metadata">

**Author:** ![1056291511](https://avatars.discourse-cdn.com/v4/letter/1/6de8d8/32.png) [@1056291511](https://forum.dynamobim.com/u/1056291511)\
**Post date:** [August 23, 2018, 5:36am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/4 "2018-08-23T05:36:07Z")

</div>

> [@1056291511](#):
>
> Thx,bro! I change the variable name,and use .ToDSType() ,I can bulid the beam.

Thx,bro! I change the variable name,and use .ToDSType() ,I can bulid the beam.

---

<div class="post-metadata">

**Author:** ![1056291511](https://avatars.discourse-cdn.com/v4/letter/1/6de8d8/32.png) [@1056291511](https://forum.dynamobim.com/u/1056291511)\
**Post date:** [August 23, 2018, 5:37am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/5 "2018-08-23T05:37:27Z")

</div>

Thx,bro! I change the variable names and use the .ToDSType(),the question is solved!

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [August 23, 2018, 6:07am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/6 "2018-08-23T06:07:53Z")

</div>

No problem! Don’t forget to mark the post solved by clicking the Solution button on the post that helped.

---

<div class="post-metadata">

**Author:** ![kuurt](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kuurt](https://forum.dynamobim.com/u/kuurt)\
**Post date:** [July 30, 2020, 5:50am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/7 "2020-07-30T05:50:16Z")

</div>

Hi, mate. Your work looks very impressive. May I ask do you know how to use StructuralFraming.ColumnByCurve in Python? Should I make some change on the “level”?

---

<div class="post-metadata">

**Author:** ![kuurt](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kuurt](https://forum.dynamobim.com/u/kuurt)\
**Post date:** [July 30, 2020, 6:11am UTC](https://forum.dynamobim.com/t/structuralframing-beambycurve-in-python/25133/8 "2020-07-30T06:11:57Z")

</div>

Oops, I’ve found the reason why my column doesn’t work. I used the same name for the family type of column and beam. 😂 😂 Sorry for the bothering.
