FileOpenDialog not returning selected file path

FileOpenDialog not returning selected file path

Anonymous
Not applicable
1,917 Views
2 Replies
Message 1 of 3

FileOpenDialog not returning selected file path

Anonymous
Not applicable

This question relates to API version: Revit 2019 API (RevitAPI 19.0.0.0 and RevitAPIUI 19.0.0.0).

 

Hi all,

 

When I use FileOpenDialog to let the user select a file, and when ItemSelectionDialogResult is ItemSelectionDialogResult.Confirmed, getting the actual file path does not seem possible.

 

API documentation lists GetSelectedModelPath as the method which returns ModelPath:

FileOpenDialog Members

Public methodGetSelectedModelPath
Returns the selected file path chosen by the user.
(Inherited from FileDialog)

 

However, ModelPath has no properties which actually contain the file path:

 

ModelPath Members

Public propertyCentralServerPath
A path to the location of the central Revit server.
Public propertyCloudPath
Whether this path represents a path on an Autodesk server such as BIM360.
Public propertyEmpty
Whether this path is empty
Public propertyIsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Public propertyServerPath
Whether this path is a server path (as opposed to a file path or cloud path)

 

Has this been overlooked in the API version I am using or am I missing something? 

 

Thank you.

Edit reason: cleaned up HTML

0 Likes
Accepted solutions (1)
1,918 Views
2 Replies
Replies (2)
Message 2 of 3

aignatovich
Advisor
Advisor
Accepted solution

Hi!

 

You can use ModelPathUtils.ConvertModelPathToUserVisiblePath static method to retrieve this.

Message 3 of 3

Anonymous
Not applicable

Thank you, this is exactly what I needed.