-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update trussarc doit and add to gitactions * fix doit problem with numpy array --------- Co-authored-by: aradermacher <[email protected]>
- Loading branch information
1 parent
d49cec6
commit 9c3f520
Showing
7 changed files
with
275 additions
and
129 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,51 @@ | ||
# This workflow will install the environment, run the example/Wall | ||
name: trussarc | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
CACHE_NUMBER: 1 # increase to reset cache manually | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v2 | ||
- name: Setup Mambaforge | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
activate-environment: amworkflow | ||
use-mamba: true | ||
|
||
- name: Set cache date | ||
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: "/usr/share/miniconda3/envs/amworkflow" | ||
key: conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | ||
id: cache | ||
|
||
- name: Update environment | ||
run: mamba env update -n amworkflow -f environment.yml | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
|
||
- name: Install package | ||
run: git clone https://github.com/tpaviot/pythonocc-utils.git && pip install ./pythonocc-utils | ||
|
||
- name: Install amworkflow | ||
run: python -m pip install . | ||
|
||
- name: run dodo_trussarc | ||
shell: bash -l {0} #new shell | ||
run: | | ||
doit -f examples/TrussArc/dodo_trussarc.py |
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,83 @@ | ||
from pathlib import Path | ||
import datetime | ||
import logging | ||
|
||
from doit import create_after, get_var | ||
from doit.task import clean_targets | ||
from doit.tools import config_changed | ||
|
||
import pandas as pd | ||
import numpy as np | ||
|
||
from amworkflow.geometry import GeometryCenterline | ||
from amworkflow.meshing import MeshingGmsh | ||
|
||
# > doit -f <filename> # for execution of all task | ||
# > doit -f <filename> s <taskname> # for specific task | ||
# > doit -f <filename> clean # for deleting task output | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
# define required parameters | ||
params = { # geometry parameters | ||
'csv_points': 'print110823.csv', | ||
"layer_thickness": 50, # mm | ||
"number_of_layers": 10, | ||
"layer_height": 10, # mm | ||
# mesh parameters (meshing by layer height) | ||
"mesh_size_factor": 10, | ||
# .... | ||
} | ||
|
||
# TODO datastore stuff?? | ||
OUTPUT_NAME = Path(__file__).parent.name | ||
OUTPUT = Path(__file__).parent / 'output' #/ f'{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}' | ||
|
||
|
||
def task_create_design(): | ||
"""create the design of a centerline model""" | ||
|
||
OUTPUT.mkdir(parents=True, exist_ok=True) | ||
|
||
out_file_step = OUTPUT / f"{OUTPUT_NAME}.stp" | ||
out_file_stl = OUTPUT / f"{OUTPUT_NAME}.stl" | ||
out_file_points = OUTPUT / f"{OUTPUT_NAME}.csv" | ||
|
||
# load centerline points: | ||
data = pd.read_csv(Path(__file__).parent / params['csv_points'], sep=',') | ||
data['z'] = np.zeros(len(data)) # add z coordinate | ||
# print(data) | ||
# params["points"] = np.array(data[['x', 'y', 'z']]) | ||
params["points"] = list(data[['x', 'y', 'z']]) | ||
|
||
geometry = GeometryCenterline(**params) | ||
|
||
return { | ||
"actions": [(geometry.create, [out_file_step, out_file_stl, out_file_points])], | ||
"targets": [out_file_step, out_file_stl, out_file_points], | ||
"clean": [clean_targets], | ||
"uptodate": [config_changed(params)], | ||
} | ||
|
||
|
||
@create_after(executed="create_design") | ||
def task_meshing(): | ||
"""Meshing a given design from a step file.""" | ||
|
||
OUTPUT.mkdir(parents=True, exist_ok=True) | ||
|
||
in_file_step = OUTPUT / f"{OUTPUT_NAME}.stp" | ||
out_file_xdmf = OUTPUT / f"{OUTPUT_NAME}.xdmf" | ||
out_file_vtk = OUTPUT / f"{OUTPUT_NAME}.vtk" | ||
|
||
meshing = MeshingGmsh(**params) | ||
|
||
return { | ||
"file_dep": [in_file_step], | ||
"actions": [(meshing.create, [in_file_step, out_file_xdmf, out_file_vtk])], | ||
"targets": [out_file_xdmf, out_file_vtk], | ||
"clean": [clean_targets], | ||
"uptodate": [config_changed(params)], | ||
} | ||
|
||
|
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,123 @@ | ||
ID,x,y | ||
1,0.00,250.00 | ||
2,0.00,0.00 | ||
3,150.00,0.00 | ||
4,192.50,39.00 | ||
5,235.00,76.00 | ||
6,277.50,111.00 | ||
7,320.00,144.00 | ||
8,362.50,175.00 | ||
9,405.00,204.00 | ||
10,447.50,231.00 | ||
11,490.00,256.00 | ||
12,532.50,279.00 | ||
13,575.00,300.00 | ||
14,617.50,319.00 | ||
15,660.00,336.00 | ||
16,702.50,351.00 | ||
17,745.00,364.00 | ||
18,787.50,375.00 | ||
19,830.00,384.00 | ||
20,872.50,391.00 | ||
21,915.00,396.00 | ||
22,957.50,399.00 | ||
23,1000.00,400.00 | ||
24,1042.50,399.00 | ||
25,1085.00,396.00 | ||
26,1127.50,391.00 | ||
27,1170.00,384.00 | ||
28,1212.50,375.00 | ||
29,1255.00,364.00 | ||
30,1297.50,351.00 | ||
31,1340.00,336.00 | ||
32,1382.50,319.00 | ||
33,1425.00,300.00 | ||
34,1467.50,279.00 | ||
35,1510.00,256.00 | ||
36,1552.50,231.00 | ||
37,1595.00,204.00 | ||
38,1637.50,175.00 | ||
39,1680.00,144.00 | ||
40,1722.50,111.00 | ||
41,1765.00,76.00 | ||
42,1807.50,39.00 | ||
43,1850.00,0.00 | ||
44,2000.00,0.00 | ||
45,2000.00,250.00 | ||
46,1925.00,300.53 | ||
47,1850.00,347.13 | ||
48,1807.50,371.78 | ||
49,1765.00,395.17 | ||
50,1722.50,417.30 | ||
51,1680.00,438.16 | ||
52,1637.50,457.76 | ||
53,1595.00,476.09 | ||
54,1552.50,493.16 | ||
55,1510.00,508.97 | ||
56,1467.50,523.51 | ||
57,1425.00,536.78 | ||
58,1382.50,548.79 | ||
59,1340.00,559.54 | ||
60,1297.50,569.02 | ||
61,1255.00,577.24 | ||
62,1212.50,584.20 | ||
63,1170.00,589.89 | ||
64,1127.50,594.31 | ||
65,1085.00,597.47 | ||
66,1042.50,599.37 | ||
67,1021.25,599.84 | ||
68,1000.00,600.00 | ||
69,978.75,599.84 | ||
70,957.50,599.37 | ||
71,915.00,597.47 | ||
72,872.50,594.31 | ||
73,830.00,589.89 | ||
74,787.50,584.20 | ||
75,745.00,577.24 | ||
76,702.50,569.02 | ||
77,660.00,559.54 | ||
78,617.50,548.79 | ||
79,575.00,536.78 | ||
80,532.50,523.51 | ||
81,490.00,508.97 | ||
82,447.50,493.16 | ||
83,405.00,476.09 | ||
84,362.50,457.76 | ||
85,320.00,438.16 | ||
86,277.50,417.30 | ||
87,235.00,395.17 | ||
88,192.50,371.78 | ||
89,150.00,347.13 | ||
90,75.00,300.53 | ||
91,0.00,250.00 | ||
92,121.57,31.16 | ||
93,164.07,70.16 | ||
94,253.78,357.26 | ||
95,296.28,379.38 | ||
96,382.87,239.98 | ||
97,425.37,266.98 | ||
98,502.57,468.39 | ||
99,545.07,482.93 | ||
100,647.02,376.43 | ||
101,689.52,391.43 | ||
102,750.27,534.83 | ||
103,792.77,541.79 | ||
104,869.24,433.69 | ||
105,911.74,438.69 | ||
106,978.75,552.84 | ||
107,1021.25,552.84 | ||
108,1088.26,442.69 | ||
109,1130.76,437.69 | ||
110,1207.23,537.79 | ||
111,1249.73,530.83 | ||
112,1310.48,395.43 | ||
113,1352.98,380.43 | ||
114,1454.93,478.93 | ||
115,1497.43,464.39 | ||
116,1574.63,270.98 | ||
117,1617.13,243.98 | ||
118,1703.72,375.38 | ||
119,1746.22,353.26 | ||
120,1835.93,74.16 | ||
121,1878.43,35.16 | ||
122,2000.00,250.00 |
Oops, something went wrong.