Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data Standard 2014: Navigate to newly created file

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
399 Views, 4 Replies

Data Standard 2014: Navigate to newly created file

Hi,

 

I have customize the "New Standard File" command of the Vault Data Standard 2014. During the creation of the new file, I also create a new folder location for this file (within the default.ps1). After te file creation I want to navigate to the file but this doesn't seems to work.

 

Underneath you will find the code from my CreateFile.PS1:

 

# Force Refresh add command end
 $vaultContext.ForceRefresh = $true

# Define Dialog Location
 $dialog = $dsCommands.GetCreateDialog($folderId)
 $xamlFile = New-Object CreateObject.WPF.XamlFile "CreateFile", "C:\ProgramData\Autodesk\Vault 2014\Extensions\DataStandard\Vault\Configuration\File.xaml"
 $dialog.XamlFile = $xamlFile

# Execute File Dialog
 $result = $dialog.Execute()

# Get Filepath and FileID
 $folderId = $dialog.CurrentFile.FolderId
 $folder = $vault.DocumentService.GetFolderById($folderId)
 $path = $folder.FullName + "/" + $dialog.CurrentFile.Name

# Navigate to new file location
 [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Autodesk\Vault Professional 2014\Explorer\Autodesk.Connectivity.Explorer.Extensibility.dll")
 $selectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::File
 $location = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $selectionId, $path
 $vaultContext.GoToLocation = $location

 

If the file is placed in an already excisting place, the navigation will work.

I think this has something to do with the browser refresh action taking place after the GoToLocation is fired.

 

Anyone an idea how to resolve this problem?

 

Thanks in advance,

 

Peter

 

4 REPLIES 4
Message 2 of 5
marco.mirandola
in reply to: Anonymous

Hi Peter, just to make sure i got you right. You create a new folder within the default.ps1, while the Data Standard dialog is open, right? Where is the file then located, in the new folder or in the one you had selected at the moment of creation?

 

the $dsCommands.GetCreateDialog function requires the folder ID of the folder where the file should be created. Once the dialog closes, you have in $dialog.CurrentFile.FolderId the folder Id, but i'm not sure if this is still the folder ID passed to the GetCreateDialog function. if that is the case, then obviously the $vaultContext.GoToLocation goes to the original folder and not the new one.

 

in order to bring some light in here, you could do 2 simple tests:

  1. set the $path to your new folder, like $path="$/Designs/my/new/folder/fileName.Ext". this of course does not make sense to keep it like this, but you should see that the Vault UI goes exactly where you like.
  2. the other test is to activate the inspector. After the $dialog.Execute() place $dsDiag.Inspect(). this will open a little window that shows you all the variables set at this very moment. look for the $dialog and see to which folder ID the CurrentFile.FolderId is set. If it's the same as the $folderId, then it means that the same ID gets in and out.

If you post the results of these 2 tests, then we can look together for a solutions.

 

ciao

marco

 

coolOrange
www.coolorange.com
Message 3 of 5
Anonymous
in reply to: marco.mirandola

Hi Marco,

 

Yes, I'm creating a new folder in the default.PS1 when the dialog is open. The new file is put in this new folder.

 

I've forced the $Path to the fixed location, but this didn't work.

 

When I inspect the variables, the CurrentFile.FolderId is giving me the folderID of the newly created folder.

 

I've also put the $dsDiag.Inspect() just before and after the $vaultContext.GoToLocation to check what happens with the variables. I was supprised that the $vaultcontext.GoToLocation and $vaultcontext.ForceRefresh were $null.

 

I'm still thinking this is a timing issue. Is there another way to force the interface to refresh? Or do you see another cause/solution?

 

Best regards,

 

Peter

 

Message 4 of 5
marco.mirandola
in reply to: Anonymous

Hi Peter, maybe i'm still missing something. You create a new folder while the NewFile dialog is open and save the file into that new folder. As the dialog closes, you like to move directly to the new folder with the new file, right?

 

Where do you create the new folder in the Default.ps1, in which function? And how do you set the new path in the default.ps1?

 

I'm trying to reproduce your scenario, but i'm missing some pieces.

 

ciao

marco

 

coolOrange
www.coolorange.com
Message 5 of 5
Anonymous
in reply to: marco.mirandola

Hi Marco,

 

Today I had planned to create a sample project for you. But when I tested the behaviour once again, it suddenly worked. So everything is working fine.

 

Thanks for looking in to my problem.

 

Kind regards,

 

Peter

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report