0

I'm creating a wall over a area boundary line, but can't find a way how to place it with Location line "Finish Face: Exterior".

I'm getting geometric data from area boundary:

LocationCurve elLocation = (LocationCurve)area_boundary.Location;
XYZ pt1 = elLocation.Curve.get_EndPoint(0);
XYZ pt2 = elLocation.Curve.get_EndPoint(1);

and then create a line based on it to build a wall:

Line line = doc.Application.Create.NewLineBound(pt1, pt2);
Wall wall = Wall.Create(doc, line, level.Id, false);

This code gives me a wall with Location line and area boundary placed in the centre of it. Is there any way to create wall with Location line coinciding with external area boundary?

Here is an screen-shoot from Revit.

Thank you in advance!

cansadadeserfeliz
  • 3,033
  • 5
  • 34
  • 50

2 Answers2

0

There is a BuiltinParameter for the wall reference key.

Autodesk.Revit.DB.WALL_KEY_REF_PARAM that can be used to set the reference value that would appear against the wall in the wall properties.

However, it is my understanding that programatically the line for the wall will always be the wall centreline when creating the wall. (Somebody is welcome to correct this if they know any better).

sweetfa
  • 5,457
  • 2
  • 48
  • 62
  • Thank you for your answer! The problem is that when I set this parameter after creating a wall it gives me the following result (https://www.dropbox.com/s/0u46vs43vvfwgay/revit_wall_location_line.png) where wall stays at the same location and only location line of the wall moves, so the area boundary is not at the exterior face of the wall, but remains in the centre of it. – cansadadeserfeliz May 08 '13 at 17:21
  • 1
    I can verify that the wall is located on centerline no matter the value of WALL_KEY_REF_PARAM. The only solution is to translate the location line in the desired direction by half the wall type's width prior to creating the wall and then set WALL_KEY_REF_PARAM appropriately if desired. Yes its a bit of work, but thats why they pay you the big bucks! – GentlemanCoder May 10 '13 at 15:28
  • Hahaha unfortunately, they don't pay me big bucks :) I work for food ;) – cansadadeserfeliz May 11 '13 at 00:18
  • Thank you, looks like the only solution is to do it this way – cansadadeserfeliz May 11 '13 at 00:19
0

I solved it this way:

  1. Get external face of a wall:

    IList<Reference> sideFaces = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior);
    Face face = uiDoc.Document.GetElement(sideFaces[0]).GetGeometryObjectFromReference(sideFaces[0]) as Face;
    
  2. Get the normal vector of that face and revert it:

    PlanarFace pf = face as PlanarFace;
    XYZ normal_reverted = -1.0 * pf.Normal;
    
  3. Move the wall:

    wall.Location.Move(normal_reverted * (wall.WallType.Width / 2.0));
    
cansadadeserfeliz
  • 3,033
  • 5
  • 34
  • 50