CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > Pointwise & Gridgen

Glyph2 - getLength

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2014, 09:39
Unhappy Glyph2 - getLength
  #1
Member
 
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12
v_herw is on a distinguished road
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
The problem occurs when I try to get the length of the database with the following error:


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}
should do and why Pointwise doesn't get out the length of the database curves.


Thank you for your help.

Vanessa
v_herw is offline   Reply With Quote

Old   May 7, 2014, 09:46
Default
  #2
Senior Member
 
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16
tcarrigan is on a distinguished road
Hello Vanessa,

The command should be: lappend crvLength [$db getLength 1.0]

Notice the use of brackets.

Travis
tcarrigan is offline   Reply With Quote

Old   May 7, 2014, 09:51
Default
  #3
Senior Member
 
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16
tcarrigan is on a distinguished road
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
tcarrigan is offline   Reply With Quote

Old   May 7, 2014, 10:08
Default
  #4
Member
 
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12
v_herw is on a distinguished road
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.
v_herw is offline   Reply With Quote

Old   May 7, 2014, 10:09
Default
  #5
Senior Member
 
Travis Carrigan
Join Date: Jul 2010
Location: Arlington, TX
Posts: 161
Rep Power: 16
tcarrigan is on a distinguished road
Yes, it is a Glyph2 command. The Glyph2 man pages can be found at http://www.pointwise.com/glyph2/file...Glyph-cxx.html

Travis
tcarrigan is offline   Reply With Quote

Old   May 7, 2014, 10:37
Default
  #6
Member
 
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12
v_herw is on a distinguished road
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")
v_herw is offline   Reply With Quote

Old   May 8, 2014, 09:24
Default
  #7
Member
 
Vanessa Herwig
Join Date: May 2014
Posts: 36
Rep Power: 12
v_herw is on a distinguished road
Problem solved

Everything is running very well. It was another brackets fault
v_herw is offline   Reply With Quote

Reply

Tags
airfoilmesh, getlength, glyph2, scripting pointwise


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



All times are GMT -4. The time now is 21:40.