Skip to content

Commit

Permalink
fix broken STL export, add contribution information
Browse files Browse the repository at this point in the history
  • Loading branch information
pkucmus committed May 10, 2022
1 parent 379e41e commit 6e79eb7
Show file tree
Hide file tree
Showing 125 changed files with 51 additions and 71 deletions.
Binary file modified database.db
Binary file not shown.
11 changes: 11 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ Sure, I'm not much of a drinker though, I also only drink coffee at home. But if

Sadly, there is no other way to sponsor EVA as platform like Patreon can't be used with the broken polish tax system... (rant redacted)

## How can I contribute or make derivatives / remixes

Remix this model on [printables.com](https://www.printables.com/model/200939-eva-3-modular-3d-printer-carriage-platform).

The rules are:

1. follow the License - to name a few:
1. attribute
2. release under the same license
2. do not remove any of the EVA logos from the parts

## What color scheme can be used?

As long as it's not purple it's fine. As everyone knows black color is the strongest but green is the fastest EVA is black/green so we have the benefits of both ;)
Expand Down
1 change: 0 additions & 1 deletion docs/stls/40mm_fan_inlet.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/40mm_fan_inlet_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/5015_inlet.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/5015_inlet_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/back_cartesian.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/back_cartesian_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/back_core_xy.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/back_core_xy_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/bl_touch_mount.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/bottom_horns.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/bottom_horns_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/bottom_horns_volcano.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/bottom_horns_volcano_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/cable_guide.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/cable_guide_mount.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/cable_guide_mount_barrel.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/cable_guide_mount_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/cartesian_belt_grabber.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/core_xy_belt_grabber.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_bmg.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_lgx.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_lgx_lite.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_orbiter_1.5.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_orbiter_1.5_fi.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_orbiter_2.0.stl

This file was deleted.

1 change: 0 additions & 1 deletion docs/stls/drive_orbiter_2.0_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/dual_5015_inlet.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/dual_5015_inlet_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/face_belt_grabber.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/front_universal.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/front_universal_fi.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/heat_insert/core/corexy/cable_guide.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/heat_insert/drive/bmg/drive_bmg.stl
Diff not rendered.
Binary file added docs/stls/heat_insert/drive/lgx/drive_lgx.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/heat_insert/shrouds/all/shroud.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/core/cartesian/cable_guide.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/core/corexy/back_core_xy.stl
Diff not rendered.
Binary file added docs/stls/hex_nuts/core/corexy/bottom_horns.stl
Diff not rendered.
Binary file added docs/stls/hex_nuts/core/corexy/cable_guide.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/core/corexy/top_endstop.stl
Diff not rendered.
Binary file added docs/stls/hex_nuts/drive/bmg/drive_bmg.stl
Diff not rendered.
Binary file added docs/stls/hex_nuts/drive/lgx/drive_lgx.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/hotend/bmo/hotend_bmo.stl
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/hotend/nova/hotend_nova.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added docs/stls/hex_nuts/shrouds/all/shroud.stl
Diff not rendered.
Binary file added docs/stls/hex_nuts/shrouds/all/shroud_chonky.stl
Diff not rendered.
Diff not rendered.
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_bmo.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_bmo_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_mosquito.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_mosquito_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_nova.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_nova_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_rapido.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/hotend_rapido_fi.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/lj8_probe_mount.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/shroud.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/shroud_chonky.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/shroud_chonky_fan_cover.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/shroud_fan_cover.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/top_endstop.stl
Diff not rendered.
1 change: 0 additions & 1 deletion docs/stls/top_endstop_fi.stl
Diff not rendered.
19 changes: 9 additions & 10 deletions src/eva_docs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@

@click.group()
@click.pass_context
# @click.option(
# "--onshape-access-key", envvar="ONSHAPE_ACCESS", prompt=True, hide_input=True
# )
# @click.option(
# "--onshape-secret-key", envvar="ONSHAPE_SECRET", prompt=True, hide_input=True
# )
# def cli(ctx, onshape_access_key, onshape_secret_key):
def cli(ctx):
@click.option(
"--onshape-access-key", envvar="ONSHAPE_ACCESS", prompt=True, hide_input=True
)
@click.option(
"--onshape-secret-key", envvar="ONSHAPE_SECRET", prompt=True, hide_input=True
)
def cli(ctx, onshape_access_key, onshape_secret_key):
mkdocs_config = config.load_config(site_dir="/tmp/eva-3d-unpack")
ctx.obj = {}
ctx.obj["mkdocs_config"] = mkdocs_config
ctx.obj["project_dir"] = Path(mkdocs_config["docs_dir"]).parent.resolve()
ctx.obj["eva_docs"] = mkdocs_config["plugins"]["eva-docs-plugin"]
ctx.obj["onshape_credentials"] = {
"access_key": "M48ljFC1VUmEv986xjM2vHUK",
"secret_key": "4AT7d2XqHOAJLmAaiSeYeiug3XAQqyLy0Ksp7GxDJ7y48F1t",
"access_key": onshape_access_key,
"secret_key": onshape_secret_key,
}
create_db_and_tables()

Expand Down
37 changes: 23 additions & 14 deletions src/eva_docs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from onshape.schemas import BOMTable


ONSHAPE_SEMAPHORE = asyncio.Semaphore(20)
ONSHAPE_SEMAPHORE = asyncio.Semaphore(10)



Expand Down Expand Up @@ -75,6 +75,7 @@ def store_bom_tables(session, bom_tables: Dict[str, BOMTable]):
session.add(
DBBOMItem(
name=item.name,
bom_name=bom_name,
material=item.material.upper(),
quantity=item.quantity,
bom_table=bom_table,
Expand Down Expand Up @@ -123,13 +124,30 @@ async def download_images(onshape_credentials, cad_links: Dict[str, str], image_
image_file.write(b64decode(b64image))



def process_stl_file(bom_name: str, stls_dir, name: str, progress):
def wrapped(future):
try:
result = future.result()
except BaseException as exc:
progress.console.print(f"[red] Error when pulling {bom_name}, file {name}: {exc}")
return
path_parts = bom_name.split(".")
stl_path = Path(stls_dir, *path_parts, f"{name}.stl").resolve()
stl_path.parent.mkdir(parents=True, exist_ok=True)
with open(stl_path, "wb") as stl_file:
stl_file.write(result)
return wrapped



async def download_stls(onshape_credentials, session, stls_dir: Path):
progress = get_progress_bar("Pulling STLs")
items = session.exec(select(DBBOMItem).where(DBBOMItem.material == "PETG")).all()
async with Onshape(**onshape_credentials) as onshape:
with progress:
progress_task = progress.add_task("", total=len(items))
tasks = {}
tasks = []
for item in items:
if item.is_printable:
task = asyncio.create_task(
Expand All @@ -145,16 +163,7 @@ async def download_stls(onshape_credentials, session, stls_dir: Path):
name=item.name
)
task.add_done_callback(advance_progress_bar_callback(progress, progress_task))
tasks[item.name] = task

await asyncio.wait(tasks.values())
task.add_done_callback(process_stl_file(item.bom_name, stls_dir, item.name, progress))
tasks.append(task)

for name, task in tasks.items():
result = await task
stl_path = (
stls_dir
/ f"{name}.stl"
).resolve()
stl_path.parent.mkdir(parents=True, exist_ok=True)
with open(stl_path, "wb") as stl_file:
stl_file.write(result)
await asyncio.gather(*tasks)
1 change: 1 addition & 0 deletions src/eva_docs/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class BOMTable(SQLModel, table=True):
class BOMItem(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str
bom_name: str
description: Optional[str]
material: str
quantity: float
Expand Down
6 changes: 5 additions & 1 deletion src/eva_docs/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@ def md_table(self, bom_table: db.BOMTable, indent: int = 0):
)
)
if item.is_printable:
url_parts = [self.config['stls_dir']]
url_parts.extend(item.bom_name.split("."))
url_parts.append(f"{item.name}.stl")
url = "/".join(url_parts)
rows.append(
f"{indent_str}| {index + 1} | {item.quantity} | [{item.name}](/{self.config['stls_dir']}/{item.name}.stl) | {self.yes_no(item.is_printable)} |"
f"{indent_str}| {index + 1} | {item.quantity} | [{item.name}](/{url}) | {self.yes_no(item.is_printable)} |"
)
else:
rows.append(
Expand Down
2 changes: 2 additions & 0 deletions src/onshape/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ async def __call(
query=query,
base_url=f"{url.scheme}://{url.netloc}",
)
elif resp.status >= 400:
raise Exception(await resp.read())
else:
return await resp.read()

Expand Down

0 comments on commit 6e79eb7

Please sign in to comment.