纺织组织生成器 - 支持9种常见组织结构的Python库
Project description
Weave Generator - 纺织组织生成器
一个功能强大的 Python 库,用于生成各种纺织组织结构。
支持的组织类型
- 斜纹 (Twill) - 基础斜纹组织
- 曲线斜纹 (Curved Twill) - 经向/纬向曲线斜纹
- 角度斜纹 (Angle Twill) - 带角度的斜纹组织
- 山形斜纹 (Waved Twill) - 山形斜纹组织
- 锯齿斜纹 (Zigzag Twill) - 锯齿斜纹组织
- 菱形斜纹 (Diamond Twill) - 菱形斜纹组织
- 缎纹 (Satin) - 经面/纬面缎纹
- 重平 (Rib Weave) - 经重平/纬重平
- 方平 (Basket Weave) - 方平组织
安装
pip install weave-generator
快速开始
基本使用
from weave_generator import generate_weave
# 生成一个 3/5 的右斜纹
matrix = generate_weave(
'斜纹',
numerator=[3],
denominator=[5],
direction='右'
)
# 打印组织矩阵
for row in matrix:
print(' '.join(map(str, row)))
命令行使用
# 生成斜纹组织
weave-gen --type 斜纹 --numerator 3 --denominator 5 --direction 右
API 文档
generate_weave(weave_type, **params)
生成指定的纺织组织。
参数:
weave_type(str): 组织类型**params: 组织特定参数
返回:
- List[List[int]]: 组织矩阵 (1=经浮点, 0=纬浮点)
支持的参数
| 组织类型 | 必需参数 | 可选参数 |
|---|---|---|
| 斜纹 | numerator, denominator, direction | - |
| 曲线斜纹 | numerator, denominator, direction, fly | - |
| 角度斜纹 | numerator, denominator, direction, fly | - |
| 山形斜纹 | numerator, denominator, k_value, direction | - |
| 锯齿斜纹 | numerator, denominator, k_value, s_value, direction | - |
| 菱形斜纹 | numerator, denominator, kj, kw | - |
| 缎纹 | size, fly, direction | - |
| 重平 | numerator, denominator, direction | - |
| 方平 | numerator, denominator | - |
使用示例
1. 斜纹
matrix = generate_weave('斜纹', numerator=[3], denominator=[5], direction='右')
2. 曲线斜纹
matrix = generate_weave(
'曲线斜纹',
numerator=[1, 2],
denominator=[3, 4],
direction='经',
fly=[1, 1, 0, -1, -1]
)
3. 菱形斜纹
matrix = generate_weave(
'菱形斜纹',
numerator=[3],
denominator=[5],
kj=4,
kw=4
)
4. 缎纹
matrix = generate_weave('缎纹', size=8, fly=3, direction='经面')
参数说明
- numerator: 组织点上升数(整数或列表)
- denominator: 组织点下降数(整数或列表)
- direction: 方向("左"/"右", "经"/"纬", "经面"/"纬面")
- fly: 飞数或移位数(整数或列表)
- k_value: 山形参数
- s_value: 锯齿参数
- kj/kw: 经/纬循环数
- size: 缎纹大小
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
weave_generator-1.0.1.tar.gz
(18.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file weave_generator-1.0.1.tar.gz.
File metadata
- Download URL: weave_generator-1.0.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2e324c03498c3590dc8e158ec1632d57f2223757cd0d56da5d8046e4a346ef1
|
|
| MD5 |
d168789a31c7eac2d5aea45b452d1740
|
|
| BLAKE2b-256 |
dd0b5a548a59440ea75c2d53740a1909bfab1859ffadcebdd0bb735ef3de31ee
|
File details
Details for the file weave_generator-1.0.1-py3-none-any.whl.
File metadata
- Download URL: weave_generator-1.0.1-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbe9c1d49a3ea4000d24f68ec5b7d1dfd04908a5f79d01b1fd7bcadd23a35f5e
|
|
| MD5 |
7356362419285a1a85074a7c8ce94d3d
|
|
| BLAKE2b-256 |
2b748fb1428f52b53776a63aa62706fb7ff8c1c228207050085b8af08b2d28a1
|