How to extract data from points along a specific line or polyline (here from a TurboChart line), where the data points locations
correspond to the locations of the intersection of the polyline with the grid points.
The procedure should be running in a CFX-Post session in batch.


Currently we do not support PERL callbacks that will return variable values on an object, however this feature has been requested for future versions of CFX.

However, another procedure is to use the following PERL script to access certain locations on a line / polyline and other variables at these positions for use in a PERL array:
* Create the polyline and an export object to extract nodal values on the line to a temporal file and read it back from the PERL script, using
"File / Export".
* For example, when exported node numbers and a single parameter value on a line, one could read in the values from the script as

use strict;
use warnings;
use FileHandle;

my $file_handle = new FileHandle;

my $file_name = "export.csv"; # assumed tmp file name
$file_handle->open("< $file_name") || die "Can't open file $file_name for reading: $!";

my $fn=qr/[-+]?[0-9]*.?[0-9]+(?:[eE][-+]?[0-9]+)?/; # float

while ( <$file_handle> ) {
my @value;
if (@value=m/s*d+s*,(?:s*$fns*,s*){3}($fn)s*$/) {
print "@value[0]n";
}
}


As a result, the positions on the line / polyline and corresponding variables are stored to PERL arrays and can be used thus later in PERL scripts.





Show Form
No comments yet. Be the first to add a comment!