Freeform Rebar Creation from Curves

revit
dynamoforrebar
dynamo

#1

Hi all!
Inspired by Rebar.ByCurve node from DynamoRebar package, I was wondering if is it possible to create freeform rebars in a similar way.

I created a Python Script whose inputs are:

  • Rebar Bar Type;
  • Host Element;
  • IList of curves (supposed to become freeform rebars).

The script is the following:

As a result I get this:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. _
Traceback (most recent call last):
_ File “”, line 28, in

TypeError: CreateFreeForm() takes at least 2147483647 arguments (5 given)

Thanks in advance, best regards!


#2

2147483647 arguments? Wow. What version of revit are you using? Also could you post your code?


#3

Hi Tom,
as I was uploading a screenshot your reply appeared, thanks for that. I hope the code will clarify something.

I’m on rvt2018.2+dynamo1.3.2.


#4

Here’s the code!

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
from System.Collections.Generic import IList

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import RebarBarType, RebarFreeFormValidationResult

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

doc = DocumentManager.Instance.CurrentDBDocument

X = clr.StrongBoxStructure.RebarFreeFormValidationResult

#INPUT
barType = UnwrapElement(IN[0])
host = UnwrapElement(IN[1])
curves = UnwrapElement(IN[2])

#Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

#todo
rebar_list = []
rebar = Structure.Rebar.CreateFreeForm.Overloads[Document, RebarBarType, Element, IList[IList[Curve]], RebarFreeFormValidationResult](doc, barType, host, curves, X)
rebar_list.append(rebar.ToDSType(False))

#End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = rebar_list


#5

Hey there! Any ideas, anyone? :slight_smile:
Thanks


#6

Sorry I had a quick go but didn’t manage to figure it out, I’ll keep working on it


#7

Thanks a lot!


#8

Hello there! Has anyone any ideas?
Thanks