一个 Solid 是由 Face 和 Edge 来定义它边界的实体。
Solid 类接口:
namespace Autodesk.Revit.DB
{
public class Solid : GeometryObject
{
//体积
public double Volume {
get; }
//表面积
public double SurfaceArea {
get; }
//面
public FaceArray Faces {
get; }
//边
public EdgeArray Edges {
get; }
//其它
//...
}
}
创建 Solid 至少有两种方式:
1. BrepBuilder 自己手动创建
Revit API 开发 (9): BRepBuilder 创建原生几何图形
2. GeometryCreationUtilities
大致可以分成:Blend,Extrusion,Swept,Loft,Revolved,Swept + Blend。
namespace Autodesk.Revit.DB
{
public static class GeometryCreationUtilities
{
public static Solid CreateBlendGeometry(CurveLoop firstLoop, CurveLoop secondLoop, ICollection<VertexPair> vertexPairs, SolidOptions solidOptions);
public static Solid CreateBlendGeometry(CurveLoop firstLoop, CurveLoop secondLoop, ICollection<VertexPair> vertexPairs);
public static Solid CreateExtrusionGeometry(IList<CurveLoop> profileLoops, XYZ extrusionDir, double extrusionDist, SolidOptions solidOptions);
public static Solid CreateExtrusionGeometry(IList<CurveLoop> profileLoops, XYZ extrusionDir, double extrusionDist);
public static Solid CreateFixedReferenceSweptGeometry(CurveLoop sweepPath, int pathAttachmentCrvIdx, double pathAttachmentParam, IList<CurveLoop> profileLoops, XYZ fixedReferenceDirection, SolidOptions solidOptions);
public static Solid CreateFixedReferenceSweptGeometry(CurveLoop sweepPath, int pathAttachmentCrvIdx, double pathAttachmentParam, IList<CurveLoop> profileLoops, XYZ fixedReferenceDirection);
public static Solid CreateLoftGeometry(IList<CurveLoop> profileLoops, SolidOptions solidOptions);
public static Solid CreateRevolvedGeometry(Frame coordinateFrame, IList<CurveLoop> profileLoops, double startAngle, double endAngle, SolidOptions solidOptions);
public static Solid CreateRevolvedGeometry(Frame coordinateFrame, IList<CurveLoop> profileLoops, double startAngle, double endAngle);
public static Solid CreateSweptBlendGeometry(Curve pathCurve, IList<double> pathParams, IList<CurveLoop> profileLoops, IList<ICollection<VertexPair>> vertexPairs, SolidOptions solidOptions);
public static Solid CreateSweptBlendGeometry(Curve pathCurve, IList<double> pathParams, IList<CurveLoop> profileLoops, IList<ICollection<VertexPair>> vertexPairs);
public static Solid CreateSweptGeometry(CurveLoop sweepPath, int pathAttachmentCrvIdx, double pathAttachmentParam, IList<CurveLoop> profileLoops, SolidOptions solidOptions);
public static Solid CreateSweptGeometry(CurveLoop sweepPath, int pathAttachmentCrvIdx, double pathAttachmentParam, IList<CurveLoop> profileLoops);
}
}
Blend: 混合,没有验证,猜测效果和这个类似 Dynamo For Revit: 简单体量的创建
Extrusion:实际就是把 profile 往一个方向拉伸,类似:
Swept:扫略,类似:
Loft,类似:
Revolved, 类似:
Swept + Blend,扫略的时候同时进行截面的变换。
上述图片来自 Dynamo For Revit。
在 API 里面没有找到直接的体与点的关系,可以通过体与线的关系间接获得,即通过点做一条线,看这条线是否与体相交。如果相交,看看这个点是否在相交的那一部分。
Solid
接口:public SolidCurveIntersection IntersectWithCurve(Curve curve, SolidCurveIntersectionOptions options);
没有直接的体与面的关系通用解决方案,不过有体与平面的接口,在 BooleanOperationsUtils
:
public static Solid CutWithHalfSpace(Solid solid, Plane plane);
public static void CutWithHalfSpaceModifyingOriginalSolid(Solid solid, Plane plane);
如果想要其它类型的体与面的关系,只能通过体与体的关系来间接获得。
布尔操作:Union,Difference,Intersect.
public enum BooleanOperationsType
{
Union = 0,
Difference = 1,
Intersect = 2
}
BooleanOperationsUtils
:
public static Solid ExecuteBooleanOperation(Solid solid0, Solid solid1, BooleanOperationsType booleanType);
public static void ExecuteBooleanOperationModifyingOriginalSolid(Solid solid0, Solid solid1, BooleanOperationsType booleanType);