Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rocoelectrical
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jingyan Ling
rocoelectrical
Commits
a70bd816
Commit
a70bd816
authored
5 years ago
by
Jingyan Ling
Browse files
Options
Downloads
Patches
Plain Diff
remove redundant file, update journal
parent
86ac6d58
Branches
Branches containing commit
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+22
-1
22 additions, 1 deletion
README.md
analyze_dxf.py
+5
-5
5 additions, 5 deletions
analyze_dxf.py
ling.md
+0
-0
0 additions, 0 deletions
ling.md
testline.dxf
+0
-3570
0 additions, 3570 deletions
testline.dxf
testline.py
+0
-72
0 additions, 72 deletions
testline.py
with
27 additions
and
3648 deletions
README.md
+
22
−
1
View file @
a70bd816
...
...
@@ -191,8 +191,29 @@
-
Obstacles setting are incorrect
### 07/09/2019
-
Finish up path-finding approach (Approach B)
-
Only draw the best path on
`dxf`
when solution is found for every route.
-
!
[
circuit_dxf
](
journal_media/dxf_circuit.png
)
-
Throw warning once a route cannot be found
-
!
[
fail_solution
](
journal_media/path_fail.gif
)
-
Research on Approach A
-
KiCAD 5 does not have built-in auto-router
-
Have to use
`FreeRouting`
-
`FreeRouting`
does not have python API
-
Parent package of
`FreeRouting`
,
`LayoutEditor`
has multiple editions
-
Part of
`LayoutEditor`
is open- source
-
A large amount of of its website are broken, source and interface are unavailable
-
Other auto-routers are not open-source
##### Approach A
-
1. Use
`LayoutEditor`
python API to use
`FreeRouting`
-
2. Use
`KiCAD 5`
python API to sue
`FreeRouting`
-
3. Use
`KiCAD 4`
python API to use builtin auto-routing
-
TODO:
-
If can run KiCAD 4 from python
-
Check
`FreeRouting`
API, see if a acceptable file can be generated from things on hand
This diff is collapsed.
Click to expand it.
analyze_dxf.py
+
5
−
5
View file @
a70bd816
...
...
@@ -245,11 +245,11 @@ class auto_rounter:
print
'
Current cost:
'
,
self
.
Q
,
'
Best cost
'
,
self
.
Q_buff
episode
+=
1
#
if not self.final_fail:
for
i
in
range
(
len
(
self
.
final_path
)):
self
.
draw_a_path
(
self
.
final_path
[
i
],
self
.
matrix
,
True
)
#
else:
#
print 'One or more path cannot be solved'
if
not
self
.
final_fail
:
for
i
in
range
(
len
(
self
.
final_path
)):
self
.
draw_a_path
(
self
.
final_path
[
i
],
self
.
matrix
,
True
)
else
:
print
'
One or more path cannot be solved
'
def
test_connections
(
self
):
y
=
97
...
...
This diff is collapsed.
Click to expand it.
ling.md
deleted
100644 → 0
+
0
−
0
View file @
86ac6d58
This diff is collapsed.
Click to expand it.
testline.dxf
deleted
100644 → 0
+
0
−
3570
View file @
86ac6d58
This diff is collapsed.
Click to expand it.
testline.py
deleted
100644 → 0
+
0
−
72
View file @
86ac6d58
import
ezdxf
import
random
# needed for random placing points
import
numpy
as
np
def
get_random_point
():
"""
Creates random x, y coordinates.
"""
x
=
random
.
randint
(
-
100
,
100
)
y
=
random
.
randint
(
-
100
,
100
)
return
x
,
y
# Create a new drawing in the DXF format of AutoCAD 2010
dwg
=
ezdxf
.
new
(
'
ac1024
'
)
if
not
'
Isolation
'
in
dwg
.
layers
:
dwg
.
layers
.
new
(
name
=
'
Isolation
'
,
dxfattribs
=
{
'
color
'
:
4
})
# Create a block with the name 'FLAG'
flag
=
dwg
.
blocks
.
new
(
name
=
'
FLAG
'
)
# Add DXF entities to the block 'FLAG'.
# The default base point (= insertion point) of the block is (0, 0).
# flag.add_polyline2d([(0, 0), (0, 5)]) # the flag as 2D polyline
flag
.
add_circle
((
0
,
0
),
5
,
dxfattribs
=
{
'
color
'
:
5
})
# mark the base point with a circle
# flag.add_text("TEST").set_pos((25,280),align="MIDDLE_RIGHT")
# Get the modelspace of the drawing.
modelspace
=
dwg
.
modelspace
()
modelspace
.
add_line
((
0.3
,
0.6
),(
40.5
,
0.6
))
# Get 50 random placing points.
placing_points
=
[
get_random_point
()
for
_
in
range
(
50
)]
random_scale
=
0.5
+
random
.
random
()
*
2.0
# Add a block reference to the block named 'FLAG' at the coordinates 'point'.
modelspace
.
add_blockref
(
'
FLAG
'
,
(
15
,
290
),
dxfattribs
=
{
'
layer
'
:
'
Isolation
'
,
})
modelspace
.
add_blockref
(
'
FLAG
'
,(
8
,
290
))
modelspace
.
add_text
(
"
TEST
"
).
set_pos
((
10
,
285
),
align
=
"
MIDDLE_RIGHT
"
)
for
e
in
modelspace
.
query
(
'
LINE
'
):
print
(
e
.
dxf
.
start
)
index_i
=
[]
index_j
=
[]
for
line
in
modelspace
.
query
(
'
LINE
'
):
start
=
np
.
rint
(
line
.
dxf
.
start
)
end
=
np
.
rint
(
line
.
dxf
.
end
)
i
=
start
[
0
]
j
=
start
[
1
]
# index_i.append(i)
# index_j.append(j)
#can draw horizontal or vertical lines only
if
j
==
end
[
1
]:
#this line is a horizontal line
index_i
.
append
(
i
)
while
i
!=
end
[
0
]:
if
i
<
end
[
0
]:
i
+=
1
else
:
i
-=
1
index_i
.
append
(
i
)
elif
i
==
end
[
0
]:
#this line is a vertical line
index_j
.
append
(
j
)
while
j
!=
end
[
1
]:
if
j
<
end
[
1
]:
j
+=
1
else
:
j
-=
1
index_j
.
append
(
j
)
# Save the drawing.
dwg
.
saveas
(
"
testline.dxf
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment