Detail component from curve

Here the extraction of code from the python node.
It gives me an error

Which Revit version your using?

2016 R2 and Dynamo 1.0.0

Put your mouse pointer over the yellow note symbol and take a screenshot of the message that appear:

What happens if you add a Flatten node to your curves before you plug it in to python?

The error is changed but is not correct. I’m retreiving the plane according to the selected view.
I think there’s something wrong in the node but I can’t understand what.

> import clr
> clr.AddReference('RevitAPI')
> from Autodesk.Revit.DB 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

> doc = DocumentManager.Instance.CurrentDBDocument
> curves = UnwrapElement(IN[0])
> famtype = UnwrapElement(IN[1])
> view = UnwrapElement(IN[2])
> version = IN[3]
> elementlist = list()
> counter = 0

> TransactionManager.Instance.EnsureInTransaction(doc)
> for curve in curves:
> 	if version > 2015:
> 		if not(famtype.IsActive): famtype.Activate()
> 	newobj = doc.Create.NewFamilyInstance(curve.ToRevitType(),famtype,view)
> 	elementlist.append(newobj.ToDSType(False))
> TransactionManager.Instance.TransactionTaskDone()
> OUT = elementlist

Boom! It works now :grin:

Try this DYF file Detail Family By Curve.dyf (7.2 KB)

Nothing changed, same error…what is the difference?

As you can see my screenshot. I have tested in Revit 2017. It is working from my side.

1 Like

Ok solved in another way :slight_smile:
Thank you for all your effort…I’ll finalize the definition and then I can share with the forum

1 Like

Hey @Cesare_Caoduro3 thanks for sharing! I am trying to get something similar to work and it seems we are getting the same results. I am getting unexpected “null” values when using DetailComponent.ByCurve, this process would be ideal as it allows for the specification of the view the detail component will be placed. When I try to use the FamilyInstance.ByCurve it doesnt give me an option to specify the view and seems to arbitrarily pick a view with that Level Associated. image

A single family type (rather than a list) seems to do the trick.

Levels should also resolve this.

@JacobSmall please explain. Levels, from my understanding, would not give me the option to specify which view the detail component would be placed in.

Hi @dana.defilippi

I think @JacobSmall means @List Levels read this . Have you tried right clicking node and change lacing to longest?

1 Like

Thanks!! I dont know why i didnt think of that… it worked.

You’re welcome!

1 Like

As @Kulkul clarified, list levels and lacing will resolve this as well:

You can also use List.OfRepeatedItems or List.Cycleto build matching lists as needed.