Placing a Line Based Detail Item Instance

We already talked in depth about placing a detail family instance and the difficulties in selecting the right overload of the NewFamilyInstance method for that, a topic also discussed in the developer guide section 12.3.5 Creating FamilyInstance Objects, and its tables 34 and 35. As we already stated in that post, the exploration continues...

Here is an interesting update to the issue by Frode Tørresdal of Norconsult Informasjonssystemer, which also highlights a new overload added in the Revit 2012 API:

Question: I am trying to place a detail item over an existing 3D element (in this case it's a Rebar Bar family). I try to place the detail item with the NewFamilyInstance method and then move it to the min value of the existing 3D element's boundary box. The code looks something like this:

  XYZ p = XYZ.Zero;
  FamilySymbol symbol = null;
 
  FamilyInstance newDetailItem = doc.Create
    .NewFamilyInstance( p, symbol, commandData.View );
 
  BoundingBoxXYZ boundingBox = rebar3D
    .get_BoundingBox( commandData.View );
 
  newDetailItem.Location.Move( boundingBox.Min );

The detail item is line based.

What I'm trying to do is to make a function where the user selects a 3D reinforcement item. Then my function hides this item and places a simplified 2D symbol over the extent of the 3D item in the active plan view.

I can do this manually in Revit by placing my detail item along one side of the 3D element to set the width, and then adjusting a parameter in the detail item to set the height.

Using the API, I can adjust the parameter to get the right height, but I cannot place the detail item correctly. I might be missing a coordinate transformation because my item is placed in the same place no matter what 3D element I select in the view.

To summarize what I'm trying to do:

I hope this makes sense. I'm rather new to the Revit API and might be missing something obvious.

Solution: While creating a test case I think I solved the problem.

I found a new overload of the NewFamilyInstance method in Revit 2012 that takes Line, FamilySymbol and View input arguments. This seems to work for my line based detail item. Using the override with a point as the first parameter only works with point based detail items.

Many thanks to Frode for this discovery!

That leads me to look in more detail at the new overloads of the NewFamilyInstance method.

New overloads of the NewFamilyInstance method in the Revit 2012 API

The nine overloads of the NewFamilyInstance method provided by the Revit 2011 API take the following lists of input arguments:

The Revit 2012 API provides twelve overloads:

The three last ones are new, respectively intended for:

As the issues arising in this area indicate, the topic of adding a new family instance can be complex and sometimes requires a bit of research to find the right approach in each case. I hope this helps a little.