Autodesk.Revit.DB.RevolvedSurface是Revit API中的一种曲面对象,它是通过绕一个轴旋转曲线或边缘线生成的。
public RevolvedSurface(Curve profileCurve, XYZ axisOfRevolution, double angle)
profileCurve
:轮廓曲线。必需。axisOfRevolution
:旋转轴。必需。angle
:旋转角度。单位:弧度。必需。ProfileCurve
:轮廓曲线。AxisOfRevolution
:旋转轴。Angle
:旋转角度。Area
:曲面面积。BoundingBox
:境界框。Approximate(double tolerance)
:获取一个近似曲面。ComputeDerivatives(UV point, bool uPartial, bool vPartial)
:计算一个点的偏导数。IsPointOnFace(XYZ point, double tolerance)
:判断一个点是否在曲面上。Tessellate()
:以三角形网格表示曲面。// 创建一个曲面
Curve curve = ...;
XYZ axis = ...;
double angle = ...;
RevolvedSurface surface = new RevolvedSurface(curve, axis, angle);
// 访问曲面属性
Curve profileCurve = surface.ProfileCurve;
XYZ axisOfRevolution = surface.AxisOfRevolution;
double surfaceArea = surface.Area;
// 计算点的偏导数
UV pointOnSurface = ...;
bool uPartial = true;
bool vPartial = true;
XYZ du = XYZ.Zero;
XYZ dv = XYZ.Zero;
surface.ComputeDerivatives(pointOnSurface, uPartial, vPartial, ref du, ref dv);
// 判断点是否在曲面上
XYZ point = ...;
bool isOnSurface = surface.IsPointOnFace(point, 0.001);
// 以三角形网格表示曲面
TessellatedShapeBuilderTarget meshTarget = new TessellatedShapeBuilderTarget();
TessellatedShapeBuilder builder = new TessellatedShapeBuilder();
builder.BeginBuild(meshTarget);
surface.Tessellate(builder);
builder.EndBuild();
GeometryElement meshElement = meshTarget.GetTargetElement();