Family Instance Z Coordinate Lost

Here is another contribution by Rudolf Honke of

acadGraph CADstudio GmbH
.
He says:

I am working with the placement of family instances on a TopographySurface to represent objects such as arrays of trees, traffic lights, RPC figures etc.
I made use of your discussions on placing

furniture
and

detail
family
instances and created a Revit add-in providing family instance placement functionality:

Place family instance on terrain
Place family instance on terrain

During the development, we faced some problems similar to those treated in the two blog posts.

There are these steps required to insert a family instance:

  1. Place an instance of the family symbol ‘fs’ using a given XYZ instance ‘intersectionPoint’:
    
      FamilyInstance famInst
        = doc.Create.NewFamilyInstance(
          interSectionPoint, fs,
          StructuralType.UnknownFraming );
    
  2. Rotate the family instance.
  3. Set the offset parameter.

When debugging, I found out that the instances were placed correctly in step 1 and their location points had the desired values.

But if the instances were rotated or moved in step 2, the Location.Z switched back to zero.

This behaviour only appeared in the English version; in the German one the Revit API acts differently.
In fact, in the German version the FamilyInstance.Location.Z value remains correct even after a rotation.

As a result, we have to check Revit’s language and adapt the procedure:

  • If it’s German, the offset parameter is set correctly, just when placing the family instance.
  • If it’s English, we collect the correct placing data (element, axis and rotation, offset) in a list.
    First, all family instances are placed; after that, we correct their properties using the list like this:

  for( int i = 0; i < items.Count; ++i )
  {
    doc.Rotate( items[i], axes[i], rotations[i] );
 
    doc.Move( items[i], app.Create.NewXYZ(
      0, 0, elevations[i] ) );
 
    items[i]
      .get_Parameter( BuiltInParameter
        .INSTANCE_FREE_HOST_OFFSET_PARAM )
      .Set( elevations[i] );
  }

That’s our workaround.

In addition, there is another issue:

If the family instance has no visible offset parameter, there is no parameter connected to BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM.

In that case it will be impossible to set the offset in both languages.

In the ensuing discussion of this issue, the suggestion came up that this behaviour may well be by design, and a different overload method with a level argument should be used to place the family instance.
Using some overloads, the elevation is fixed and cannot be set manually.
The choice of overload to use

can be quite tricky
,
as we have seen.

Rudolf responds that just setting the level and fixing the elevation is not the desired result.
Since the language dependent workaround does what I need, there is no time pressure.
I will do some more testing as soon as I find time.
Thank you for your efforts!

Many thanks to Rudolf for this interesting observation, detailed description and rather strange workaround!


Comments

7 responses to “Family Instance Z Coordinate Lost”

  1. I have the same problem with the family “Structural Connections\Steel\Column Base Plate-4 Hole-Cross.rfa”
    I have tried:
    NewFamilyInstance(FootingFace, PointXYZ, New XYZ(1, 0, 0), Symbol)
    .NewFamilyInstance(PointXYZ, Symbol, [Structure].StructuralType.UnknownFraming) and other overloads and always the NewFamilyInstance is placed on the Zero Elevation of the project. I can not find a way to place the instance on a non zero elevation. What am I doing wrong?
    Cosmas

  2. Dear Cosmas,
    First of all, you should consult with a product expert to be absolutely sure that you are using the family symbol for its intended purpose in the intended way.
    In Revit 2013, the new Family.PlacementType property provides information about the placement type for instances of the given family, and roughly maps to the proper NewFamilyInstance overload to use for that family.
    Some instances always insert on a specific level, and then support an offset parameter to move them up or down.
    How is this specific symbol manipulated in the user interface?
    Cheers, Jeremy.

  3. Hello Jeremy and thank you for your prompt answer. Yes I am a structural engineer and the base plates are supposed to be placed only on the top face of a footing. When I insert the base plate manually in the user interface, it correctly slides on the faces of a footing at any elevation. But when I insert it using the programming interface it only slides horizontally on an invisible face that is at Elevation=0 even though I have tried to host it on a footing that is at a non zero elevation. When I try to change its Elevation parameter programmatically I get a read only error. Offset parameter does not do anything either. When I try to move manually a programmatically inserted base plate, it does not move out of that 0 Elevation up or down (it only moves horizontally). I have noticed in the family editor of that base plate (in the user interface) that the base plate is drawn together with its footing even though that footing is not inserted.

  4. Hello Jeremy
    Tha BasePlate family symbol is WorkPlaneBased. How do you change the workplane elevation to place the BasePlate at the desired elevation using NewFamilyInstance?

  5. Hello Jeremy,
    I am still not able to figure out why this particular FamilySymbol (Structural Connections\Steel\Column Base Plate-4 Hole-Cross.rfa) is always placed at the zero Elevation and its Elevation can not change. I have tried other Structural Connections and I can easily insert them at the desired Elevation using any of the Create.NewFamilyInstance methods. Its Family.PlacementType is WorkPlane based and even when I change the WorkPlane Elevation to a non zero value, this instance is still placed at Elevation zero!

  6. Dear Cosmas,
    Sorry to hear that this is still an issue for you.
    I asked the development team about this, and they reply:
    Usually it happens because of a content problem. Most likely geometry inside a family is not constrained to base level.
    Cheers, Jeremy.

  7. Thank you Jeremy.
    I will keep trying and let you know if I resolve it.

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading