Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bigprint
twins-controller
Commits
fe2768f3
Commit
fe2768f3
authored
Mar 20, 2020
by
Jayant Khatkar
Browse files
infill working but needs to be offset from sides
parent
f0cbf0d4
Changes
1
Show whitespace changes
Inline
Side-by-side
gcode/gen_cube3d.py
View file @
fe2768f3
...
...
@@ -103,12 +103,16 @@ class solver:
return
self
.
layer
.
subs
([(
sym
,
val
),
(
self
.
cz
,
layer
*
self
.
dz
)])
def
sample
(
self
,
expression
,
sym_in
,
res
=
0.001
):
def
sample
(
self
,
expression
,
sym_in
,
res
=
0.001
,
lims
=
None
):
"""
sample across one variable, get values of second variable in an expression
"""
v1
=
np
.
arange
(
self
.
range
[
sym_in
][
0
],
self
.
range
[
sym_in
][
1
]
+
res
,
res
)
if
lims
is
None
:
lims
=
self
.
range
[
sym_in
]
v1
=
np
.
arange
(
lims
[
0
],
lims
[
1
]
+
res
,
res
)
zs
=
[]
for
v
in
v1
:
zs
.
append
(
float
(
expression
.
subs
(
sym_in
,
v
)))
...
...
@@ -212,7 +216,15 @@ class solver:
direction
=
True
for
row
in
main_vals
[
1
:]:
# TODO link to the next row
# Connection to next row
if
main
is
self
.
y
:
expr1
=
self
.
plane_intersection
(
other
,
poses
[
-
1
][
0
],
layer
=
n
)
os
,
zs
=
self
.
sample
(
expr1
,
main
,
lims
=
(
row
-
density
,
row
))
poses
+=
[
Position
(
poses
[
-
1
][
0
],
os
[
i
],
zs
[
i
])
for
i
in
range
(
len
(
os
))]
else
:
expr1
=
self
.
plane_intersection
(
other
,
poses
[
-
1
][
1
],
layer
=
n
)
os
,
zs
=
self
.
sample
(
expr1
,
main
,
lims
=
(
row
-
density
,
row
))
poses
+=
[
Position
(
os
[
i
],
poses
[
-
1
][
1
],
zs
[
i
])
for
i
in
range
(
len
(
os
))]
expr1
=
self
.
plane_intersection
(
main
,
row
,
layer
=
n
)
os
,
zs
=
self
.
sample
(
expr1
,
other
)
...
...
@@ -245,11 +257,12 @@ class solver:
if
__name__
==
'__main__'
:
s
=
solver
(
0.02
,
100
,
100
,
0.0
03
)
s
=
solver
(
0.02
,
100
,
100
,
0.0
1
)
contours
=
[]
o_contours
=
[]
i_contours
=
[]
for
i
in
np
.
arange
(
-
15
,
55
):
contours
+=
s
.
contour_n
(
i
)
contours
+=
s
.
infill_contour
(
i
,
0.02
)
o_
contours
+=
s
.
contour_n
(
i
)
i_
contours
+=
s
.
infill_contour
(
i
,
0.02
)
plot_contours
(
contours
)
plot_contours
(
o_contours
,
i_
contours
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment