简体   繁体   English

如何使用位置线与外部区域边界重合来创建墙?

[英]How to create wall with Location line coinciding with external area boundary?

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. 这是Revit的屏幕截图

Thank you in advance! 先感谢您!

There is a BuiltinParameter for the wall reference key. 墙参考键有一个BuiltinParameter。

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. Autodesk.Revit.DB.WALL_KEY_REF_PARAM可用于设置在墙属性中靠墙出现的参考值。

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). (如果有人对此有所了解,欢迎有人纠正此问题)。

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)); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM