-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for defining parts using STL format (#42)
- Loading branch information
Showing
9 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.step binary | ||
*.png binary | ||
*.stl binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
desc: PartCAD example project to demonstrate parts implemented using STL files | ||
parts: | ||
cube: | ||
desc: A cube defined in STL | ||
type: stl | ||
render: | ||
png: | ||
prefix: ./ | ||
width: 128 | ||
height: 128 | ||
markdown: README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# OpenVMP, 2024 | ||
# | ||
# Author: Roman Kuzmenko | ||
# Created: 2024-01-06 | ||
# | ||
# Licensed under Apache License, Version 2.0. | ||
# | ||
|
||
import build123d as b3d | ||
from . import part_factory as pf | ||
from . import part as p | ||
|
||
|
||
class PartFactoryStl(pf.PartFactory): | ||
def __init__(self, ctx, project, part_config): | ||
super().__init__(ctx, project, part_config, extension=".stl") | ||
# Complement the config object here if necessary | ||
self._create(part_config) | ||
|
||
def instantiate(self, part): | ||
shape = b3d.Mesher().read(part.path)[0].wrapped | ||
part.set_shape(shape) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters