Why cant I place detail component by curve?

Thank so much :smiley:

Is your rebar slab family a detail component meaning a 2D annotation, or a model element meaning a 3D object?

1 Like

This family is a detail component by line

I want to show off my floor rebar on structural plan as in the picture. When I want to Edit Sketch I must go to section view. I don’t think it affects the outcome

I have 2 question:

  • How can i place detail component by curve?
  • Can I change instance for each detail component?

Provide an rvt including the family and dyn files and we can help as the detail component by curve pretty much always works.

1 Like

File revit 2020: https://drive.google.com/file/d/19wHBDJCa_HA9X0K8VJ656OfIJwTFYHtX/view?usp=sharing
File Dynamo: Place Detail Component Floor Rebar.dyn (25.6 KB)
File Revit have 2 view: Source and Result

Do you have a 2019 version of this family by any chance?

File Revit 2019: https://drive.google.com/file/d/1RY_4upJayc3l-tb7gIoI7ujd78xQm5gu/view?usp=sharing
Thank you so much :smiley:

Well, I have it figured out. Your curve isn’t in the same plane as your view.

Feel free to follow along as I’m going to ‘teach a man to fish’ here so that you and others will be able to solve this stuff more readily in the future. Not all ‘fixes’ are this easy, but the concepts here are good ‘how to’ steps for resolving python based nodes in the future.

Start by opening the DetailComponent.ByCurve node in the Clockwork package (double click on it to do so), select the useful bits (anything that isn’t an input or output node), switch back to the active dyn document and paste them in. You can then remove some of the ‘no longer necessary’ stuff like turn into list, and the like.

Once that was done you can pretty easily see that the issue starts (and continues) with the Python code which @Andreas_Dieckmann was using. Making a few easy edits to it as per this post by @Konrad_K_Sobon will allow us to understand what is going wrong.

Side note, we owe both of these guys some thanks for the accessible content and documentation which they continue to provide the larger community. :smiley:

This was my resulting code, including some markups used to differentiate what I changed.
# Original Code by Andreas Dieckmann
# https://github.com/andydandy74/ClockworkForDynamo
# edited by Jacob Small, following the instructions in this post:
# https://forum.dynamobim.com/t/convert-circuit-path-from-api-to-line/40408/5?u=jacobsmall

import clr
from Autodesk.Revit.DB import *

import Revit

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

for curve in curves:
if version > 2015:
if not(famtype.IsActive): famtype.Activate()
# added line to set error report to none if there is no failure.
errorReport = None
newobj = doc.Create.NewFamilyInstance(curve.ToRevitType(),famtype,view)
# revised except lines to import the traceback and set the error report acordingly.
import traceback
errorReport = traceback.format_exc()

# updated the output to include a list of the elements and the traceback
OUT = [elementlist,errorReport]

That edit allows access to the resulting element list, as well as the error report for anything which fails in the output results. Reviewing that error report, the reason behind the failureis pretty straight forward:

Traceback (most recent call last): File "<string>", line 30, in <module> Exception: The line is not in the plane of view. Parameter name: line

With that bit of knowledge, it’s pretty clear what you have to do: move the curve onto the same plane as the view. From here on out this is basic Dynamo, just a matter of finding the right nodes.

Fortunately we have a handy node also in the Clockwork package that we can leverage to find out what plane the linework needs to be on: the View.Plane node. There is also and an out of the box node called Curve.PullOntoPlane which will adjust the curve geometry and location as needed. Your actual use case may require a few tweaks to stuff like list lacing and levels.

From there things should just work with the old node, no edits required and you don’t even have to make a new custom node, or maintain the python in the .dyn.

I’ll make an issue on the Clockwork package’s GitHub repo tomorrow, which will included the code above so that if he thinks that it would be worthwhile then Andreas can update the package to include that error handling.


I’m a newbie, i think it very helpful for all.
Thanks :heart_eyes:

1 Like

Glad I could help. :slight_smile:

I have a little question: How can I find a node (View.Plan), I seach ViewPlan and PlanView, but it dont show. I went into ClockWork to get it out, but it took more time. Do you have any trick?

I’m try, it’s very well, but I have a question more, Why I active view “Source”, node “Active view” return result is “Result”

I has a lot of work to do

  • Place Detail Component middle rebar set
  • Change Instance parameter

Not sure - where are you seeing this node and what are you expecting it to do?

I can’t comform, but this is likely because you ran the graph before changing the view. Nodes only update their results if their inputs change. This keeps you from having to recalculate every node on the canvas as you build your graph. Try disconnecting and reconnecting the inputs to get it to update.

I think I need re-open file after each run to update Active view.

Disconnect the input from the current document input. Run the graph. Reconnect the document input. Run the graph.

Or, add a boolean switch in a code block to flip between the document and the document. If you need help with this option start a new topic as these are pretty far off the original request.

1 Like

I am developing this file, but I have 2 unsolved questions.

  1. I want to divide 2 type rebar shape, with M_01, I will use family 90 degree, with M_01 I will use family 180 degree, but When I try with this file, It cant convert list rebar shape to list family type (as node List.create )
  2. Why I choose 2 rebar and I create list with 2 value Family type, I cant finish file dynamo (Warning: Internal error, please report: Dereferencing a non-pointer.)

I’m following ur instruction but i got this error in python script :
“Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 32, in
ImportError: No module named traceback”

any idea how to fix it?


Use this just under import clr

import sys pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib' sys.path.append(pyt_path)

This should fix it.

thank .
now i got this warning:
IronPythonEvaluator.EvaluateIronPythonScript operation failed.
unexpected token ‘pyt_path’

Hi @rinag, without showing your code it’s hard for me to determine your issue.

EDIT: Apologies, after looking at my first reply again, I seems like I have formatted the code wrong, looked ok on mobile. :sweat_smile: It should have read…

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'

This is why it failed. However, please use this snippet of code for reference for traceback example…

Description: Traceback example catching Divide by Zero Exception.
Author: Dan Woodcock
Website: https://danimosite.wordpress.com
Licence: N/A

##### Imports #####

import clr

# Add IronPython Path to sys.path. This will expose additional IronPython Modules...
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'

# Import traceback module...
import traceback

##### Inputs #####
a = IN[0] # Input any Number...
b = IN[1] # Make this Zero to see traceback error...

##### Main Script #####

# Try divide by zero. We know this will fail and trigger the traceback...
	OUT = a/b
	# Return Traceback....
	OUT = traceback.format_exc()

Hope this helps.