diff --git a/app/data.py b/app/data.py index 4c251e3..ab58b9c 100644 --- a/app/data.py +++ b/app/data.py @@ -54,7 +54,7 @@ def init_project_data(): # soldering toolpath "SolderToolpath": [ # array with soldering points, referencing nc drill tool and position in list, selected soldering profile, attributes if reference point # sort this array with PanelRef1 first, following closest neigbourst on optimize soldering points, do not sort imported nc hits and nc tools - # { "NCId" : 0, "NCPositionX": 0, "NCPositionY": 0, "NCTool":0, "PanelRef1": True, "PanelRef2":False, "SolderingProfile":-1, "ToolPathSorting" } + # { "NCId" : 0, "NCPositionX": 0, "NCPositionY": 0, "NCDiameter":0, "NCTool":0, "PanelRef1": True, "PanelRef2":False, "SolderingProfile":-1, "ToolPathSorting" } ] # excellon "NCSolderSide": "Top", # let user choose on import of nc file diff --git a/app/excellon.py b/app/excellon.py index 383a8e1..2012464 100644 --- a/app/excellon.py +++ b/app/excellon.py @@ -47,12 +47,14 @@ def convert_to_json(ncdata): hit[h]=ncdata.hits[h] tool = hit.tool.number pos=hit.position + dia=hit.diameter soldertoolpath.append( {# use index as id "NCId" : h, "NCPositionX": pos.x, "NCPositionY": pos.y, "NCTool" : tool, + "NCDiameter": dia, "PanelRef1": False, "PanelRef2":False, # no soldering @@ -172,3 +174,31 @@ def optimize_soldertoolpath(soldertoolpath,ncdata) sortingIndex+=1 return soldertoolpath +# Get nc tool area +def get_nc_tool_area(soldertoolpath) + xmin=0 + xmax=0 + ymin=0 + ymax=0 + for e, elem in enumerate(solderingtoolpath): + tp=solderingtoolpath[e] + xemin=tp['NCPositionX']-(tp['NCDiameter']/2.0) + xemax=tp['NCPositionX']+(tp['NCDiameter']/2.0) + yemin=tp['NCPositionY']-(tp['NCDiameter']/2.0) + yemax=tp['NCPositionY']+(tp['NCDiameter']/2.0) + if e==0 OR xeminxmax: + xmax=xemax + if e==0 OR yemin