Files
make-cad/docs/api/make_rectangle_rwire.md
T
倪旌哲 e907fa88a4 Add Vertex and Wire classes documentation; implement auto documentation generation script
- Created `vertex.md` and `wire.md` to document the Vertex and Wire classes in the SimpleCAD API, detailing their attributes, methods, and usage examples.
- Introduced `auto_docs_gen.py` script to automate the extraction of API information from `operations.py` and generate markdown documentation.
- Updated `operations.py` to correct a comment regarding the target normal vector in the `helical_sweep_rsolid` function.
2025-07-06 23:24:31 +08:00

56 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# make_rectangle_rwire
## API定义
```python
def make_rectangle_rwire(width: float, height: float, center: Tuple[float, float, float] = (0, 0, 0), normal: Tuple[float, float, float] = (0, 0, 1)) -> Wire
```
## API作用
创建矩形线对象,用于构建矩形轮廓。矩形以指定中心点为中心,在指定平面内
创建。可以用于构建复杂的多边形轮廓或作为拉伸的基础轮廓。
## API参数说明
### width
- **类型**: `float`
- **说明**: 矩形的宽度,必须为正数
### height
- **类型**: `float`
- **说明**: 矩形的高度,必须为正数
### center
- **类型**: `Tuple[float, float, float], optional`
- **说明**: 矩形中心坐标 (x, y, z), 默认为 (0, 0, 0)
### normal
- **类型**: `Tuple[float, float, float], optional`
- **说明**: 矩形所在平面的法向量 (x, y, z), 默认为 (0, 0, 1) 表示XY平面
## 返回值
Wire: 创建的线对象,表示一个封闭的矩形轮廓
## 异常
- **ValueError**: 当宽度或高度小于等于0或其他参数无效时抛出异常
## API使用例子
```python
>>> # 创建标准矩形轮廓
>>> rect = make_rectangle_rwire(4.0, 3.0)
>>> # 创建偏移的矩形
>>> offset_rect = make_rectangle_rwire(2.0, 2.0, (1, 1, 0))
>>> # 创建垂直平面上的矩形
>>> vertical_rect = make_rectangle_rwire(3.0, 2.0, (0, 0, 0), (1, 0, 0))
```