异形件-服装切割
场景描述
服装切割是指将服装裁片放置在布料上,使得使用的布料最少,以最大化布料利用率。通常情况下,布料的宽度是固定的,优化的目标是最小化使用长度。
准备工作
- 已注册华为云账号,且账号不能处于欠费或者冻结状态,获取项目ID
- 获取Token
- 获取EndPoint
导入数据
使用第三方软件集成服务商(比如ET、BOKE)客户端软件生成服装切割数据文件,上传到华为云服装切割服务。需要至少包含以下字段:排版时间、布料宽度、裁片形状、裁片可旋转角度以及其他排版约束等。
{
"input_json": {
"id": "fu",
"order": "fu",
"name": "fu",
"time": 1,
"gap_mode": 0,
"overlap": 0,
"fabric": {
"width": 38,
"grid_x": 0,
"grid_y": 0
},
"polygon": [
{
"index": 0,
"profile": [
0.0,
0.0,
10.0,
0.0,
10.0,
10.0,
0.0,
10.0
]
},
{
"index": 1,
"profile": [
0.0,
0.0,
10.0,
0.0,
10.0,
10.0,
0.0,
10.0
]
},
{
"index": 2,
"profile": [
0.0,
0.0,
14.0,
0.0,
14.0,
9.0,
0.0,
9.0
]
},
{
"index": 3,
"profile": [
0.0,
0.0,
14.0,
0.0,
7.0,
7.0
]
},
{
"index": 4,
"profile": [
0.0,
9.0,
0.0,
0.0,
14.0,
9.0
]
},
{
"index": 5,
"profile": [
0.0,
0.0,
14.0,
0.0,
14.0,
14.0,
0.0,
14.0
]
},
{
"index": 6,
"profile": [
0.0,
0.0,
10.0,
4.0,
10.0,
9.0,
0.0,
9.0
]
},
{
"index": 7,
"profile": [
0.0,
0.0,
5.0,
0.0,
5.0,
9.0,
0.0,
9.0
]
},
{
"index": 8,
"profile": [
0.0,
0.0,
14.0,
0.0,
14.0,
14.0
]
},
{
"index": 9,
"profile": [
0.0,
0.0,
10.0,
0.0,
10.0,
10.0,
0.0,
14.0
]
},
{
"index": 10,
"profile": [
0.0,
8.0,
4.0,
0.0,
8.0,
8.0
]
},
{
"index": 11,
"profile": [
0.0,
0.0,
14.0,
0.0,
7.0,
12.0
]
}
],
"piece": [
{
"id": 0,
"polygon_index": 0,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 1,
"polygon_index": 1,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 2,
"polygon_index": 2,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 3,
"polygon_index": 3,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 4,
"polygon_index": 4,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 5,
"polygon_index": 5,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 6,
"polygon_index": 6,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 7,
"polygon_index": 7,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 8,
"polygon_index": 8,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 9,
"polygon_index": 9,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 10,
"polygon_index": 10,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
},
{
"id": 11,
"polygon_index": 11,
"gap_index": -1,
"hole_index": -1,
"tilted": 0,
"gap": 0,
"pose_group": -1,
"column_group": -1,
"rot": 90,
"flip_x": 0,
"flip_y": 0,
"remark": "no Y constraints",
"y": []
}
],
"hole": [],
"constraints": {}
}
}
查询结果
待切割排版任务完成后,查询排版结果。华为云服装排版服务将返回json格式排版结果文件,可以通过第三方软件服务商展示排版结果,生成适配切割机的切割文件。
{
"task_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"status": "finished",
"start_time": "",
"end_time": "",
"output_json": {
"gap_mode": 0,
"id": "fu",
"length": 14.0,
"name": "fu",
"order": "fu",
"pieces": [
{
"angle": 180.0,
"box": [
{
"x": 1.110223024560533e-16,
"y": 188.54000844217342
},
{
"x": 10.0,
"y": 202.54000844217342
}
],
"flip_x": 0,
"flip_y": 0,
"id": 9
},
{
"angle": 90.0,
"box": [
{
"x": 1.110223024560533e-16,
"y": 180.54018862422214
},
{
"x": 9.0,
"y": 190.54018862422214
}
],
"flip_x": 0,
"flip_y": 0,
"id": 6
},
{
"angle": 90.0,
"box": [
{
"x": 1.1102230246251565e-16,
"y": 251.65141900241923
},
{
"x": 9.0,
"y": 265.65141900241923
}
],
"flip_x": 0,
"flip_y": 0,
"id": 2
},
{
"angle": 0.0,
"box": [
{
"x": 1.110223024560533e-16,
"y": 216.54000844217342
},
{
"x": 5.0,
"y": 225.54000844217342
}
],
"flip_x": 0,
"flip_y": 0,
"id": 7
},
{
"angle": 180.0,
"box": [
{
"x": 1.1101552619893762e-16,
"y": 24.0
},
{
"x": 8.0,
"y": 32.0
}
],
"flip_x": 0,
"flip_y": 0,
"id": 10
},
{
"angle": 270.0,
"box": [
{
"x": 5.551115123125783e-17,
"y": 0.0
},
{
"x": 10.0,
"y": 10.0
}
],
"flip_x": 0,
"flip_y": 0,
"id": 1
},
{
"angle": 90.0,
"box": [
{
"x": 0.0,
"y": 10.0
},
{
"x": 12.0,
"y": 24.0
}
],
"flip_x": 0,
"flip_y": 0,
"id": 11
},
{
"angle": 90.0,
"box": [
{
"x": 1.1102230246251565e-16,
"y": 237.65161696798242
},
{
"x": 14.0,
"y": 251.65161696798242
}
],
"flip_x": 0,
"flip_y": 0,
"id": 5
},
{
"angle": 180.0,
"box": [
{
"x": 1.1102230246251565e-16,
"y": 49.51013170928303
},
{
"x": 10.0,
"y": 59.51013170928303
}
],
"flip_x": 0,
"flip_y": 0,
"id": 0
},
{
"angle": 270.0,
"box": [
{
"x": 1.110223024560533e-16,
"y": 202.54000844217342
},
{
"x": 7.0,
"y": 216.54000844217342
}
],
"flip_x": 0,
"flip_y": 0,
"id": 3
},
{
"angle": 270.0,
"box": [
{
"x": 1.1102230163533504e-16,
"y": 25.020263418566074
},
{
"x": 9.0,
"y": 39.020263418566074
}
],
"flip_x": 0,
"flip_y": 0,
"id": 4
},
{
"angle": 0.0,
"box": [
{
"x": 1.110214554295684e-16,
"y": 166.54018862422214
},
{
"x": 14.0,
"y": 180.54018862422214
}
],
"flip_x": 0,
"flip_y": 0,
"id": 8
}
],
"ratio": 1.265e-321,
"time": 1
}
}