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:

  • Place a line based detail element at the min value of the bounding box of a
    selected 3D element in plan view.
  • Extend the line based element so that the length is equal to one of the sides of
    the bounding box of the selected 3D element in a plan view.

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:

  • XYZ, FamilySymbol, StructuralType
  • XYZ, FamilySymbol, View
  • XYZ, FamilySymbol, Level, StructuralType
  • XYZ, FamilySymbol, Element, StructuralType
  • XYZ, FamilySymbol, Element, Level, StructuralType
  • XYZ, FamilySymbol, XYZ, Element, StructuralType
  • Curve, FamilySymbol, Level, StructuralType
  • Face, XYZ, XYZ, FamilySymbol
  • Face, Line, FamilySymbol

The Revit 2012 API provides twelve overloads:

  • XYZ, FamilySymbol, StructuralType
  • XYZ, FamilySymbol, View
  • XYZ, FamilySymbol, Level, StructuralType
  • XYZ, FamilySymbol, Element, StructuralType
  • XYZ, FamilySymbol, Element, Level, StructuralType
  • XYZ, FamilySymbol, XYZ, Element, StructuralType
  • Curve, FamilySymbol, Level, StructuralType
  • Face, XYZ, XYZ, FamilySymbol
  • Face, Line, FamilySymbol
  • Line, FamilySymbol, View
  • Reference, XYZ, XYZ, FamilySymbol
  • Reference, Line, FamilySymbol

The three last ones are new, respectively intended for:

  • Adding a line based detail family instance into the Revit document, using a line
    and a view where the instance should be placed.
  • Inserting a new instance of a family onto a face referenced by the input
    Reference instance, using a location, reference direction, and a type/symbol.
  • Inserting a new instance of a family onto a face referenced by the input
    Reference instance, using a line on that face for its position, and a type/symbol.

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.


Comments

5 responses to “Placing a Line Based Detail Item Instance”

  1. Hi Jeremy,
    I’ve been trying to place a line-based Generic model on the floor plan’s active workplane. I thought “Reference, Line, FamilySymbol” would work but the Reference has to be to a face. I’m not sure what then the difference is between “Reference, Line, FamilySymbol” and “Face, Line, FamilySymbol”. I tried using the level as reference but didn’t seem to work. Any thoughts? Thanks.

  2. Dear Mike,
    I can only repeat the same suggestion as always: explore how it works manually, look at the results and resulting relationships in RevitLookup.
    When working with families, it always helps to define such a family yourself so you understand it properly ‘from the other end’ as well.
    You can test which NewFamilyInstance overload works by testing all possibilities like this:
    http://thebuildingcoder.typepad.com/blog/2010/11/place-site-component.html
    Here are other explorations in the area:
    http://thebuildingcoder.typepad.com/blog/2011/01/newfamilyinstance-overloads.html
    Oh, and definitely do not forget to look at the family placement type property via Family.FamilyPlacementType.
    Cheers, Jeremy.

  3. Thanks Jeremy, I missed your overloads post and it helped. Using “Curve, FamilySymbol, Level, StructuralType” worked for my line-based Generic Model component.

  4. Dear Mike,
    Thank you for your appreciation and confirmation.
    I am very glad it helped.
    Cheers, Jeremy.

  5. Frank Halliday Avatar
    Frank Halliday

    Jeremy,
    When you use the term line-based details, are you talking about the two point click detail component family? I am using a standard detail component in a view and the component is being rotated cyclicly every 4 elevation views within the same elevation mark. is this anything to do with my detail family template not being line-based?
    cheers,
    fabs

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading