Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shelf-inserts
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
make4all
createtivity
shelf-inserts
Commits
1255d23e
Unverified
Commit
1255d23e
authored
8 months ago
by
Jennifer Mankoff
Browse files
Options
Downloads
Patches
Plain Diff
"working" shelf insert
parent
9cf35f65
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
insert.py
+52
-29
52 additions, 29 deletions
insert.py
with
52 additions
and
29 deletions
insert.py
+
52
−
29
View file @
1255d23e
import
os
import
sys
sys
.
path
.
insert
(
0
,
os
.
getcwd
()
+
"
/boxes
"
)
from
typing
import
Any
,
Callable
from
boxes
import
*
;
import
svgwrite
;
...
...
@@ -54,15 +55,46 @@ import svgwrite;
# 'Š': 'Stackable edge with finger holes (top)',
# 'š': 'Stackable feet (bottom)'
class
OverhangSettings
(
edges
.
FingerJointSettings
):
"""
Settings for Overhang
Values:
* absolute
* front_overhang : 0.0 : overhang in x
* left_overhang : 0.0 : overhang in y
"""
absolute_params
=
{
"
style
"
:
(
"
rectangular
"
,
"
springs
"
,
"
barbs
"
,
"
snap
"
),
"
surroundingspaces
"
:
2.0
,
"
angle
"
:
90.0
,
"
front_overhang
"
:
0.0
,
#"back_overhang": 0.0,
#"right_overhang": 0.0,
"
left_overhang
"
:
0.0
,
}
def
checkValues
(
self
)
->
None
:
super
.
checkValues
()
# this would be better if it was a %age of width or something
if
abs
(
self
.
front_overhang
)
>
100
|
abs
(
self
.
left_overhang
)
>
100
:
raise
ValueError
(
"
OverhangSettings: Overhang should not be more than about 50 mm
"
)
class
ShelfInsert
(
Boxes
):
"""
Example: Single Shelve to screw to the wall
"""
ui_group
=
"
Shelves
"
# change for generators belonging in another group
UI
=
""
description
:
str
=
"
Creates a raised platform that can be used to fill in a rectangular space to a specific height
"
# argparser = ArgumentParser(description=description)
def
__init__
(
self
):
Boxes
.
__init__
(
self
)
# arguments
self
.
addSettingsArgs
(
edges
.
FingerJointSettings
,
finger
=
3.0
)
# arguments for finger joints
self
.
addSettingsArgs
(
OverhangSettings
,
finger
=
3.0
)
#self.addSettingsArgs(edges.FingerJointSettings, finger=3.0)
self
.
buildArgParser
(
"
sx
"
,
"
sy
"
,
"
h
"
,
"
outside
"
)
@property
...
...
@@ -83,7 +115,7 @@ class ShelfInsert(Boxes):
def
xSlots
(
self
):
posx
=
-
0.5
*
self
.
thickness
for
x
in
self
.
sx
[:
-
1
]:
posx
+=
x
+
self
.
thickness
posx
+=
x
+
self
.
thickness
+
self
.
Overhang_front_overhang
posy
=
0
for
y
in
self
.
sy
:
self
.
fingerHolesAt
(
posx
,
posy
,
y
)
...
...
@@ -92,7 +124,7 @@ class ShelfInsert(Boxes):
def
ySlots
(
self
):
posy
=
-
0.5
*
self
.
thickness
for
y
in
self
.
sy
[:
-
1
]:
posy
+=
y
+
self
.
thickness
posy
+=
y
+
self
.
thickness
+
self
.
Overhang_left_overhang
posx
=
0
for
x
in
reversed
(
self
.
sx
):
self
.
fingerHolesAt
(
posy
,
posx
,
x
)
...
...
@@ -110,14 +142,21 @@ class ShelfInsert(Boxes):
posy
+=
y
+
self
.
thickness
self
.
fingerHolesAt
(
posy
,
0
,
self
.
hi
)
def
handleCB
(
self
,
x
:
float
,
y
:
float
)
->
Callable
:
def
cb
(
arg
:
float
)
->
None
:
print
(
arg
)
self
.
moveTo
(
x
,
y
)
self
.
ctx
.
stroke
()
return
cb
def
render
(
self
):
if
self
.
outside
:
self
.
sx
=
self
.
adjustSize
(
self
.
sx
)
self
.
sy
=
self
.
adjustSize
(
self
.
sy
)
self
.
h
=
self
.
adjustSize
(
self
.
h
,
e2
=
False
)
x
=
sum
(
self
.
sx
)
+
self
.
thickness
*
(
len
(
self
.
sx
)
-
1
)
y
=
sum
(
self
.
sy
)
+
self
.
thickness
*
(
len
(
self
.
sy
)
-
1
)
x
=
self
.
Overhang_front_overhang
+
sum
(
self
.
sx
)
+
self
.
thickness
*
(
len
(
self
.
sx
)
-
1
)
y
=
sum
(
self
.
sy
)
+
self
.
thickness
*
(
len
(
self
.
sy
)
-
1
)
h
=
self
.
h
t
=
self
.
thickness
...
...
@@ -129,37 +168,21 @@ class ShelfInsert(Boxes):
be
=
"
f
"
if
b
!=
"
e
"
else
"
e
"
######
for
i
in
range
(
len
(
self
.
sy
)
-
1
):
#edge1 = edges.SlottedEdge(self, self.sx, be)
#print(edge1)
print
(
self
.
sx
[::
-
1
])
e
=
edges
.
SlottedEdge
(
boxes
=
self
,
sections
=
self
.
sx
[::
-
1
],
slots
=
0.5
*
h
)
#print(edge2 + "f")
# self.rectangularWall(x, h, [edge1, "f", edge2, "f"], move="up", label=f"inner x {i+1}")
#self.rectangularWall(x, h, [e, "e", "e", "e"], move="up", label=f"inner x {i+1}")
e
=
[
"
e
"
,
"
e
"
,
edges
.
SlottedEdge
(
self
,
self
.
sx
[::
-
1
],
"
f
"
,
slots
=
0.5
*
h
),
"
e
"
]
self
.
rectangularWall
(
x
,
h
,
e
,
move
=
"
up
"
,
label
=
"
x support
"
)
# inner walls
for
i
in
range
(
len
(
self
.
sx
)
-
1
):
e
=
[
edges
.
SlottedEdge
(
self
,
self
.
sy
,
be
,
slots
=
0.5
*
h
),
"
f
"
,
"
e
"
,
"
f
"
]
#self.rectangularWall(y, h, #e [e,"e","e","e"], move="up", label=f"inner y {i+1}")
# inner walls
# for i in range(len(self.sx) - 1):
# e = [edges.SlottedEdge(self, self.sy, be, slots=0.5 * hi),
# "f", "e", "f"]
# if self.closedtop and sameh:
# e = [edges.SlottedEdge(self, self.sy, be, slots=0.5 * hi),"f",
# edges.SlottedEdge(self, self.sy[::-1], "f"), "f"]
# self.rectangularWall(y, hi, e, move="up", label=f"inner y {i+1}")
self
.
rectangularWall
(
y
,
h
,
e
,
move
=
"
up
"
,
label
=
"
y support
"
)
b
=
ShelfInsert
()
b
.
parseArgs
([
'
--sx=
5
0*
4
'
,
'
--sy=
5
0*2
'
,
'
--h=26
'
,
'
--reference=0
'
,
'
--debug=0
'
])
b
.
parseArgs
([
'
--sx=
14
0*
3
'
,
'
--sy=
14
0*2
'
,
'
--h=26
'
,
'
--Overhang_front_overhang=50
'
,
'
--reference=0
'
,
'
--debug=0
'
])
b
.
open
()
b
.
render
()
data
=
b
.
close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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