-
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.
- Loading branch information
Showing
40 changed files
with
610 additions
and
419 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
links: | ||
- part: bone | ||
package: example_part_cadquery_logo | ||
name: bone1 | ||
location: [[0,0,0], [0,0,1], 0] | ||
- part: bone | ||
package: example_part_cadquery_logo | ||
name: bone2 | ||
location: [[0,0,-2.5], [0,0,1], -90] | ||
- part: head_half | ||
package: example_part_cadquery_logo | ||
name: head_half_1 | ||
location: [[0,0,27.5], [0,0,1], 0] | ||
- part: head_half | ||
package: example_part_cadquery_logo | ||
name: head_half_2 | ||
location: [[0,0,25], [0,0,1], -90] | ||
- part: bolt | ||
package: example_part_step | ||
location: [[0,0,7.5], [0,0,1], 0] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
links: | ||
- part: bone | ||
package: example_part_cadquery_logo | ||
name: bone1 | ||
location: [[0,0,0], [0,0,1], 0] | ||
- part: bone | ||
package: example_part_cadquery_logo | ||
name: bone2 | ||
location: [[0,0,-2.5], [0,0,1], -90] | ||
- links: | ||
- part: head_half | ||
package: example_part_cadquery_logo | ||
name: head_half_1 | ||
location: [[0,0,2.5], [0,0,1], 0] | ||
- part: head_half | ||
package: example_part_cadquery_logo | ||
name: head_half_2 | ||
location: [[0,0,0], [0,0,1], -90] | ||
name: head | ||
location: [[0,0,25], [1,0,0], 0] | ||
- part: bolt | ||
package: example_part_step | ||
location: [[0,0,7.5], [0,0,1], 0] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
links: | ||
- package: example_part_cadquery_primitive | ||
part: cube | ||
location: [[0,0,0], [0,0,1], 0] | ||
- package: example_part_cadquery_primitive | ||
part: cylinder | ||
location: [[0,0,5], [0,0,1], 0] |
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 was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -6,6 +6,6 @@ parts: | |
render: | ||
png: | ||
prefix: ./ | ||
width: 256 | ||
width: 128 | ||
height: 128 | ||
markdown: README.md |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -10,6 +10,6 @@ parts: | |
render: | ||
png: | ||
prefix: ./ | ||
width: 256 | ||
width: 128 | ||
height: 128 | ||
markdown: README.md |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -7,6 +7,6 @@ parts: | |
render: | ||
png: | ||
prefix: ./ | ||
width: 256 | ||
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,6 @@ | ||
#!/bin/sh | ||
|
||
for i in part_* assembly_*; do | ||
echo "Rendering $i..." | ||
(cd $i && pc render) | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# | ||
# OpenVMP, 2023 | ||
# | ||
# Author: Roman Kuzmenko | ||
# Created: 2024-01-06 | ||
# | ||
# Licensed under Apache License, Version 2.0. | ||
# | ||
|
||
import build123d as b3d | ||
import copy | ||
import logging | ||
import os | ||
import yaml | ||
|
||
from .assembly import Assembly | ||
from . import assembly_factory as af | ||
|
||
|
||
class AssemblyFactoryAssy(af.AssemblyFactory): | ||
def __init__(self, ctx, project, assembly_config): | ||
super().__init__(ctx, project, assembly_config, extension=".assy") | ||
# Complement the config object here if necessary | ||
self._create(assembly_config) | ||
|
||
self.assy = {} | ||
if os.path.exists(self.path): | ||
try: | ||
self.assy = yaml.safe_load(open(self.path)) | ||
except Exception as e: | ||
logging.error("ERROR: Failed to parse the assembly file %s" % self.path) | ||
if self.assy is None: | ||
self.assy = {} | ||
else: | ||
logging.error("ERROR: Assembly file not found: %s" % self.path) | ||
|
||
if "links" in self.assy and not self.assy["links"] is None: | ||
self.handle_node_list(self.assembly, self.assy["links"]) | ||
|
||
self._save() | ||
|
||
def handle_node_list(self, assembly, node_list): | ||
for link in node_list: | ||
self.handle_node(assembly, link) | ||
|
||
def handle_node(self, assembly, node): | ||
# "name" is an optional parameter for both parts and assemblies | ||
if "name" in node: | ||
name = node["name"] | ||
else: | ||
name = None | ||
|
||
# "location" is an optional parameter for both parts and assemblies | ||
if "location" in node: | ||
l = node["location"] | ||
location = b3d.Location( | ||
(l[0][0], l[0][1], l[0][2]), (l[1][0], l[1][1], l[1][2]), l[2] | ||
) | ||
else: | ||
location = b3d.Location((0, 0, 0), (0, 0, 1), 0) | ||
|
||
# Check if this node is for an assembly | ||
if "links" in node: | ||
item = Assembly(name, node["links"]) | ||
self.handle_node_list(item, node["links"]) | ||
else: | ||
# This is a node for a part | ||
if "package" in node: | ||
package_name = node["package"] | ||
else: | ||
package_name = "this" | ||
part_name = node["part"] | ||
item = self.ctx.get_part(part_name, package_name) | ||
|
||
assembly.add(item, name, location) |
Oops, something went wrong.