Skip to main content

纺织组织生成器 - 支持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


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.2.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weave_generator-1.0.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file weave_generator-1.0.2.tar.gz.

File metadata

  • Download URL: weave_generator-1.0.2.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

Hashes for weave_generator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e287fa92f5913dfae88e6b398bb55f51a75be20785949c3da730ee5d15e38838
MD5 101534e0c73e8d7fe41936b726141554
BLAKE2b-256 877732af3bba17c46e15086588c6229a1ff5a9ed49619bfc2b8a8b757c94ce00

See more details on using hashes here.

File details

Details for the file weave_generator-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for weave_generator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b26f19142e42996a917202b2f087f4df8dce72de98578f04aa88e92e15f7f2d8
MD5 fde99fcedd477b40ed0861f120ef20a5
BLAKE2b-256 b737d1637c96c148fe47fe987378aa506d30f7b3cf9335a69c41219c71d674e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page