Create detail line using NewDetailCurveArray()

Hi all!
I am currently trying to convert lines that I retrieved from revit and create detail lines using NewDetailCurveArray() method. According to the API, it needs to receive 2 arguments (View, CurveArray) but I am getting an error noting that it needs to receive 3 arguments.
Am I missing something?

PS Feel free to comment on my code for feedback: is it ok? Is there a better way to write it?

My Code

NewDetailCurveArray() Method

A thought… in line 43 try changing IFB. to doc.

If that doesn’t work it may help others help you if you provide the code by posting the dyn or using the preforms tree text feature of the board (the </> button) to provide the code.

Thanks for the quick response.
Regarding the code - the picture I added pretty much covers all the code of the program (unless you meant something else?)

So I substituted IFB. to doc.Create. and alternated the Method to single Curve (instead of CurveArray) and now I am receiving the following error: "Exception: Curve must be in plane Parameter namer: Curve.
Does that mean anything to you?

Can you also explain why the previous method that using IFB. wasn’t correct as the method is an object of * Autodesk.Revit.Creation.ItemFactoryBase

By sharing a picture we can’t execute it, which means that if a more direct effort is required someone would have to retype all of your code… that isn’t a trivial task so you’re asking for ‘double’ the effort in helping you. Not that you won’t get help either way, but helping us help you ensures you get answers faster.

Yes - it means that the curve you’re providing isn’t on the plane of the view. Detail curves need to be planar to where you’re drawing them. Pull them onto the view’s plane and it should work.

I believe that DetailCurveArray can be found both under the item factory base and the RevitDBDoc class, but either method needs to know what document to work on (which is why including the doc. resolved that issue).

I see. Sounds right. I’ll post the code next time for the convenience.

Do you know of a method I can use to move it to the plane? Plus, and even better if you may know, I would actually like to create the detail lines and manage to “drop” them of a place of my choosing, like when placing a column or a family etc. Do you know by any chance if that is possible?

Curve.PullOntoPlane should work - Dynamo Dictionary.

I am not sure what you mean by ‘drop them in a place of my choosing’, can you describe more of what you are after with this workflow? Making detail curves doesn’t seem to be the extent of it.

When you place a column, you hold the element and drop it (click) at the place of choosing. So with the detailed lines, I would like to import it into the project and have it follow the cursor until it is dropped at a place of choosing as supposed to having it being place by a preselected point/coordinate.
Did I manage to describe properly?

Where are you getting the array of curves from than? Thought from the previous work you were trying to ‘trace’ other linear content, but I may not be understanding this. What you’re describing is building a detail family and creating instances rather than detail curves in a project.

I am describing an action that I would like to do and since I am new to this and discovering slowly the API, I am trying to implement small codes to learn and create slowly…
This current code is to create a detailed line from a rebar element and than place it to a view. You can see it on the example in the picture below. What you can see is a detail curve the I sketched manually on an open space near the model element. I would like to automate the detail curve creation (like in the code) and then place it as mentioned.
Ideally I would create the curve and in a drag and drop action I would place it at a point of choice. Since I don’t know how to do that, I am currently trying to create it, then be able to create it at a chosen point.
If there is a drag and drop like method - that would really help.

Let me know if it makes sense or if it something that isn’t possible.

I think I understand what you are after, and from a non-automation standpoint it makes sense. But with automation in play why not create it in the right spot at step 1?

Since the point to place isn’t permanent and each instance needs to be placed manually

In that case I would recommend utilizing a family instead of detail lines - this is the better way to accomplish the task in terms of performance, quality assurance, and data management. Model one detail family and you can manually place it 100’s of times over in every project without issue - no need for the application.

If it’s supposed to be located based on an offset value from the outside faces of the slab, that can be automated in place by say, selecting the slab, finding where the faces intersect the view’s plane, building a polycurve of each, and offsetting the resulting polycurve inwards.

1 Like

Sounds good!
So should I have the code create the family or should I create the family and than use the code to manipulate it? Most of the time the rebar shapes are the same but once in a while there may be different ones.

If there are variations in dimension, I would make the family manually and ensure you have associated instance or type parameters. If each project will have different shapes, code it.