Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VTK
VTK
Commits
d08cd68c
Commit
d08cd68c
authored
Jan 31, 2012
by
Philippe Pébay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Youngs material interface instance along with mapper/actor
Change-Id: I6105d75a8e5a45756e7bedcb602b4054d209896c
parent
ca6d081f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
Examples/Graphics/Python/YoungsMaterialInterface.py
Examples/Graphics/Python/YoungsMaterialInterface.py
+36
-15
No files found.
Examples/Graphics/Python/YoungsMaterialInterface.py
View file @
d08cd68c
...
...
@@ -10,27 +10,48 @@ VTK_DATA_ROOT = vtkGetDataRoot()
reader
=
vtkAVSucdReader
()
reader
.
SetFileName
(
VTK_DATA_ROOT
+
"/Data/UCD/UCD_00005.inp"
)
# Update reader and get cell data
# Update reader and get
mesh and
cell data
reader
.
Update
()
cellData
=
reader
.
GetOutput
().
GetCellData
()
mesh
=
reader
.
GetOutput
()
cellData
=
mesh
.
GetCellData
()
cellData
.
SetActiveScalars
(
"frac_pres[1]"
)
# Create mapper for wireframe rendering of
volume
fraction #1
m
apper
=
vtkDataSetMapper
()
m
apper
.
SetInputConnection
(
reader
.
GetOutputPort
()
)
m
apper
.
SetScalarRange
(
cellData
.
GetScalars
().
GetRange
()
)
m
apper
.
SetScalarModeToUseCellData
()
m
apper
.
SetColorModeToMapScalars
()
m
apper
.
ScalarVisibilityOn
()
# Create mapper for wireframe rendering of
material
fraction #1
fractionM
apper
=
vtkDataSetMapper
()
fractionM
apper
.
SetInputConnection
(
reader
.
GetOutputPort
()
)
fractionM
apper
.
SetScalarRange
(
cellData
.
GetScalars
().
GetRange
()
)
fractionM
apper
.
SetScalarModeToUseCellData
()
fractionM
apper
.
SetColorModeToMapScalars
()
fractionM
apper
.
ScalarVisibilityOn
()
# Create actor
a
ctor
=
vtkActor
()
a
ctor
.
SetMapper
(
m
apper
)
a
ctor
.
GetProperty
().
SetRepresentationToWireframe
()
# Create
wireframe
actor
wireA
ctor
=
vtkActor
()
wireA
ctor
.
SetMapper
(
fractionM
apper
)
wireA
ctor
.
GetProperty
().
SetRepresentationToWireframe
()
# Create renderer
# Male multiblock from input mesh
meshMB
=
vtkMultiBlockDataSet
()
meshMB
.
SetNumberOfBlocks
(
1
)
meshMB
.
GetMetaData
(
0
).
Set
(
vtkCompositeDataSet
.
NAME
(),
"Mesh"
)
meshMB
.
SetBlock
(
0
,
mesh
)
# Reconstruct material interface
interface
=
vtkYoungsMaterialInterface
()
interface
.
SetInput
(
meshMB
)
# Create mappeyr for surface rendering of reconstructed interface
interfaceMapper
=
vtkDataSetMapper
()
interfaceMapper
.
SetInputConnection
(
interface
.
GetOutputPort
()
)
# Create surface actor
surfActor
=
vtkActor
()
surfActor
.
SetMapper
(
fractionMapper
)
surfActor
.
GetProperty
().
SetRepresentationToSurface
()
# Create renderer and add actors to it
renderer
=
vtkRenderer
()
renderer
.
AddViewProp
(
actor
)
renderer
.
AddViewProp
(
wireActor
)
renderer
.
AddViewProp
(
surfActor
)
renderer
.
SetBackground
(
.
3
,
.
4
,.
5
)
# Create render window
...
...
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