Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jayant Khatkar
tempaware
Commits
b061b0d9
Commit
b061b0d9
authored
Oct 11, 2021
by
Jayant Khatkar
Browse files
color visualised voxels by stress magnitude
parent
6cd53771
Changes
1
Hide whitespace changes
Inline
Side-by-side
voxelise.py
View file @
b061b0d9
...
...
@@ -106,7 +106,9 @@ def check_data(mesh_file_name, csv_fname, from_inches=False):
def
visualise_voxels
(
fname
):
data
=
pd
.
read_csv
(
fname
)
locs
=
data
.
iloc
[:,
1
:
4
].
to_numpy
()
stresses
=
np
.
sum
(
data
.
iloc
[:,
4
:].
to_numpy
()
**
2
,
axis
=
1
)
**
0.5
locs_pv
=
pv
.
PolyData
(
locs
)
locs_pv
[
'stress_mag'
]
=
stresses
locs_pv
.
plot
()
...
...
@@ -115,13 +117,13 @@ def contour2dict(c):
if
__name__
==
'__main__'
:
obj
=
'models/M
8
'
obj
=
'models/M
9
'
#check_data(obj + '.stl', obj + '_raw.csv', from_inches=True)
#out = voxelised_csv(obj + '.stl', obj + '_raw.csv', voxels=obj+'_vox_centers.csv', from_inches=True)
#out.to_csv(obj + '_voxels.csv')
#
visualise_voxels(obj + '_voxels.csv')
visualise_voxels
(
obj
+
'_voxels.csv'
)
contours
=
gc
.
decode_gcode
(
obj
+
'.gcode'
)
outfile
=
open
(
obj
+
'contours.json'
,
'w'
)
json
.
dump
([
contour2dict
(
c
)
for
c
in
contours
],
outfile
)
#
contours = gc.decode_gcode(obj + '.gcode')
#
outfile = open(obj + 'contours.json','w')
#
json.dump([contour2dict(c) for c in contours], outfile)
outfile
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment