Skip to content

Commit 5a561c6

Browse files
authored
fix(tutorials): fix data_arrays.rst tutorial for 25R2 and older (#2530)
1 parent c3f1da6 commit 5a561c6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/source/user_guide/tutorials/data_structures/data_arrays.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,14 @@ You can also create a |Field|, |StringField| or |PropertyField| from scratch bas
224224
# Set the data values
225225
my_property_field.data = [12, 25]
226226
# Set the location
227-
my_property_field.location = dpf.locations.modal
228-
# Set the element IDs
227+
# For DPF 26R1 and above, directly set the location of the PropertyField
228+
from ansys.dpf.core.check_version import meets_version
229+
if meets_version(dpf.SERVER.version, "11.0"):
230+
my_property_field.location = dpf.locations.modal
231+
# For DPF older than 26R1, you must set the location with a Scoping
232+
else:
233+
my_property_field.scoping = dpf.Scoping(location=dpf.locations.modal)
234+
# Set the mode IDs
229235
my_property_field.scoping.ids = [1, 2]
230236
# Print the property field
231237
print(my_property_field)

0 commit comments

Comments
 (0)