Launching 3D Viewer with filename

Phil Crompton 97 Reputation points
2020-12-15T10:32:43.59+00:00

Hi there,

I need to be able to launch 3D viewer on Windows 10/Hololens and specify the file that should be opened.

I have found the URI for launching 3D viewer (com.microsoft.3dviewer:) but what I cannot find documented anywhere is the format of the remainder of the URI for specifying the file name to open.

Ultimately I will be calling this from HTML but while trying to work out how to do it I have tried the following from the command prompt:

start com.microsoft.3dviewer:testobject.3mf
start com.microsoft.3dviewer:filename=testobject.3mf
start com.microsoft.3dviewer:file:///c:/temp/testobject.3mf
start com.microsoft.3dviewer:///c:/temp/testobject.3mf

None of the above work.

Where can I find the documentation or an example of what I want to do?

Thanks.

Phil

Developer technologies Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yan Gu - MSFT 2,676 Reputation points
    2020-12-16T08:42:56.57+00:00

    Hello,

    Welcome to Microsoft Q&A

    There is no information about how to launch the 3D Viewer with a selected file in the Launch the default app for a URI document. But you could launch the 3D Viewer app with a selected file by using the method launching the default app for a file.

    For example:

    1. You need to get the selected file by using a Windows.Storage.StorageFile object or get the file directly if the file is stored in the locations that your app can access.
    2. Use Launcher.LaunchFileAsync method to open the selected file.
    3. If 3D Viewer is not the default app which is used to open 3mf file, you could set it with the option Settings > Apps > Default apps > Choose default apps by file type, find .3mf and select 3D Viewer as the default app. Or, you could call the Windows.System.Launcher.launchFileAsync(IStorageFile, LauncherOptions) method with LauncherOptions.PreferredApplicationPackageFamilyName set to the package family name of the app in the Store that you want to recommend. Then, set the LauncherOptions.PreferredApplicationDisplayName to the name of that app.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.