Hi,
I'm implementing DataStandard in our company and have used the 2022 Quick start templates as a starting point.
On the CAD side I have now configured and got things working quite well as I want it too but the shortcut and breadcrumb (last saved path) doesn't work for some reason. Attached is a screenshot with the log window enabled. As far as I can analyze it it seems the problem is to do with the Folder2022.xml file template. Perhaps the formatting of that file is wrong?
<?xml version="1.0" encoding="UTF-8"?>
<VDSUserProfile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.autodesk.com/msd/plm/Shortcuts/2004-08-16">
<Vaults>
<Vault Name="SURFCLEANER-VAULT">
<Project Number="" Title="TEST">
</Project>
<LastUsedFolderInv cmbBreadCrumb_0="Designs" cmbBreadCrumb_1="" cmbBreadCrumb_2="" cmbBreadCrumb_3="">
</LastUsedFolderInv>
<LastUsedFolderAcad cmbBreadCrumb_0="Designs" cmbBreadCrumb_1="" cmbBreadCrumb_2="" cmbBreadCrumb_3="">
</LastUsedFolderAcad>
</Vault>
</Vaults>
<Shortcut Name="Template">
<NavigationContext URI="vaultfolderpath:$/CADRoot/ProjectFolder/SubFolder1/SubFolder2" />
<NavigationContextType>Connectivity.Explorer.Document.DocFolder</NavigationContextType>
<ImageMetaData>TAG=FolderColor [A=255, R=255, G=255, B=255],DATA=iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACxAAAAsQAa0jvXUAAACPSURBVDhPpdPBCoMwDIDhvpYnr3usPuZAYco2RMpWqTjFCrFBKEtJGXGHr4em/Je2CgD+wm5KqKK86AA46WEOBsAOjpUGEzoGrlXLwtnqPQtnMZDj/caGEc5jAA9y6tsjiwSaeydGAs/OiJFAb95iJPCyTowE3DiJkcBnXsRIYA1XJvUdyP6FH46njMt5oHY4CRnCj5qtlAAAAABJRU5ErkJggg==</ImageMetaData>
</Shortcut>
</VDSUserProfile>
The path ".../AppData/Local/Temp/Folder2022.xml" is a print-out of the path to the file that receives the shortcut addition, I have verified the file exists and I have write permissions to it.
function mAddShortCutByName([STRING] $mScName)
{
try #simply check that the name is unique
{
$dsDiag.Trace(">> Start to add ShortCut, check for used name...")
$global:m_ScCAD.Add($mScName,"Dummy")
$global:m_ScCAD.Remove($mScName)
}
catch #no reason to continue in case of existing name
{
[System.Windows.MessageBox]::Show($UIString["MSDCE_MSG01"], "VDS MFG Sample Client")
end function
}
try
{
$dsDiag.Trace(">> Continue to add ShortCut, creating new from template...")
#read from template
$m_File = $env:TEMP + "\Folder2022.xml"
$dsDiag.Trace($m_File)
if (Test-Path $m_File)
{
$dsDiag.Trace(">>-- Started to read Folder2022.xml...")
$global:m_XML = New-Object XML
$global:m_XML.Load($m_File)
}
$mShortCut = $global:m_XML.Folder.Shortcut | where { $_.Name -eq "Template"}
#clone the template completely and update name attribute and navigationcontext element
$mNewSc = $mShortCut.Clone() #.CloneNode($true)
#rename "Template" to new name
$mNewSc.Name = $mScName
#derive the path from current selection
$breadCrumb = $dsWindow.FindName("BreadCrumb")
$newURI = "vaultfolderpath:" + $global:CAx_Root
foreach ($cmb in $breadCrumb.Children)
{
$_N = $cmb.SelectedItem.Name
$dsDiag.Trace(" - selecteditem.Name of cmb: $_N ")
if (($cmb.SelectedItem.Name.Length -gt 0) -and !($cmb.SelectedItem.Name -eq "."))
{
$newURI = $newURI + "/" + $cmb.SelectedItem.Name
$dsDiag.Trace(" - the updated URI of the shortcut: $newURI")
}
else { break}
}
#hand over the path in shortcut navigation format
$mNewSc.NavigationContext.URI = $newURI
#append the new shortcut and save back to file
$mImpNode = $global:m_ScXML.ImportNode($mNewSc,$true)
$global:m_ScXML.Shortcuts.AppendChild($mImpNode)
$global:m_ScXML.Save($mScFile)
$dsWindow.FindName("txtNewShortCut").Text = ""
$dsDiag.Trace("..successfully added ShortCut <<")
return $true
}
catch
{
$dsDiag.Trace("..problem encountered adding ShortCut <<")
return $false
}
}
Happy for any help on this issue.
Best regards,
Fredrik
Solved! Go to Solution.
Solved by Markus.Koechl. Go to Solution.
Hi Fredrik, probably you ran into an issue that I fixed on May 4th: https://github.com/koechlm/VDS-Sample-Configuration-2022/blob/db3e3c8900d6b5935448bc66a5b3e484f20e9c.... The fix is not implemented in a released configuration package, but you could grab it from the link.
I hope this resolves your issue.
Hi Markus,
Unfortunately that didn't resolve the problem. I copied the contents of the updated breadCrumb file you linked to and replaced it with the one I'm using (also did a diffcheck to see it all got copied correctly). I seemingly get the same result/error. I think default.ps1 works down to the following lines but something fails after:
if (Test-Path $m_File)
{
$dsDiag.Trace(">>-- Started to read Folder2022.xml...")
$global:m_XML = New-Object XML
$global:m_XML.Load($m_File)
$dsDiag.Trace(">> File read successfully: Folder2022.xml...")
}
I have attached the "default.ps1" file that I'm working on, perhaps you can see what is the problem? Thanks in advance.
Best,
Fredrik
Beautiful! Now it works! Thank you so much Markus.
Attached is the updated *Default.ps1 file
Have a nice evening.
/F
Can't find what you're looking for? Ask the community or share your knowledge.