Files
make-cad/docs/api/make_polyline_rwire.md
T
倪旌哲 b80a323445 feat: Add automation scripts for updating API exports and syncing documentation
- Introduced `make_export.py` to automate the update of `__init__.py` with new API functions from `operations.py` and `evolve.py`.
- Implemented function extraction, categorization, and generation of import statements and aliases.
- Added `ragflow_sync.py` for synchronizing SimpleCADAPI documentation with RAGFlow database, including chunking markdown files and managing dataset.
- Updated package version to 1.0.5 in `uv.lock`.
2025-07-24 02:11:44 +08:00

1.3 KiB

make_polyline_rwire

API定义

def make_polyline_rwire(points: List[Tuple[float, float, float]], closed: bool = False) -> Wire

来源文件: operations.py

API作用

创建由多个直线段连接的多段线,用于构建折线、多边形轮廓等。 相邻点之间用直线连接,可以创建开放或闭合的多段线。

API参数说明

points

  • 类型: List[Tuple[float, float, float]]
  • 说明: 顶点坐标列表 [(x, y, z), ...], 至少需要2个点,相邻点之间用直线连接

closed

  • 类型: bool, optional
  • 说明: 是否创建闭合的多段线,默认为False。 如果为True,会自动连接最后一个点和第一个点

返回值说明

Wire: 创建的线对象,由多个直线段组成的多段线

异常

  • ValueError: 当顶点少于2个时抛出异常

API使用例子

# 创建L形多段线
points = [(0, 0, 0), (3, 0, 0), (3, 2, 0)]
l_shape = make_polyline_rwire(points)
# 创建三角形轮廓
triangle_points = [(0, 0, 0), (2, 0, 0), (1, 2, 0)]
triangle = make_polyline_rwire(triangle_points, closed=True)
# 创建复杂的多边形
polygon_points = [(0, 0, 0), (2, 0, 0), (3, 1, 0), (2, 2, 0), (0, 2, 0)]
polygon = make_polyline_rwire(polygon_points, closed=True)