Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[FEMAP API] Defining a disc drive location as a string

Status
Not open for further replies.

Alex2233

Mechanical
Apr 24, 2015
3
0
0
GB
Hi,

I've developed a basic api programme to capture and save pictures of output from a modal analysis. The programme orientates a deformed view of the model and saves a view of the graphics window for a defined range of output sets.

I would like the programme to allow the user to define the location that the pictures save to, using a dialogue box, but can't seem to work out how to do this.

Any help would be appreciated!

Alex
 
Replies continue below

Recommended for you

If you don't mind the dialog asking for confirmation to create the file, you can use the following:

Code:
GetFilePath$("filename", "JPEG files|*.jpg", "c:\", "Save output pictures", 1)

It will return a string with the path, but will not actually create the file (nor the starting folder).
The WinWrap helpfile explains the parameters.

Hope this helps.
 
Hi,

try these lines of codes:

Dim RefFileName As String
rc = App.feFileGetName("Give the path and name of the reference picture file","PNG file","*.png",False,RefFileName)
If rc = 2 Then End

RefFileName =Mid(RefFileName,1,InStrRev(RefFileName,"."))

Regards,

Seif Eddine Naffoussi, Stress Engineer
33650 Martillac û France
 
Thanks for the help! I've managed to get both of these suggested methods to work.

For reference, I've ended up using the following:

Dim objShell, objFolder, objFolderItem
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Select folder to write file(s)", &H1)
If objFolder Is Nothing Then
Exit Sub
Else
Set objFolderItem = objFolder.Self
ChDir(objFolderItem.Path)
End If
Set objFolderItem = Nothing : Set objFolder = Nothing : Set objShell = Nothing

I found that by changing the current directory I don't have to define the file path using the feFilePictureSave2 method which makes it easier for me to get the program to automatically name the pictures as it saves them.
 
Status
Not open for further replies.
Back
Top