|
[Sponsors] |
JScript that plots lines, with input from text file - Design Modeler |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 28, 2020, 09:29 |
JScript that plots lines, with input from text file - Design Modeler
|
#1 |
New Member
Tim Crimson
Join Date: Jan 2020
Posts: 4
Rep Power: 6 |
Hello Forum
I am trying to plot some lines in Design Modeler. For that, I run a JScript. The resulting sketch appears just like I want it, so all good in that department. The problem is that I have to define my input, which is based on three vectors, manually in the JS file, such: input_vector_1 = [111, 112, 113, 114, 115, 116]; input_vector_2 = [222, 223, 224, 225, 226, 227]; input_vector_3 = [333, 334, 335, 336, 337]; This is not the desired way of importing my input. The desired way is to read the three vectors from the following text file, called import1.txt: Header line 1 Header line 2 Header line 3 999 111 222 333 AAA AAA 999 999 AAA AAA 999 112 223 334 AAA AAA 999 999 AAA AAA 999 113 224 335 AAA AAA 999 999 AAA AAA 999 114 225 336 AAA AAA 999 999 AAA AAA 999 115 226 337 AAA AAA 999 999 AAA AAA 999 116 227 999 AAA AAA 999 999 AAA AAA I am thinking of defining in the JS code something like file_name='import1.txt'; and then the name of the import text file would be the only thing that I need to change if I wanted to define a different geometry. I just can't figure out how to make it work to read this textfile and assign my three vectors, or if this is even possible. In Matlab this is super simple, but here it seems to be really tricky. If some special environment is necessary in order to read text files in JS, that is not supported in the Design Modeler compiler, please let me know and kindly suggest me a way around. But it would be really nice if there was a way to read these three columns in JS. All the best! /T. |
|
February 6, 2020, 11:22 |
|
#2 |
New Member
Tim Crimson
Join Date: Jan 2020
Posts: 4
Rep Power: 6 |
Solved with a python interface
|
|
Tags |
design modeler, input text file, jscript, sketch |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using PengRobinsonGas EoS with sprayFoam | Jabo | OpenFOAM Running, Solving & CFD | 36 | July 16, 2024 04:52 |
how to calculate mass flow rate on patches and summation of that during the run? | immortality | OpenFOAM Post-Processing | 104 | February 16, 2021 09:46 |
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 | ordinary | OpenFOAM Installation | 19 | September 3, 2019 19:13 |
OpenFoam "Permission denied" and "command not found" problems. | iyidaniel@yahoo.co.uk | OpenFOAM Running, Solving & CFD | 11 | January 2, 2018 07:47 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 07:42 |