a9d1de7747
- Introduced beartype version 0.18.5 with its source and wheel details. - Added ragflow-sdk version 0.19.1, including dependencies on beartype and requests. - Updated simplecadapi version from 0.1.2 to 1.0.0. - Included ragflow-sdk in dev dependencies for testing purposes.
1.7 KiB
1.7 KiB
revolve_rsolid
API定义
def revolve_rsolid(profile: Union[Wire, Face], axis: Tuple[float, float, float] = (0, 0, 1), angle: float = 2 * np.pi, origin: Tuple[float, float, float] = (0, 0, 0)) -> Solid
API作用
围绕指定轴旋转二维轮廓创建三维实体。常用于创建轴对称的几何体, 如圆柱体、圆锥体、球体等。如果输入是线,必须是封闭的线。
API参数说明
profile
- 类型:
Union[Wire, Face] - 说明: 要旋转的轮廓,可以是封闭的线或面
axis
- 类型:
Tuple[float, float, float], optional - 说明: 旋转轴向量 (x, y, z), 定义旋转轴的方向,默认为 (0, 0, 1)
angle
- 类型:
float, optional - 说明: 旋转角度,单位为度数(0-360), 默认为360度(完整旋转),正值表示逆时针旋转
origin
- 类型:
Tuple[float, float, float], optional - 说明: 旋转轴通过的点坐标 (x, y, z), 默认为 (0, 0, 0)
返回值
Solid: 旋转后的实体对象
异常
- ValueError: 当轮廓不是封闭的线、角度小于等于0或其他参数无效时抛出异常
API使用例子
# 旋转矩形创建圆柱体
rect = make_rectangle_rface(1.0, 3.0, (2, 0, 0)) # 远离旋转轴
cylinder = revolve_rsolid(rect, (0, 0, 1), 360)
# 创建圆锥体
triangle_points = [(1, 0, 0), (2, 0, 0), (1.5, 2, 0)]
triangle = make_polyline_rwire(triangle_points, closed=True)
cone = revolve_rsolid(triangle, (0, 0, 1), 360)
# 创建部分旋转体(90度扇形)
rect = make_rectangle_rface(0.5, 2.0, (1.5, 0, 0))
partial_solid = revolve_rsolid(rect, (0, 0, 1), 90)