What is RebarBarType?

I want to create rebar free form. This is error

Can you help me for this ?

Thank.

You are passing the bar type element, but it is expecting a GUID. What is the API call you are trying to use?

CreateFreeForm Method (Document, RebarBarType, Element, IList(IList(Curve)), RebarFreeFormValidationResult) I want to use this.

But i don’t understand data type for input such as RebarBartype .

Can you help me ?

There is some good info here: CreateFreeForm Method (Document, Guid, RebarBarType, Element)

Effectively the method you are using needs different input values than what you are providing.

1 Like

Thank you so much for solve.

I try to solve , I got a new code.

I don’t know what is StrongBox?

What do you think about this ?

Here is some code which has an example of building a strongbox reference to a vector - IfcExportUtils - #7 by Einar_Raknes

You’ll need to construct something other than the XYZ, but it should serve as a means to understand how to build it.

Thank but I’m so sorry for many question and my English.

But i try to do this because this is new work and new challenge.

below this new code and new error

You’re feeding a list of curves instead of a curve loop object. Check the API docs for instructions on how to create a curve loop.

This is Api doc.

https://www.revitapidocs.com/2018/e412ef5a-baa0-64e3-858e-65f79316850a.htm

This Curve i used ( Single line)

Are you passing a list or an iList into the curve property? Note that Dynamo passes lists which are converted to Python lists, not the .Net implementation iLists.

FWIW the existing nodes for this may be an easier path forward.

Correct or not ? ( I mean “ILIST” )

Untitled4

Hello
the method
CreateFreeForm Method (Document, RebarBarType, Element, IList(IList(Curve)), RebarFreeFormValidationResult) require a list of list where each sub list forms a curveloop

IList<IList> like below Picture ?

I am not a structure specialist, but I suppose (to be confirmed) that this method is used like this

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import specify namespace
from Autodesk.Revit.DB.Structure import *

#import net library
from System.Collections.Generic import IList, List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
host = UnwrapElement(IN[0])
arrayCurv = IN[1]
if arrayCurv:
	arrayIlist = List[CurveLoop]()
	for sublst in arrayCurv:
		arrayIlist.Add(CurveLoop.Create([x.ToRevitType() for x in sublst]))
	
	rebarBarType = FilteredElementCollector(doc).OfClass(RebarBarType).FirstElement()
	#Do some action in a Transaction
	TransactionManager.Instance.EnsureInTransaction(doc)
	validationResult = clr.Reference[RebarFreeFormValidationResult]()
	rebar = Rebar.CreateFreeForm(doc, rebarBarType, host, arrayIlist, validationResult) 
	
	TransactionManager.Instance.TransactionTaskDone()
	
	OUT = rebar

maybe these methods will be more suitable for your case
https://www.revitapidocs.com/2020.1/b020c9d5-6026-b9fa-7e23-f6a7ec2cede3.htm
https://www.revitapidocs.com/2020.1/10ddc28e-a410-5f29-6fe9-d4b73f917c54.htm
there are some examples on the forum

3 Likes

Thank you very much @c.poupin.

I try to solve and i get new error.

I don’t understand “IList[IList[Curve]]”. Can you expose it exam list : [0,1,2,3,4,5]

try to work with CurveLoop it’s easier
https://www.revitapidocs.com/2020.1/38767c5e-0196-3359-69db-19d728873b19.htm
to create curveloop from list of curve use this
https://www.revitapidocs.com/2020.1/5422ec92-2b9e-6b33-80ac-417b8336ae18.htm

1 Like

I want to create vertical rebar (In Column) and main rebar (In Beam) .

Can i use CurveLoop ?

I suggest you use the methods I indicated in my previous post

here a simple example
simpleRebar

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import specify namespace
from Autodesk.Revit.DB.Structure import *

#import net library
from System.Collections.Generic import IList, List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
host = UnwrapElement(IN[0])
DSCurv = IN[1]
nameRebarType = IN[2]

lstcurve = List[Curve]([DSCurv.ToRevitType()])
normal = XYZ(1,0,0).CrossProduct(lstcurve[0].Direction.Normalize())
rebarBarType = FilteredElementCollector(doc).OfClass(RebarBarType).ToElements().Find(lambda x : Element.Name.GetValue(x) == nameRebarType)
if rebarBarType is not None:
	#Do some action in a Transaction
	TransactionManager.Instance.EnsureInTransaction(doc)
	verticalBar = Rebar.CreateFromCurves(doc, RebarStyle.Standard, rebarBarType, None, None, host, normal, lstcurve, RebarHookOrientation.Left, RebarHookOrientation.Right, True, False)
	TransactionManager.Instance.TransactionTaskDone()
	OUT = verticalBar

alternatively you can use this node

image

*Note : *
please start a new topic if the questions are no longer related to this topic

1 Like

I’m so sorry for my many questions. I know try to help me.

Thank you very very much.

I think vector and plan is fix of geometry curve.

I have new error.

What do you think about my code for create IList[IList[Curve]] ?

you must correctly cast your list of sublist (type of List)

1 Like