Revit API 几何专题 5: 体 - Solid

体 - Solid

一个 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

创建 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 往一个方向拉伸,类似:
Revit API 几何专题 5: 体 - Solid_第1张图片
Swept:扫略,类似:
Revit API 几何专题 5: 体 - Solid_第2张图片
Loft,类似:
Revit API 几何专题 5: 体 - Solid_第3张图片
Revolved, 类似:
Revit API 几何专题 5: 体 - Solid_第4张图片
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);

参考接口

  1. BooleanOperationsUtils
  2. SolidUtils
  3. SolidSolidCutUtils
  4. GeometryCreationUtilities

你可能感兴趣的:(Revit,API,Geometry,专题,Revit,API)