天筹求解器服务 OPTVERSE-二维异形件钣金切割
二维异形件钣金切割
场景描述
钣金切割是指将钣金件放置在钢板上,使得使用的钢板最少,以最大化钢板利用率。
准备工作
- 已注册华为云账号,且账号不能处于欠费或者冻结状态,获取项目ID
- 获取Token
- 获取EndPoint
步骤一:导入钣金切割数据
使用第三方软件集成服务商(比如FastCAM)客户端软件生成钣金切割数据文件,上传到华为云钣金切割服务。需要至少包含以下字段:排版时间、钢板尺寸、钢板个数、钢板修边距、零件距零件间距、是否共线切割,是否容许空洞排版以及其他排版约束等。
{ "task_name": "TESTTASK", "project_name": "TESTPRO", "user_id": "user_123456789", "time": 20, "item_spacing": 10, "plate_spacing": 20, "forbid_internal_nesting": 0, "common_cut_nest": 0, "leadin_before_nesting":2, "plates": [ { "plate_id": 0, "plate_name": "", "plate_length": 4000, "plate_width": 4000, "plate_count": 200 } ], "cams": [ { "item_id": 0, "item_name": "d:\rectangle.cam", "count": 2, "priority": 5, "rotation_type": 2, "flip": 0, "pair_collinear": 0, "collinear_entity_id": 0, "entities": [ { "entity_id": 1, "entity_type": 1, "start_x": 0, "start_y": 0, "end_x": 3200, "end_y": 0, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":4, "last_entity":0 }, { "entity_id": 2, "entity_type": 1, "start_x": 3200, "start_y": 0, "end_x": 3200, "end_y": 1600, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":0, "last_entity":3 }, { "entity_id": 3, "entity_type": -2, "start_x": 3200, "start_y": 1600, "end_x": 0, "end_y": 1600, "circle_center_x": 1600, "circle_center_y": 2200, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":2, "last_entity":4 }, { "entity_id": 4, "entity_type": 1, "start_x": 0, "start_y": 1600, "end_x": 0, "end_y": 0, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":3, "last_entity":1 } ] }, { "item_id": 1, "item_name": "d:\rectangle2.cam", "count": 3, "priority": 5, "rotation_type": 2, "flip": 0, "pair_collinear": 0, "collinear_entity_id": 0, "entities":[ { "entity_id": 1, "entity_type": 1, "start_x": 0, "start_y": 0, "end_x": 500, "end_y": 0, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":2, "last_entity":0 }, { "entity_id": 2, "entity_type": 1, "start_x": 500, "start_y": 0, "end_x": 500, "end_y": 500, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":3, "last_entity":1 }, { "entity_id": 3, "entity_type": 1, "start_x": 500, "start_y": 500, "end_x": 0, "end_y": 0, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":0, "last_entity":2 } ] }, { "item_id": 2, "item_name": "d:\rectangle2.cam", "count": 2, "priority": 5, "rotation_type": 2, "flip": 0, "pair_collinear": 0, "collinear_entity_id": 0, "entities":[ { "entity_id": 1, "entity_type": 2, "start_x": 500, "start_y": 0, "end_x": 500, "end_y": 0, "circle_center_x": 0, "circle_center_y": 0, "dxf_name": "", "entry_type": 0, "ifoutside": 1, "next_entity":0, "last_entity":0 } ] } ] , "total_cams":3, }
步骤二:查询钣金切割结果
待切割排版任务完成后,查询排版结果。华为云钣金排版服务将返回json格式排版结果文件,可以通过第三方软件服务商展示排版结果,生成适配切割机的切割文件。
{ "task_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "task_type": "test_type", "task_name": "sss", "status": "RUNNING", "created_at": "2018-06-12T13:00:01Z", "updated_at": "2018-06-13T13:00:01Z", "result": { "average_ratio": 0.43922290579330253, "common_cut_nest": 0, "item_spacing": 10.0, "nesting": [ { "item_count": 7, "items": [ { "envelope_rect_center_x": 1605.0000000000018, "envelope_rect_center_y": 1959.4003744920346, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle.cam" }, { "envelope_rect_center_x": 1605.0000000000018, "envelope_rect_center_y": 3570.133437492032, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle.cam" }, { "envelope_rect_center_x": 505.0, "envelope_rect_center_y": 3348.425682497144, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle2.cam" }, { "envelope_rect_center_x": 1136.003821693054, "envelope_rect_center_y": 1105.7330629999974, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle2.cam" }, { "envelope_rect_center_x": 705.1606452469719, "envelope_rect_center_y": 2827.3374108695393, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle2.cam" }, { "envelope_rect_center_x": 1001.5517970744211, "envelope_rect_center_y": 2606.6574946969886, "flip_x": 0, "flip_y": 0, "item_angle": 0.0, "item_name": "d:\rectangle2.cam" }, { "envelope_rect_center_x": 269.9895399372879, "envelope_rect_center_y": 1355.7330629372852, "flip_x": 0, "flip_y": 0, "item_angle": 90.0, "item_name": "d:\rectangle2.cam" } ], "plate_id": 0, "plate_length": 3980.0, "plate_name": "", "plate_ratio": 0.43922290579330253, "plate_width": 3980.0 } ], "plate_count": 1, "plate_spacing": 20.0, "project_name": "TESTPRO", "task_name": "TESTTASK", "time": 20, "total_item_count": 7 } }