Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romin Tomasetti
gmsh
Commits
e220fa5d
Commit
e220fa5d
authored
5 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix view tag vs. view index
parent
881a38ca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demos/api/t8.py
+10
-15
10 additions, 15 deletions
demos/api/t8.py
with
10 additions
and
15 deletions
demos/api/t8.py
+
10
−
15
View file @
e220fa5d
...
@@ -60,20 +60,18 @@ set_color("General.Text", black)
...
@@ -60,20 +60,18 @@ set_color("General.Text", black)
option
.
setNumber
(
"
General.Orthographic
"
,
0
)
option
.
setNumber
(
"
General.Orthographic
"
,
0
)
option
.
setNumber
(
"
General.Axes
"
,
0
);
option
.
setNumber
(
"
General.SmallAxes
"
,
0
)
option
.
setNumber
(
"
General.Axes
"
,
0
);
option
.
setNumber
(
"
General.SmallAxes
"
,
0
)
# set options for each view
# show the GUI
gmsh
.
fltk
.
initialize
()
# If we were to follow the geo example blindly, we would
# set options for each view
# read the number of views from the relevant option value
#
# Make sure to cast to int since getNumber returns a float
# v0 = int(option.getNumber("PostProcessing.NbViews")) - 4
# v1 = v0 + 1; v2 = v0 + 2; v3 = v0 + 3
# A nicer way is to use gmsh.view.getTags()
# If we were to follow the geo example blindly, we would read the number of
# views from the relevant option value. A nicer way is to use
# gmsh.view.getTags()
view_tags
=
[
v0
,
v1
,
v2
,
v3
]
=
gmsh
.
view
.
getTags
()
view_tags
=
[
v0
,
v1
,
v2
,
v3
]
=
gmsh
.
view
.
getTags
()
# View name format helper function
-- R
eturns "View[
X
]." for a
n input of X
# View name format helper function
: r
eturns "View[
index
]." for a
given view tag
view_fmt
=
lambda
v
:
"
View[
"
+
str
(
v
)
+
"
].
"
view_fmt
=
lambda
v
_tag
:
"
View[
"
+
str
(
gmsh
.
view
.
getIndex
(
v_tag
)
)
+
"
].
"
# option setter
# option setter
def
set_opt
(
name
,
val
):
def
set_opt
(
name
,
val
):
...
@@ -90,7 +88,7 @@ def set_opt(name, val):
...
@@ -90,7 +88,7 @@ def set_opt(name, val):
quit
(
1
)
quit
(
1
)
# We'll use this helper function for our views
# We'll use this helper function for our views
set_view_opt
=
lambda
v_
num
,
name
,
val
:
set_opt
(
view_fmt
(
v_
num
)
+
name
,
val
)
set_view_opt
=
lambda
v_
tag
,
name
,
val
:
set_opt
(
view_fmt
(
v_
tag
)
+
name
,
val
)
# v0
# v0
set_view_opt
(
v0
,
"
IntervalsType
"
,
2
)
set_view_opt
(
v0
,
"
IntervalsType
"
,
2
)
...
@@ -110,7 +108,6 @@ set_view_opt(v1, "ShowScale", 0)
...
@@ -110,7 +108,6 @@ set_view_opt(v1, "ShowScale", 0)
# v2
# v2
set_view_opt
(
v2
,
"
Name
"
,
"
Test...
"
)
set_view_opt
(
v2
,
"
Name
"
,
"
Test...
"
)
set_view_opt
(
v2
,
"
Axes
"
,
1
)
set_view_opt
(
v2
,
"
Axes
"
,
1
)
set_color
(
view_fmt
(
v2
)
+
"
Axes
"
,
black
)
set_view_opt
(
v2
,
"
IntervalsType
"
,
2
)
set_view_opt
(
v2
,
"
IntervalsType
"
,
2
)
set_view_opt
(
v2
,
"
Type
"
,
2
)
set_view_opt
(
v2
,
"
Type
"
,
2
)
set_view_opt
(
v2
,
"
IntervalsType
"
,
2
)
set_view_opt
(
v2
,
"
IntervalsType
"
,
2
)
...
@@ -153,7 +150,7 @@ for num in range(1, 4):
...
@@ -153,7 +150,7 @@ for num in range(1, 4):
adjust_num_opt
(
"
General.RotationX
"
,
10
)
adjust_num_opt
(
"
General.RotationX
"
,
10
)
set_opt
(
"
General.RotationY
"
,
option
.
getNumber
(
"
General.RotationX
"
)
/
3
)
set_opt
(
"
General.RotationY
"
,
option
.
getNumber
(
"
General.RotationX
"
)
/
3
)
adjust_num_opt
(
"
General.RotationZ
"
,
0.1
)
adjust_num_opt
(
"
General.RotationZ
"
,
0.1
)
gmsh
.
fltk
.
wait
(
0.01
)
#
open the GUI,
wait for 0.01s and resume execution
gmsh
.
fltk
.
wait
(
0.01
)
# wait for 0.01s and resume execution
gmsh
.
graphics
.
draw
()
gmsh
.
graphics
.
draw
()
# write out the graphics scene to an image file
# write out the graphics scene to an image file
...
@@ -173,7 +170,5 @@ for num in range(1, 4):
...
@@ -173,7 +170,5 @@ for num in range(1, 4):
# subprocess.call(call_ffmpeg1.split(' '))
# subprocess.call(call_ffmpeg1.split(' '))
# subprocess.call(call_ffmpeg2.split(' '))
# subprocess.call(call_ffmpeg2.split(' '))
# show the GUI at the end
gmsh
.
fltk
.
run
()
gmsh
.
fltk
.
run
()
gmsh
.
finalize
()
gmsh
.
finalize
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment