diff --git a/README.md b/README.md index 68541b657132a4d3d20d23cb3cdd4b2d2b2ddc87..0ea952fd8a2b086d33ef59bc54bb9e19c3b665a2 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ ### 06/28/2019 (Fri) ##### Connection and fabrication approach confirmed ! - Confirm that copper tape has better conductivity than aluminum sheet when attaching microcontroller pins through `H-shape` cut - - Copper tape is harder to be scratched, which provides less risk of disconnection during assessmbly. + - Copper tape is harder to be scratched, which provides less risk of disconnection during assembly. - Etching on copper type isolates connections - Research on PCB editor @@ -58,7 +58,7 @@ ##### Approach `A` - Use regular shape board for PCB in EAGLE/KiCAD - - image processing: divide alternative shape of `paperbot` to multiple rectangles (openCV) + - image processing: divide the shape of `paperbot` to multiple rectangles (ezdxf) - Pull required connections and place additional header pins around edges of each rectangle @@ -100,9 +100,10 @@ - Edit > Clone > Unlink Clone (Shift+Alt+D), and you have a group, ungroup (Object > Ungroup, or Shift+Ctrl+G) and edit - Convert `text` to `path` - Path combine (Ctrl+K) + - msp.delete_enetity('__') to remove existing entity - Test fabrication with different drawing settings - - Layers can be cut separately but toggling visibility + - Layers can be cut separately by toggling visibility - Set cuts with same `intensity` and `feedrate` on same layer - Entities' layer can be changed through `Entity.dxf.layer` @@ -112,4 +113,21 @@ - Able to detect pin center coordinate - Able to draw arbitrary shape around the pin center -  + +- - Issue & TODO + - Convert dxf image to matrix + - Explore `pathfinding` package + + - `pathfinding` package solve path finding problem by shortest path algorithm, one point to another + - To solve multiple nodes problem, use concept from reinforcement learning + - Build Q function that represents total reward of choosing certain path to be solved first + - Update Q function in a loop with certain amount of episodes + - Choose the order of solving paths randomly, and add possibility of choosing it from Q function + - Exploration-exploitation method +- To solve the problem "convert dxf to matrix" for pathfinding: + - Have tried: + - Export to `png` and read file by `OpenCV` + - Resolution problem: single point does not represented as a pixel in `png` + - TODO: + - create an empty matrix and fill in numbers with the information of each lines' start and end point \ No newline at end of file diff --git a/analyze_dxf.py b/analyze_dxf.py index 5340a593cd78f197f48f8fc8537d3b52d9e42067..df9d2959ca68420e93ae5ef78696c0b56621f0f8 100644 --- a/analyze_dxf.py +++ b/analyze_dxf.py @@ -4,11 +4,15 @@ import numpy as np import ezdxf import random from math import sqrt +import cv2 +import os class dxf_editor: def __init__(self,path,dxf_file): self.dwg=ezdxf.readfile(path+dxf_file) self.msp=self.dwg.modelspace() + self.dxf_name='silhouette_ele.dxf' + self.img_name='silouette_ele.png' self.create_layer('Cut',5) @@ -24,9 +28,13 @@ class dxf_editor: isolength=2.6 #mm self.draw_on_pin(isolength) + self.dwg.saveas(self.dxf_name) + # os.system("inkscape -f silhouette_ele.dxf -e silouette_ele.png") + + # self.img=cv2.imread(path+self.img_name) + # print(self.img) - self.dwg.saveas('silhouette_ele.dxf') def create_layer(self,layer_name,color): if not layer_name in self.dwg.layers: self.dwg.layers.new(name=layer_name,dxfattribs={'color':color}) @@ -72,15 +80,20 @@ class dxf_editor: def draw_on_pin(self,fulllength): #isolation iso=self.dwg.blocks.new(name='ISO_BLK') isolength=fulllength/2 + trace_w=0.8 iso.add_line((-isolength,isolength),(isolength,isolength),dxfattribs={'linetype':'DASHDOT'}) iso.add_line((-isolength,-isolength),(isolength,-isolength),dxfattribs={'linetype':'DASHDOT'}) iso.add_line((-isolength,-isolength),(-isolength,isolength),dxfattribs={'linetype':'DASHDOT'}) iso.add_line((isolength,-isolength),(isolength,isolength),dxfattribs={'linetype':'DASHDOT'}) - + + iso.add_line((-isolength,-trace_w/2),(-(isolength+5),-trace_w/2),dxfattribs={'linetype':'DASHDOT'}) + iso.add_line((-isolength,trace_w/2),(-(isolength+5),trace_w/2),dxfattribs={'linetype':'DASHDOT'}) for center_point in self.center_arr: self.msp.add_blockref('ISO_BLK',center_point,dxfattribs={'layer':'Circuit'}) - + # def img_color_convert(self): + # for i in range(self.img.shape[0]): + # for j in diff --git a/journal_media/isolation_circuit.gif b/journal_media/isolation_circuit.gif index 55088fdd490f13955900d5a22ff278da8d58d8a5..d72ad9219ca053eafcf98f13b947391f47ea9041 100644 Binary files a/journal_media/isolation_circuit.gif and b/journal_media/isolation_circuit.gif differ diff --git a/silhouette_ele.dxf b/silhouette_ele.dxf index 11c18bec5f3754d43e2198591d42e7862afadc20..bcf3641b28a9883a2d87e778791e86fd68d33d45 100644 --- a/silhouette_ele.dxf +++ b/silhouette_ele.dxf @@ -53,11 +53,11 @@ $HANDLING 9 $TDUPDATE 40 -2458667.56765 +2458667.67488 9 $HANDSEED 5 -30F +311 9 $DWGCODEPAGE 3 @@ -1089,6 +1089,42 @@ DASHDOT 67 0 0 +LINE + 5 +2D1 + 8 +0 + 10 +-1.3 + 20 +-0.4 + 11 +-6.3 + 21 +-0.4 + 6 +DASHDOT + 67 +0 + 0 +LINE + 5 +2D2 + 8 +0 + 10 +-1.3 + 20 +0.4 + 11 +-6.3 + 21 +0.4 + 6 +DASHDOT + 67 +0 + 0 ENDBLK 5 2CC @@ -14527,7 +14563,7 @@ Pin_temp 0 INSERT 5 -2D1 +2D3 8 Circuit 2 @@ -14549,7 +14585,7 @@ ISO_BLK 0 INSERT 5 -2D2 +2D4 8 Circuit 2 @@ -14571,7 +14607,7 @@ ISO_BLK 0 INSERT 5 -2D3 +2D5 8 Circuit 2 @@ -14593,7 +14629,7 @@ ISO_BLK 0 INSERT 5 -2D4 +2D6 8 Circuit 2 @@ -14615,7 +14651,7 @@ ISO_BLK 0 INSERT 5 -2D5 +2D7 8 Circuit 2 @@ -14637,7 +14673,7 @@ ISO_BLK 0 INSERT 5 -2D6 +2D8 8 Circuit 2 @@ -14659,7 +14695,7 @@ ISO_BLK 0 INSERT 5 -2D7 +2D9 8 Circuit 2 @@ -14681,7 +14717,7 @@ ISO_BLK 0 INSERT 5 -2D8 +2DA 8 Circuit 2 @@ -14703,7 +14739,7 @@ ISO_BLK 0 INSERT 5 -2D9 +2DB 8 Circuit 2 @@ -14725,7 +14761,7 @@ ISO_BLK 0 INSERT 5 -2DA +2DC 8 Circuit 2 @@ -14747,7 +14783,7 @@ ISO_BLK 0 INSERT 5 -2DB +2DD 8 Circuit 2 @@ -14769,7 +14805,7 @@ ISO_BLK 0 INSERT 5 -2DC +2DE 8 Circuit 2 @@ -14791,7 +14827,7 @@ ISO_BLK 0 INSERT 5 -2DD +2DF 8 Circuit 2 @@ -14813,7 +14849,7 @@ ISO_BLK 0 INSERT 5 -2DE +2E0 8 Circuit 2 @@ -14835,7 +14871,7 @@ ISO_BLK 0 INSERT 5 -2DF +2E1 8 Circuit 2 @@ -14857,7 +14893,7 @@ ISO_BLK 0 INSERT 5 -2E0 +2E2 8 Circuit 2 @@ -14879,7 +14915,7 @@ ISO_BLK 0 INSERT 5 -2E1 +2E3 8 Circuit 2 @@ -14901,7 +14937,7 @@ ISO_BLK 0 INSERT 5 -2E2 +2E4 8 Circuit 2 @@ -14923,7 +14959,7 @@ ISO_BLK 0 INSERT 5 -2E3 +2E5 8 Circuit 2 @@ -14945,7 +14981,7 @@ ISO_BLK 0 INSERT 5 -2E4 +2E6 8 Circuit 2 @@ -14967,7 +15003,7 @@ ISO_BLK 0 INSERT 5 -2E5 +2E7 8 Circuit 2 @@ -14989,7 +15025,7 @@ ISO_BLK 0 INSERT 5 -2E6 +2E8 8 Circuit 2 @@ -15011,7 +15047,7 @@ ISO_BLK 0 INSERT 5 -2E7 +2E9 8 Circuit 2 @@ -15033,7 +15069,7 @@ ISO_BLK 0 INSERT 5 -2E8 +2EA 8 Circuit 2 @@ -15055,7 +15091,7 @@ ISO_BLK 0 INSERT 5 -2E9 +2EB 8 Circuit 2 @@ -15077,7 +15113,7 @@ ISO_BLK 0 INSERT 5 -2EA +2EC 8 Circuit 2 @@ -15099,7 +15135,7 @@ ISO_BLK 0 INSERT 5 -2EB +2ED 8 Circuit 2 @@ -15121,7 +15157,7 @@ ISO_BLK 0 INSERT 5 -2EC +2EE 8 Circuit 2 @@ -15143,7 +15179,7 @@ ISO_BLK 0 INSERT 5 -2ED +2EF 8 Circuit 2 @@ -15165,7 +15201,7 @@ ISO_BLK 0 INSERT 5 -2EE +2F0 8 Circuit 2 @@ -15187,7 +15223,7 @@ ISO_BLK 0 INSERT 5 -2EF +2F1 8 Circuit 2 @@ -15209,7 +15245,7 @@ ISO_BLK 0 INSERT 5 -2F0 +2F2 8 Circuit 2 @@ -15231,7 +15267,7 @@ ISO_BLK 0 INSERT 5 -2F1 +2F3 8 Circuit 2 @@ -15253,7 +15289,7 @@ ISO_BLK 0 INSERT 5 -2F2 +2F4 8 Circuit 2 @@ -15275,7 +15311,7 @@ ISO_BLK 0 INSERT 5 -2F3 +2F5 8 Circuit 2 @@ -15297,7 +15333,7 @@ ISO_BLK 0 INSERT 5 -2F4 +2F6 8 Circuit 2 @@ -15319,7 +15355,7 @@ ISO_BLK 0 INSERT 5 -2F5 +2F7 8 Circuit 2 @@ -15341,7 +15377,7 @@ ISO_BLK 0 INSERT 5 -2F6 +2F8 8 Circuit 2 @@ -15363,7 +15399,7 @@ ISO_BLK 0 INSERT 5 -2F7 +2F9 8 Circuit 2 @@ -15385,7 +15421,7 @@ ISO_BLK 0 INSERT 5 -2F8 +2FA 8 Circuit 2 @@ -15407,7 +15443,7 @@ ISO_BLK 0 INSERT 5 -2F9 +2FB 8 Circuit 2 @@ -15429,7 +15465,7 @@ ISO_BLK 0 INSERT 5 -2FA +2FC 8 Circuit 2 @@ -15451,7 +15487,7 @@ ISO_BLK 0 INSERT 5 -2FB +2FD 8 Circuit 2 @@ -15473,7 +15509,7 @@ ISO_BLK 0 INSERT 5 -2FC +2FE 8 Circuit 2 @@ -15495,7 +15531,7 @@ ISO_BLK 0 INSERT 5 -2FD +2FF 8 Circuit 2 @@ -15517,7 +15553,7 @@ ISO_BLK 0 INSERT 5 -2FE +300 8 Circuit 2 @@ -15539,7 +15575,7 @@ ISO_BLK 0 INSERT 5 -2FF +301 8 Circuit 2 @@ -15561,7 +15597,7 @@ ISO_BLK 0 INSERT 5 -300 +302 8 Circuit 2 @@ -15583,7 +15619,7 @@ ISO_BLK 0 INSERT 5 -301 +303 8 Circuit 2 @@ -15605,7 +15641,7 @@ ISO_BLK 0 INSERT 5 -302 +304 8 Circuit 2 @@ -15627,7 +15663,7 @@ ISO_BLK 0 INSERT 5 -303 +305 8 Circuit 2 @@ -15649,7 +15685,7 @@ ISO_BLK 0 INSERT 5 -304 +306 8 Circuit 2 @@ -15671,7 +15707,7 @@ ISO_BLK 0 INSERT 5 -305 +307 8 Circuit 2 @@ -15693,7 +15729,7 @@ ISO_BLK 0 INSERT 5 -306 +308 8 Circuit 2 @@ -15715,7 +15751,7 @@ ISO_BLK 0 INSERT 5 -307 +309 8 Circuit 2 @@ -15737,7 +15773,7 @@ ISO_BLK 0 INSERT 5 -308 +30A 8 Circuit 2 @@ -15759,7 +15795,7 @@ ISO_BLK 0 INSERT 5 -309 +30B 8 Circuit 2 @@ -15781,7 +15817,7 @@ ISO_BLK 0 INSERT 5 -30A +30C 8 Circuit 2 @@ -15803,7 +15839,7 @@ ISO_BLK 0 INSERT 5 -30B +30D 8 Circuit 2 @@ -15825,7 +15861,7 @@ ISO_BLK 0 INSERT 5 -30C +30E 8 Circuit 2 @@ -15847,7 +15883,7 @@ ISO_BLK 0 INSERT 5 -30D +30F 8 Circuit 2 @@ -15869,7 +15905,7 @@ ISO_BLK 0 INSERT 5 -30E +310 8 Circuit 2 diff --git a/silhouette_ele.png b/silhouette_ele.png new file mode 100644 index 0000000000000000000000000000000000000000..e429cd3dd37ec2800e7911f9aab6af5aab8c62a7 Binary files /dev/null and b/silhouette_ele.png differ diff --git a/silhouette_ele_2.png b/silhouette_ele_2.png new file mode 100644 index 0000000000000000000000000000000000000000..568f1679dca8064e7b5b22a58503ae2263ca614c Binary files /dev/null and b/silhouette_ele_2.png differ