|
[Sponsors] |
May 7, 2014, 09:39 |
Glyph2 - getLength
|
#1 |
Member
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12 |
Hi,
I am trying to modify the pointwise/AirfoilMesh (https://github.com/pointwise/AirfoilMesh) that I don't have to choose my Airfoil by browsing it but can input a coordinates and transform it into a segment database. What I already have in my script are the Upper Surface-, Lower Surface- and the Trailing Edge-databases. Now i would like to set the names of the databases that I can use them for creating the Connectors on DatabaseEntities like in line 281-283 ind the AirfoilMesh script created by Travis Carrigan. My problem is now that i can't get the length of the curves to define the Trailing Edge like it is done in the AirfoilMesh: Code:
package require PWI_Glyph 2.17.1 #import database from x-y data file set import [pw::Application begin DatabaseImport] $import initialize -type Automatic {input of a segment file containing of 1 segment/database} $import read $import convert $import end unset import #split upper and lower+TE surface set DB_1 [pw::DatabaseEntity getByName "curve-1"] set split_params[list] lappend split_params [lindex [$DB_1 closestControlPoint[list 0.50248756218905477 0 $DB_1]] 0] set PW1 [$DB_1 split $split_params] unset split_params unset PW1 #split trailing edge and lower surface by clicking on a point set DB_2 [pw::DatabaseEntity getByName "curve-1-split-2"] set split_params[list] lappend split_params [lindex [$DB_2 closestControlPoint[list 0.98999999999999999 0 $DB_2]] 0] set PW_2 [$DB_2 split $split_params] unset split_params unset PW_2 #######Result 3 databases - US LS TE #change names of database set _DB(3) [pw::DatabaseEntity getByName "curve-1-split-1"] $_DB(3) setName "Upper Surface" set _DB(4) [pw::DatabaseEntity getByName "curve-1-split-2-split-1"] $_DB(4) setName "Lower Surface" set _DB(5) [pw::DatabaseEntity getByName "curve-1-split-2-split-2"] $_DB(5) setName "Trailing Edge" #change names of created databases set _DB(3) [pw::DatabaseEntity getByName "curve-1-split-1"] $_DB(3) setName "Upper Surface" set _DB(4) [pw::DatabaseEntity getByName "curve-1-split-2-split-1"] $_DB(4) setName "Lower Surface" set _DB(5) [pw::DatabaseEntity getByName "curve-1-split-2-split-2"] $_DB(5) setName "Trailing Edge" # Get all database entities (I am not sure which one of the following i should use - maybe the problem will be solved with the right input here) #1#set dbEnts[list $_DB(5) $_DB(4) $_DB(3)] #2#set dbEnts [pw::Database getAll] #Get the curve length of all db curves foreach db $dbEnts { lappend crvLength {$db getLength 1.0} } #Find TE from minimum curve length if{[lindex $crvLength 0] < [lindex $crvLength 1]}{ set min 0 } else{ set min 1 } if{[lindex $crvLength $min]<[lindex $crvLength 2]}{ set min $min } else{ set min 2 } set TeS [lindex $dbEnts $min] #the following commands are the same as the AirfoilMesh script Script: ----- TCL TRACE ----- Script: invalid command name "if{$db getLength 1.0" Script: while executing Script: "if{[lindex $crvLength 0] < [lindex $crvLength 1]}{" Script: (file "C:/temporary/Workstation/pointwise/pw_scripts/import_mesh_modified_07_05_1006.jrn" line 62) Script: --------------------- Info: Script C:/temporary/Workstation/pointwise/pw_scripts/import_mesh_modified_07_05_1006.jrn failed. I copied most of the commands from the AirfoilMesh where it is executing very well. So i don't know why my script isn't working. (There might be something incorrect with my databases) Can somebody explain to me what the command Code:
lappend crvLength {$db getLength 1.0} Thank you for your help. Vanessa |
|
May 7, 2014, 09:46 |
|
#2 |
Senior Member
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16 |
Hello Vanessa,
The command should be: lappend crvLength [$db getLength 1.0] Notice the use of brackets. Travis |
|
May 7, 2014, 09:51 |
|
#3 |
Senior Member
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16 |
Vanessa,
You had also asked what that function does. That function will simply populate a list, crvLength, with the lengths of the three curves defining the airfoil surface. Also, the reason the curly braces don't work for the case above is because curly braces prevent substitution from occurring. Travis |
|
May 7, 2014, 10:08 |
|
#4 |
Member
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12 |
Thank you Travis for your quick answer
The command "getLength" is a Glyph2 command, isn't it? Is there anywhere a help for the Glyph2 commands like it exists for the TCL commands? I tried to figure it out with the TCL commands but I was a bit confused because the TCL-command "length" is counting the characters in the string and not giving the length of e.g. a line. Thank you. |
|
May 7, 2014, 10:09 |
|
#5 |
Senior Member
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16 |
Yes, it is a Glyph2 command. The Glyph2 man pages can be found at http://www.pointwise.com/glyph2/file...Glyph-cxx.html
Travis |
|
May 7, 2014, 10:37 |
|
#6 |
Member
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12 |
tried to run it and the result message is:
Script: ----- TCL TRACE ----- Script: ERROR: error ending mode Script: Script: while executing Script: "$afExtrude end" Script: (file "C:/temporary/Workstation/pointwise/pw_scripts/import_mesh_modified_07_05_1006.jrn" line 149) Script: --------------------- Info: Script C:/temporary/Workstation/pointwise/pw_scripts/import_mesh_modified_07_05_1006.jrn failed When I delete the last row I get the following message: Info: Script C:/temporary/Workstation/pointwise/pw_scripts/import_mesh_modified_07_05_1006.jrn finished. The problem is, that i don't see any mesh on the screen. In my list I can see that there should be a structured domain - but I can only see the database (when I click on the domain I just select the database "lines") |
|
May 8, 2014, 09:24 |
|
#7 |
Member
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12 |
Problem solved
Everything is running very well. It was another brackets fault |
|
Tags |
airfoilmesh, getlength, glyph2, scripting pointwise |
|
|