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

Variable from BCLineEditPathCreate

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2019, 11:22
Default Variable from BCLineEditPathCreate
  #1
New Member
 
Join Date: Mar 2018
Posts: 3
Rep Power: 8
no_name18 is on a distinguished road
Hi there,

I'm trying to create a toolbar in ANSA that will allow me to browse for a file, select it and store the absolute path of the selected file in a new variable when i close the toolbar.
How could i create the variable with the absolute path of the selected file? I tried using guitk.BCLineEditPathSelectedFilePaths but i always get the 'None' answer.

Thank you very much!

*The code i use can be found bellow.

import ansa
from ansa import guitk
from ansa import constants

def enterpressFunction(le, data):
print("Enter pressed")
return 0

def add_function_name():
CVals_13 = ["ansa"]
TopWindow = guitk.BCWindowCreate("EqStiffness", guitk.constants.BCOnExitDestroy)
Read_data = guitk.BCFrameCreate(TopWindow)
#Read file section
BCBoxLayout_1 = guitk.BCBoxLayoutCreate(Read_data, guitk.constants.BCHorizontal)
BCLineEditPath_1 = guitk.BCLineEditPathCreate(BCBoxLayout_1, guitk.constants.BCHistoryFiles, "", guitk.constants.BCHistorySelect, "")
##Parameters for the read file box layout
guitk.BCLineEditPathAddFilter(BCLineEditPath_1, "Punch File", CVals_13)
guitk.BCLineEditPathSetSelectionMode(BCLineEditPat h_1, guitk.constants.BCMulti)
guitk.BCLineEditPathSetDialogEnterEnabled(BCLineEd itPath_1, True)
guitk.BCLineEditPathSetEnterPressedFunction(BCLine EditPath_1, enterpressFunction, None)
print(guitk.BCLineEditPathSelectedFilePaths(BCLine EditPath_1))
guitk.BCShow(TopWindow)

add_function_name()
no_name18 is offline   Reply With Quote

Reply

Tags
ansa, filepath, script, toolbar


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
OpenFoam-1.6-ext Allwmake compilation error - one last barrier Pat84 OpenFOAM Installation 15 July 25, 2012 22:49
emag beta feature: charge density charlotte CFX 4 March 22, 2011 10:14
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 05:35
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 15:49.