- in NCC Tool fixed a bug when using Rest Machining; optimizations

- in NCC Tool fixed a UI issue
- updated the Turkish translation (by Mehmet Kaya)
This commit is contained in:
Marius Stanciu
2020-10-22 19:13:15 +03:00
committed by Marius
parent 5446570409
commit 37408efcc7
4 changed files with 144 additions and 99 deletions

View File

@@ -14,6 +14,9 @@ CHANGELOG for FlatCAM beta
- modified some strings and updated the translation strings - modified some strings and updated the translation strings
- in NCC Tool added a check for the validity of the used tools; its only informative - in NCC Tool added a check for the validity of the used tools; its only informative
- in NCC Tool done some refactoring - in NCC Tool done some refactoring
- in NCC Tool fixed a bug when using Rest Machining; optimizations
- in NCC Tool fixed a UI issue
- updated the Turkish translation (by Mehmet Kaya)
21.10.2020 21.10.2020

View File

@@ -511,6 +511,8 @@ class NonCopperClear(AppTool, Gerber):
self.ui.ncc_offset_spinner.set_value(self.app.defaults["tools_ncc_offset_value"]) self.ui.ncc_offset_spinner.set_value(self.app.defaults["tools_ncc_offset_value"])
self.ui.ncc_rest_cb.set_value(self.app.defaults["tools_ncc_rest"]) self.ui.ncc_rest_cb.set_value(self.app.defaults["tools_ncc_rest"])
self.ui.on_rest_machining_check(state=self.app.defaults["tools_ncc_rest"])
self.ui.rest_ncc_margin_entry.set_value(self.app.defaults["tools_ncc_margin"]) self.ui.rest_ncc_margin_entry.set_value(self.app.defaults["tools_ncc_margin"])
self.ui.rest_ncc_connect_cb.set_value(self.app.defaults["tools_ncc_connect"]) self.ui.rest_ncc_connect_cb.set_value(self.app.defaults["tools_ncc_connect"])
self.ui.rest_ncc_contour_cb.set_value(self.app.defaults["tools_ncc_contour"]) self.ui.rest_ncc_contour_cb.set_value(self.app.defaults["tools_ncc_contour"])
@@ -777,11 +779,11 @@ class NonCopperClear(AppTool, Gerber):
pass pass
try: try:
self.ui.ncc_rest_cb.stateChanged.disconnect() self.ui.ncc_rest_cb.stateChanged.disconnect(self.ui.on_rest_machining_check)
except (TypeError, ValueError): except (TypeError, ValueError):
pass pass
try: try:
self.ui.ncc_order_radio.activated_custom[str].disconnect() self.ui.ncc_order_radio.activated_custom[str].disconnect(self.on_order_changed)
except (TypeError, ValueError): except (TypeError, ValueError):
pass pass
@@ -2383,6 +2385,13 @@ class NonCopperClear(AppTool, Gerber):
ncc_margin=ncc_margin, tools_storage=tools_storage, ncc_margin=ncc_margin, tools_storage=tools_storage,
bounding_box=bbox) bounding_box=bbox)
# for testing purposes ----------------------------------
# for po in area.geoms:
# self.app.tool_shapes.add(po, color=self.app.defaults['global_sel_line'],
# face_color=self.app.defaults['global_sel_line'],
# update=True, layer=0, tolerance=None)
# -------------------------------------------------------
# Generate area for each tool # Generate area for each tool
while sorted_clear_tools: while sorted_clear_tools:
tool = sorted_clear_tools.pop(0) tool = sorted_clear_tools.pop(0)
@@ -2402,44 +2411,59 @@ class NonCopperClear(AppTool, Gerber):
tool_uid = 0 # find the current tool_uid tool_uid = 0 # find the current tool_uid
for k, v in self.ncc_tools.items(): for k, v in self.ncc_tools.items():
if float('%.*f' % (self.decimals, v['tooldia'])) == float('%.*f' % (self.decimals, tool)): if self.app.dec_format(v['tooldia'], self.decimals) == self.app.dec_format(tool, self.decimals):
tool_uid = int(k) tool_uid = int(k)
break break
tool_data_dict = self.ncc_tools[tool_uid]["data"]
# parameters that are particular to the current tool # parameters that are particular to the current tool
ncc_overlap = float(self.ncc_tools[tool_uid]["data"]["tools_ncc_overlap"]) / 100.0 ncc_overlap = float(tool_data_dict["tools_ncc_overlap"]) / 100.0
ncc_method = self.ncc_tools[tool_uid]["data"]["tools_ncc_method"] ncc_method = tool_data_dict["tools_ncc_method"]
# variables to display the percentage of work done # variables to display the percentage of work done
geo_len = len(area.geoms) geo_len = len(area.geoms)
old_disp_number = 0 old_disp_number = 0
log.warning("Total number of polygons to be cleared. %s" % str(geo_len)) log.warning("Total number of polygons to be cleared: %s" % str(geo_len))
# def random_color():
# r_color = np.random.rand(4)
# r_color[3] = 0.5
# return r_color
# store here the geometry generated by clear operation # store here the geometry generated by clear operation
cleared_geo = [] cleared_geo = []
if area.geoms: poly_failed = 0
if len(area.geoms) > 0: if area.geoms and len(area.geoms) > 0:
pol_nr = 0 pol_nr = 0
for p in area.geoms: for p in area.geoms:
if self.app.abort_flag: if self.app.abort_flag:
# graceful abort requested by the user # graceful abort requested by the user
raise grace raise grace
if p is not None and p.is_valid: if p is not None and p.is_valid and not p.is_empty:
# provide the app with a way to process the GUI events when in a blocking loop # provide the app with a way to process the GUI events when in a blocking loop
QtWidgets.QApplication.processEvents() QtWidgets.QApplication.processEvents()
poly_failed = 0
# speedup the clearing by not trying to clear polygons that is clear they can't be # speedup the clearing by not trying to clear polygons that is clear they can't be
# cleared with the current tool. this tremendously reduce the clearing time # cleared with the current tool. this tremendously reduce the clearing time
check_dist = -tool / 2.0 check_dist = -tool / 2
check_buff = p.buffer(check_dist) check_buff = p.buffer(check_dist, self.circle_steps)
if not check_buff or check_buff.is_empty: if not check_buff or check_buff.is_empty:
continue continue
# actual copper claring is done here # if self.app.dec_format(float(tool), self.decimals) == 0.15:
# # for testing purposes ----------------------------------
# self.app.tool_shapes.add(p, color=self.app.defaults['global_sel_line'],
# face_color=random_color(),
# update=True, layer=0, tolerance=None)
# self.app.tool_shapes.add(check_buff, color=self.app.defaults['global_sel_line'],
# face_color='#FFFFFFFF',
# update=True, layer=0, tolerance=None)
# # -------------------------------------------------------
# actual copper clearing is done here
if isinstance(p, Polygon): if isinstance(p, Polygon):
res = self.clear_polygon_worker(pol=p, tooldia=tool, res = self.clear_polygon_worker(pol=p, tooldia=tool,
ncc_method=ncc_method, ncc_method=ncc_method,
@@ -2447,6 +2471,7 @@ class NonCopperClear(AppTool, Gerber):
ncc_connect=ncc_connect, ncc_connect=ncc_connect,
ncc_contour=ncc_contour, ncc_contour=ncc_contour,
prog_plot=prog_plot) prog_plot=prog_plot)
if res is not None: if res is not None:
cleared_geo += res cleared_geo += res
else: else:
@@ -2473,13 +2498,48 @@ class NonCopperClear(AppTool, Gerber):
if cleared_geo: if cleared_geo:
tools_storage[tool_uid]["solid_geometry"] = deepcopy(cleared_geo) tools_storage[tool_uid]["solid_geometry"] = deepcopy(cleared_geo)
tools_storage[tool_uid]["data"]["name"] = name + '_' + str(tool) tools_storage[tool_uid]["data"]["name"] = name + '_' + str(tool)
geo_obj.tools[current_uid] = dict(tools_storage[current_uid]) geo_obj.tools[tool_uid] = dict(tools_storage[tool_uid])
else: else:
log.debug("There are no geometries in the cleared polygon.") log.debug("There are no geometries in the cleared polygon.")
# Area to clear next log.warning("Total number of polygons failed to be cleared: %s" % str(poly_failed))
buffered_cleared = unary_union(cleared_geo).buffer(tool / 2.0) else:
area = area.difference(buffered_cleared) log.warning("The area to be cleared has no polygons.")
# # Area to clear next
# try:
# # buffered_cleared = unary_union(cleared_geo).buffer(tool / 2.0)
# # area = area.difference(buffered_cleared)
# area = area.difference(unary_union(cleared_geo))
# except Exception as e:
# log.debug("Creating new area failed due of: %s" % str(e))
new_area = MultiPolygon([line.buffer(tool / 1.9999999) for line in cleared_geo])
new_area = new_area.buffer(0.0000001)
area = area.difference(new_area)
new_area = [pol for pol in area if pol.is_valid and not pol.is_empty]
area = MultiPolygon(new_area)
# speedup the clearing by not trying to clear polygons that is clear they can't be
# cleared with any tool. this tremendously reduce the clearing time
# found_poly_to_clear = False
# for t in sorted_clear_tools:
# check_dist = -t / 2.000000001
# for pl in area:
# check_buff = pl.buffer(check_dist)
# if not check_buff or check_buff.is_empty or not check_buff.is_valid:
# continue
# else:
# found_poly_to_clear = True
# break
# if found_poly_to_clear is True:
# break
#
# if found_poly_to_clear is False:
# log.warning("The area to be cleared no longer has polygons. Finishing.")
# break
if not area or area.is_empty: if not area or area.is_empty:
break break

Binary file not shown.

View File

@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2020-10-22 15:08+0300\n" "POT-Creation-Date: 2020-10-22 15:08+0300\n"
"PO-Revision-Date: 2020-10-22 15:08+0300\n" "PO-Revision-Date: 2020-10-22 16:13+0300\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: tr_TR\n" "Language: tr_TR\n"
@@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 2.3.1\n" "X-Generator: Poedit 2.4.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Basepath: ../../..\n" "X-Poedit-Basepath: ../../..\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
@@ -5909,7 +5909,7 @@ msgstr "Komut Satırı Paneli"
msgid "" msgid ""
"Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)" "Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)"
msgstr "" msgstr ""
"Bir araç ekleyin (\"Seçili\" sekmede Şekil, Bakır Temizleme veya Çizim " "Bir araç ekleyin (\"Özellikler\" sekmede Şekil, Bakır Temizleme veya Çizim "
"Araçlarındayken)" "Araçlarındayken)"
#: appGUI/MainGUI.py:4265 #: appGUI/MainGUI.py:4265
@@ -6474,16 +6474,12 @@ msgid ""
msgstr "PCB'yi kesmek için kesim şekilleri oluşturun." msgstr "PCB'yi kesmek için kesim şekilleri oluşturun."
#: appGUI/ObjectUI.py:407 appGUI/ObjectUI.py:756 #: appGUI/ObjectUI.py:407 appGUI/ObjectUI.py:756
#, fuzzy
#| msgid "UTILITIES"
msgid "UTILTIES" msgid "UTILTIES"
msgstr "HİZMETLER" msgstr "ARAÇLAR"
#: appGUI/ObjectUI.py:409 appGUI/ObjectUI.py:758 #: appGUI/ObjectUI.py:409 appGUI/ObjectUI.py:758
#, fuzzy
#| msgid "Show the Properties."
msgid "Show the Utilties." msgid "Show the Utilties."
msgstr "Özellikleri göster." msgstr "Araçaları göster."
#: appGUI/ObjectUI.py:433 appGUI/preferences/gerber/GerberOptPrefGroupUI.py:32 #: appGUI/ObjectUI.py:433 appGUI/preferences/gerber/GerberOptPrefGroupUI.py:32
msgid "Non-copper regions" msgid "Non-copper regions"
@@ -7428,24 +7424,14 @@ msgid "Launch Paint Tool in Tools Tab."
msgstr "Araçlar sekmesindeki \"Çizim\" aracını başlatır." msgstr "Araçlar sekmesindeki \"Çizim\" aracını başlatır."
#: appGUI/ObjectUI.py:1770 #: appGUI/ObjectUI.py:1770
#, fuzzy
#| msgid "Generating slot milling geometry..."
msgid "Generate a CNCJob by milling a Geometry." msgid "Generate a CNCJob by milling a Geometry."
msgstr "Yuva frezeleme şekli oluşturuluyor ..." msgstr "Bir Şekli frezeleyerek bir CNC İşi oluşturun."
#: appGUI/ObjectUI.py:1786 appGUI/preferences/tools/ToolsPaintPrefGroupUI.py:35 #: appGUI/ObjectUI.py:1786 appGUI/preferences/tools/ToolsPaintPrefGroupUI.py:35
#, fuzzy
#| msgid ""
#| "Creates tool paths to cover the\n"
#| "whole area of a polygon (remove\n"
#| "all copper). You will be asked\n"
#| "to click on the desired polygon."
msgid "" msgid ""
"Creates tool paths to cover the\n" "Creates tool paths to cover the\n"
"whole area of a polygon." "whole area of a polygon."
msgstr "" msgstr "Bir çokgenin tüm alanlarını kaplayacak yollar oluşturur."
"PCB'de yollar dışında kalan tüm bakır kazınarak çıkarılır.\n"
"Bakır temizliği yapılacak alanı tıklamanız istenir."
#: appGUI/ObjectUI.py:1840 #: appGUI/ObjectUI.py:1840
msgid "CNC Job Object" msgid "CNC Job Object"
@@ -9067,7 +9053,7 @@ msgstr ""
#: appGUI/preferences/general/GeneralAPPSetGroupUI.py:214 #: appGUI/preferences/general/GeneralAPPSetGroupUI.py:214
#: appTools/ToolDblSided.py:666 appTools/ToolDblSided.py:838 #: appTools/ToolDblSided.py:666 appTools/ToolDblSided.py:838
msgid "Axis" msgid "Axis"
msgstr "Eksen Yazı Boyutu" msgstr "Eksen"
#: appGUI/preferences/general/GeneralAPPSetGroupUI.py:216 #: appGUI/preferences/general/GeneralAPPSetGroupUI.py:216
msgid "This sets the font size for canvas axis." msgid "This sets the font size for canvas axis."
@@ -12263,7 +12249,7 @@ msgid ""
"if they will provide a complete isolation." "if they will provide a complete isolation."
msgstr "" msgstr ""
"İşaretlenirse, uç kalınlıklarının tam bir yalıtım\n" "İşaretlenirse, uç kalınlıklarının tam bir yalıtım\n"
"sağlayıp sağlamadıkları doğrulanır." "sağlayıp sağlamadıkları kontrol edilir."
#: appGUI/preferences/tools/ToolsISOPrefGroupUI.py:287 #: appGUI/preferences/tools/ToolsISOPrefGroupUI.py:287
#: appTools/ToolIsolation.py:3370 #: appTools/ToolIsolation.py:3370
@@ -13081,6 +13067,8 @@ msgid ""
"Voronoi function can not be loaded.\n" "Voronoi function can not be loaded.\n"
"Shapely >= 1.8 is required" "Shapely >= 1.8 is required"
msgstr "" msgstr ""
"Voronoi işlevi yüklenemiyor.\n"
"Shapely> = 1.8 gereklidir"
#: appObjects/FlatCAMCNCJob.py:808 #: appObjects/FlatCAMCNCJob.py:808
msgid "Click on canvas to add a Probe Point..." msgid "Click on canvas to add a Probe Point..."
@@ -14932,7 +14920,7 @@ msgstr "Terslenecek nesneler"
#: appTools/ToolDblSided.py:521 #: appTools/ToolDblSided.py:521
msgid "Select the type of application object to be processed in this tool." msgid "Select the type of application object to be processed in this tool."
msgstr "" msgstr "Bu araçta işlenecek nesnesinin türünü seçin."
#: appTools/ToolDblSided.py:555 #: appTools/ToolDblSided.py:555
msgid "Bounds Values" msgid "Bounds Values"
@@ -16326,23 +16314,17 @@ msgstr "Sol tıklandığında hata oluştu."
#: appTools/ToolNCC.py:835 #: appTools/ToolNCC.py:835
msgid "NCC Tool. Checking tools for validity." msgid "NCC Tool. Checking tools for validity."
msgstr "" msgstr "Bakır Temizleme. Uçların uygunluğu kontrol ediliyor."
#: appTools/ToolNCC.py:947 #: appTools/ToolNCC.py:947
#, fuzzy
#| msgid ""
#| "Incomplete isolation. At least one tool could not do a complete isolation."
msgid "" msgid ""
"Incomplete isolation. None of the selected tools could do a complete " "Incomplete isolation. None of the selected tools could do a complete "
"isolation." "isolation."
msgstr "Eksik yalıtım. En az bir uç tam bir yalıtım yapamadı." msgstr "Eksik yalıtım. Seçilen uçların hiçbiri tam bir yalıtım sağlayamadı."
#: appTools/ToolNCC.py:950 #: appTools/ToolNCC.py:950
#, fuzzy
#| msgid ""
#| "Incomplete isolation. At least one tool could not do a complete isolation."
msgid "At least one of the selected tools can do a complete isolation." msgid "At least one of the selected tools can do a complete isolation."
msgstr "Eksik yalıtım. En az bir tam bir yalıtım yapamadı." msgstr "Seçilen uçlardan en az biri tam bir yalıtım yapabilir."
#: appTools/ToolNCC.py:1722 appTools/ToolNCC.py:2646 #: appTools/ToolNCC.py:1722 appTools/ToolNCC.py:2646
msgid "NCC Tool. Preparing non-copper polygons." msgid "NCC Tool. Preparing non-copper polygons."
@@ -16488,7 +16470,7 @@ msgstr ""
#: appTools/ToolNCC.py:3750 #: appTools/ToolNCC.py:3750
msgid "Non-Copper Clearing" msgid "Non-Copper Clearing"
msgstr "Bakır Temizleniyor" msgstr "Bakır Temizleme"
#: appTools/ToolNCC.py:3779 appTools/ToolPaint.py:2765 #: appTools/ToolNCC.py:3779 appTools/ToolPaint.py:2765
msgid "Obj Type" msgid "Obj Type"