private void initalizeGrid() { VDF.Vault.Currency.Properties.PropertyDefinitionDictionary propDefs = vaultConnection.PropertyManager.GetPropertyDefinitions(null, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration initialConfig = new VDF.Vault.Forms.Controls.VaultBrowserControl.Configuration(vaultConnection, "VaultBrowserSample", propDefs); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Client.EntityIcon); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Client.VaultStatus); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.EntityName); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.CheckInDate); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.Comment); initialConfig.AddInitialColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.ThumbnailSystem); initialConfig.AddInitialSortCriteria(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.EntityName, true); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Client.EntityIcon); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Client.VaultStatus); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.EntityName); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.CheckInDate); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.Comment); initialConfig.AddInitialQuickListColumn(VDF.Vault.Currency.Properties.PropertyDefinitionIds.Server.ThumbnailSystem); m_model = new VDF.Vault.Forms.Models.BrowseVaultNavigationModel(vaultConnection, true, true); m_model.ParentChanged += new EventHandler(m_model_ParentChanged); m_model.SelectedContentChanged += new EventHandler <VDF.Vault.Forms.Currency.SelectionChangedEventArgs>(m_model_SelectedContentChanged); vaultBrowserControl.SetDataSource(initialConfig, m_model); vaultBrowserControl.OptionsCustomizations.CanDisplayEntityHandler = canDisplayEntity; vaultBrowserControl.OptionsBehavior.MultiSelect = false; vaultBrowserControl.OptionsBehavior.AllowOverrideSelections = false; vaultNavigationPathComboboxControl1.SetDataSource(vaultConnection, m_model, null); m_model.Navigate(vaultConnection.FolderManager.RootFolder, VDF.Vault.Forms.Currency.NavigationContext.NewContext); }
public ExportToSym(IEnumerable <Autodesk.Connectivity.Explorer.Extensibility.ISelection> selection, VDF.Vault.Currency.Connections.Connection conn) { InitializeComponent(); selectionSet = selection; connection = conn; radInterface = new RadanInterface(); radInterface.Initialize(); selectedFiles = new List <ADSK.File>(); // structure to hold list of files plus some extra attributes PartsToImport = new List <PartToImport>(); propDefs = new Vault.Currency.Properties.PropertyDefinitionDictionary(); propDefs = connection.PropertyManager.GetPropertyDefinitions( VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeUserDefined ); PopulateListBox(); txtBoxProject.Text = Properties.Settings.Default["radanProject"].ToString(); txtBoxSymFolder.Text = symFolder; }
private static DataTable setProptoCol(VDF.Vault.Currency.Properties.PropertyDefinitionDictionary propDefs, List <string> properties) { foreach (var key in propDefs.Keys) { if (allProps) { dataTable.Columns.Add(propDefs[key].DisplayName.ToString()); } else { if (properties.Contains(propDefs[key].DisplayName.ToString())) { dataTable.Columns.Add(propDefs[key].DisplayName.ToString()); } } } return(dataTable); }
public static Dictionary <string, string> PrintProperties(VDF.Vault.Currency.Connections.Connection connection, File selectedFile) { Dictionary <string, string> dict = new Dictionary <string, string>(); try { //logit.logger("DesignVisAttmtStatus: " + selectedFile.DesignVisAttmtStatus.ToString()); VDF.Vault.Currency.Entities.FileIteration fileInteration = new FileIteration(connection, selectedFile); VDF.Vault.Currency.Properties.PropertyDefinitionDictionary propDefs = connection.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); foreach (var key in propDefs.Keys) { // Print the Name from the Definition and the Value from the Property object propValue = connection.PropertyManager.GetPropertyValue(fileInteration, propDefs[key], null); dict.Add(key.ToString(), propValue == null ? "" : propValue.ToString()); //logit.logger(string.Format("== LIB 1 DICT == >> '{0}' = '{1}'", key.ToString(), propValue == null ? "" : propValue.ToString())); } } catch (SystemException ex) { //logit.logger(ex.ToString()); } return(dict); }
public static string GetVaultCheckOutComment(VDF.Vault.Currency.Entities.FileIteration selectedFile, VDF.Vault.Currency.Connections.Connection connection) { // a list of dictionaries of the vault properties of the associated files List <Dictionary <string, string> > vaultPropDictList = new List <Dictionary <string, string> >(); // function that gets properties requires a list so we'll define a list and add the selected file to it... List <VDF.Vault.Currency.Entities.FileIteration> fileList = new List <VDF.Vault.Currency.Entities.FileIteration>(); fileList.Add(selectedFile); // define a dictionary to hold all the properties pertaining to a vault entity VDF.Vault.Currency.Properties.PropertyDefinitionDictionary allPropDefDict = new VDF.Vault.Currency.Properties.PropertyDefinitionDictionary(); allPropDefDict = connection.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeAll); // define a list of only the properties that we are concerned about. List <VDF.Vault.Currency.Properties.PropertyDefinition> filteredPropDefList = new List <VDF.Vault.Currency.Properties.PropertyDefinition>(); List <string> propNames = new List <string> { "Comment" }; // copy only definitions in propNames list from allPropDefDict to filteredPropDefList foreach (string s in propNames) { VDF.Vault.Currency.Properties.PropertyDefinition propDefs = new Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyDefinition(); propDefs = allPropDefDict[s]; filteredPropDefList.Add(propDefs); } // the following line should return a list of properties VDF.Vault.Currency.Properties.PropertyValues propValues = new Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyValues(); propValues = connection.PropertyManager.GetPropertyValues(fileList, filteredPropDefList, null); VDF.Vault.Currency.Properties.PropertyDefinition def = new VDF.Vault.Currency.Properties.PropertyDefinition(propNames[0]); VDF.Vault.Currency.Properties.PropertyValue val; Dictionary <VDF.Vault.Currency.Properties.PropertyDefinition, VDF.Vault.Currency.Properties.PropertyValue> d = propValues.GetValues(selectedFile); d.TryGetValue(def, out val); string key = null; if (def != null) { key = (def.SystemName == null) ? null : def.SystemName; string value = null; if (val != null) { value = (val.Value == null) ? "" : val.Value.ToString(); return(value); } else { value = ""; } } return(null); }
// use ERP names instead of file names. private Boolean PDFfileUpdate(VDF.Vault.Currency.Entities.FileIteration fileIter, VDF.Vault.Currency.Connections.Connection connection, ref string logMessage, ref string errMessage) { try { // download the file System.IO.DirectoryInfo targetDir = new System.IO.DirectoryInfo(m_TargetFolder); if (!targetDir.Exists) { targetDir.Create(); } VDF.Vault.Settings.AcquireFilesSettings downloadSettings = new VDF.Vault.Settings.AcquireFilesSettings(connection) { LocalPath = new VDF.Currency.FolderPathAbsolute(targetDir.FullName), }; downloadSettings.AddFileToAcquire(fileIter, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download); VDF.Vault.Results.AcquireFilesResults results = connection.FileManager.AcquireFiles(downloadSettings); string fileName = downloadSettings.LocalPath.ToString() + @"\" + fileIter.ToString(); // ipts and iams are easier to deal with than idws if (fileName.EndsWith(".ipt") || fileName.EndsWith(".iam")) { PrintObject printOb = new PrintObject(); if (printOb.deletePDF(fileName, m_PDFPath, ref logMessage, ref errMessage)) { return(true); } else { return(false); } } else if (fileName.EndsWith(".idw")) // for idws we have to loop through each drawing sheet { try { string modelName = ""; // set up lists for storing the actual model names the sheets are referencing List <string> modelNames = new List <string>(); List <VDF.Vault.Currency.Entities.FileIteration> fIterations = new List <VDF.Vault.Currency.Entities.FileIteration>(); VDF.Vault.Currency.Properties.PropertyDefinitionDictionary propDefs = new VDF.Vault.Currency.Properties.PropertyDefinitionDictionary(); Inventor.ApprenticeServerComponent oApprentice = new ApprenticeServerComponent(); Inventor.ApprenticeServerDrawingDocument drgDoc; drgDoc = (Inventor.ApprenticeServerDrawingDocument)oApprentice.Document; oApprentice.Open(fileName); drgDoc = (Inventor.ApprenticeServerDrawingDocument)oApprentice.Document; ACW.PropDef[] filePropDefs = connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE"); ACW.PropDef vaultNamePropDef = filePropDefs.Single(n => n.SysName == "Name"); // for each sheet in the idw, search the vault for the sheet's corresponding ipt or iam foreach (Sheet sh in drgDoc.Sheets) { if (sh.DrawingViews.Count > 0) // I added this line because one pdf with a BOM only sheet // kept failing. This line fixed the problemf or that file // but it is definitely not well tested... { errMessage += " " + sh.DrawingViews[1].ReferencedDocumentDescriptor.DisplayName + "found"; if (sh.DrawingViews.Count > 0) { modelName = sh.DrawingViews[1].ReferencedDocumentDescriptor.DisplayName; PrintObject printOb = new PrintObject(); if (printOb.deletePDF(modelName, m_PDFPath, ref logMessage, ref errMessage)) { //logMessage += "Deleted PDF: " + pair.Value.Value.ToString() + "\r\n"; //we already logged a message in the deletePDF function } else { logMessage += logMessage; errMessage += "Can not delete PDF Error1 in function FileUpdate\r\n"; return(false); } } } } } catch (Exception ex) { logMessage += logMessage; errMessage += "Can not delete PDF Error2 in function FileUpdate\r\n" + ex.Message + "\r\n"; return(false); } } return(true); } catch (Exception) { logMessage += logMessage; errMessage += errMessage; return(false); } }