Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101666305
untitled0.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 12, 14:40
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Feb 14, 14:40 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24211197
Attached To
R11910 Additive Manufacturing Work
untitled0.py
View Options
"""
A simple example showing how to use PySLM for generating slices across a 3D model
"""
import
pyslm
import
pyslm.visualise
from
pyslm
import
hatching
as
hatching
import
numpy
as
np
# Imports the part and sets the geometry to an STL file (frameGuide.stl)
solidPart
=
pyslm
.
Part
(
'inversePyramid'
)
solidPart
.
setGeometry
(
'/home/kubilay/Documents/additive-manufacturing-work/Part_geometry/layer/layer_005.stl'
)
solidPart
.
origin
[
0
]
=
0
solidPart
.
origin
[
1
]
=
0
solidPart
.
scaleFactor
=
1.0
solidPart
.
rotation
=
[
0
,
0
,
0
]
solidPart
.
dropToPlatform
()
# Create a StripeHatcher object for performing any hatching operations
myHatcher
=
hatching
.
Hatcher
()
# Set the base hatching parameters which are generated within Hatcher
myHatcher
.
hatchAngle
=
0
myHatcher
.
volumeOffsetHatch
=
0.08
myHatcher
.
spotCompensation
=
0.06
myHatcher
.
numInnerContours
=
1
myHatcher
.
numOuterContours
=
1
myHatcher
.
hatchSortMethod
=
hatching
.
AlternateSort
()
# Set the layer thickness
layerThickness
=
0.04
# [mm]
# Perform the slicing. Return coords paths should be set so they are formatted internally.
#myHatcher.layerAngleIncrement = 66.7
#Perform the hatching operations
print
(
'Hatching Started'
)
layers
=
[]
myHatcher
.
hatchAngle
=
90
geomSlice
=
solidPart
.
getVectorSlice
(
solidPart
.
boundingBox
[
5
]
-
1e-7
)
# Hatch the boundary using myHatcher
layer
=
myHatcher
.
hatch
(
geomSlice
)
print
(
'Completed Hatching'
)
# Plot the layer geometries using matplotlib
# Note: the use of python slices to get the arrays
#pyslm.visualise.plotLayers(layers[0:-1:10])
pyslm
.
visualise
.
plot
(
layer
,
plot3D
=
False
,
plotArrows
=
True
,
plotOrderLine
=
False
,
plotColorbar
=
False
)
layer
.
getContourGeometry
()[
0
]
.
coords
Event Timeline
Log In to Comment