前言
墙是 Revit 中非常基本的构件,它的连接非常智能。通过 API 如何查询和修改墙连接呢?另外,还有其它构件也能够智能的连接吗?
内容
墙
类 WallUtils
可以查询和设置墙是否可以间接:
namespace Autodesk.Revit.DB
{
public static class WallUtils
{
public static void AllowWallJoinAtEnd(Wall wall, int end);
public static void DisallowWallJoinAtEnd(Wall wall, int end);
public static bool IsWallJoinAllowedAtEnd(Wall wall, int end);
}
}
有了 WallUtils
,还是不能知道当前这堵墙连接了哪堵墙。那要如何做呢?
墙的 Location
是 LocationCurve
,通过它可以得到相交的其它的墙,get_ElementsAtJoin
,另外还可以设置相交的类型:
namespace Autodesk.Revit.DB
{
public class LocationCurve : Location
{
public ElementArray get_ElementsAtJoin(int end);
public JoinType get_JoinType(int end);
public void set_ElementsAtJoin(int end, ElementArray elements);
public void set_JoinType(int end, JoinType newType);
}
}
参考:
https://thebuildingcoder.typepad.com/blog/2011/08/wall-joins-and-geometry.html
结构框架
如果族的类型是 StructuralFraming,它也有可能是有和墙类似的 join 的。
namespace Autodesk.Revit.DB.Structure
{
public static class StructuralFramingUtils
{
public static void AllowJoinAtEnd(FamilyInstance familyInstance, int end);
public static bool CanFlipEnds(FamilyInstance familyInstance);
public static bool CanSetEndReference(FamilyInstance familyInstance, int end);
public static void DisallowJoinAtEnd(FamilyInstance familyInstance, int end);
public static void FlipEnds(FamilyInstance familyInstance);
public static Reference GetEndReference(FamilyInstance familyInstance, int end);
public static bool IsEndReferenceValid(FamilyInstance familyInstance, int end, Reference pick);
public static bool IsJoinAllowedAtEnd(FamilyInstance familyInstance, int end);
public static void RemoveEndReference(FamilyInstance familyInstance, int end);
public static void SetEndReference(FamilyInstance familyInstance, int end, Reference pick);
}
}