浏览代码

Fix tailored shirt block

undefined
Wouter Horlings 2 个月前
父节点
当前提交
78e0b16e7c
共有 2 个文件被更改,包括 53 次插入4 次删除
  1. +18
    -0
      pkg/template/point.go
  2. +35
    -4
      templates/tailored_shirt_block.yaml

+ 18
- 0
pkg/template/point.go 查看文件

@@ -129,6 +129,24 @@ func (t Template) functions(req request) map[string]govaluate.ExpressionFunction


return line[0].Length() return line[0].Length()
}, },
"DiagonalTo": func(args ...interface{}) (interface{}, error) {
if len(args) != 3 {
return nil, fmt.Errorf("function DiagonalTo() requires 3 arguments: %w", ErrInvalidArguments)
}

points, err := t.getOrCreatePointsFromArgs(req, args[0:2]...)
if err != nil {
return nil, err
}

f, ok := args[2].(float64)
if !ok {
return nil, fmt.Errorf("function DiagonalTo() requires the third argument to be a float: %w",
ErrInvalidArguments)
}

return math.Sqrt(math.Pow(f, 2) - math.Pow(points[0].Position().Distance(points[1].Position()), 2)), nil
},
}) })


return functions return functions


+ 35
- 4
templates/tailored_shirt_block.yaml 查看文件

@@ -103,6 +103,14 @@ panels:
through: [22,29,29b,36] through: [22,29,29b,36]
style: style:
thickness: 1 thickness: 1
00:
relativeTo: 17
01:
relativeTo: 25
02:
relativeTo: 01
position:
y: (LineLength("11")-70)/3


points: points:
0: 0:
@@ -151,10 +159,13 @@ panels:
relativeTo: 0 relativeTo: 0
position: position:
x: half_back + 40 x: half_back + 40
14:
13:
relativeTo: 12 relativeTo: 12
position: position:
x: 15 x: 15
14:
relativeTo: 13
position:
y: 20 y: 20
15: 15:
relativeTo: 10 relativeTo: 10
@@ -332,6 +343,25 @@ panels:
position: position:
y: 7 y: 7
x: -30 x: -30
00:
relativeTo: 17
01:
relativeTo: 25
02:
relativeTo: 01
position:
y: (LineLength("11")-70)/3
03:
between:
from: 01
to: 02
offset: 0.5
06:
relativeTo: 02
position:
x: ((DistanceBetween("24","26")^2 - (DistanceBetween("02","26")^2))^0.5)


sleeve: sleeve:
points: points:
0: {} 0: {}
@@ -342,7 +372,7 @@ panels:
2: 2:
relativeTo: 0 relativeTo: 0
position: position:
y: -(sleeve_length_shirt+60-cuff_depth)
y: -(sleeve_length_shirt+60-cuff_depth - DistanceBetween("body.0","body.13"))
3: 3:
between: between:
from: 2 from: 2
@@ -351,7 +381,7 @@ panels:
4: 4:
relativeTo: 1 relativeTo: 1
position: position:
x: -(502.6/2 -5)
x: -DiagonalTo("0","1",502.6/2 -5)
5: 5:
relativeTo: 4 relativeTo: 4
position: position:
@@ -359,7 +389,7 @@ panels:
6: 6:
relativeTo: 1 relativeTo: 1
position: position:
x: (502.6/2 -5)
x: DiagonalTo("0","1",502.6/2 -5)
7: 7:
relativeTo: 6 relativeTo: 6
position: position:
@@ -466,6 +496,7 @@ panels:
relativeTo: 16 relativeTo: 16
position: position:
y: 150 y: 150

lines: lines:
scye: scye:
through: [4,8,9,10,0,11,12,13,6] through: [4,8,9,10,0,11,12,13,6]


正在加载...
取消
保存