CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

JScript that plots lines, with input from text file - Design Modeler

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2020, 08:29
Default 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
Tim Crimson is on a distinguished road
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.
Tim Crimson is offline   Reply With Quote

Old   February 6, 2020, 10:22
Default
  #2
New Member
 
Tim Crimson
Join Date: Jan 2020
Posts: 4
Rep Power: 6
Tim Crimson is on a distinguished road
Solved with a python interface
Tim Crimson is offline   Reply With Quote

Reply

Tags
design modeler, input text file, jscript, sketch


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 35 April 29, 2022 15:35
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 08: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 18:13
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 06:47
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 06:42


All times are GMT -4. The time now is 06:52.