public static string GetSwEpdRootFolderPath(string vaulName) { try { EdmVault5 vault = new EdmVault5(); vault.LoginAuto(vaulName, 0); return vault.RootFolderPath; } catch (Exception exception) { MessageBox.Show(exception.Message + "\n" + exception.StackTrace); return null; } }
public void AuthoLogin(string vaultName, bool isRelogin = false) { this.VaultName = vaultName; if (isRelogin) { edmVeult5 = null; } if (!PdmExemplar.IsLoggedIn) { edmVeult5.LoginAuto(this.VaultName, 0); } }
static void Main(string[] args) { try { var vaultSource = new EdmVault5(); vaultSource.LoginAuto("Vents-PDM", 0); var oFolder = vaultSource.GetFolderFromPath(@"E:\Vents-PDM\Проекты\Blauberg\02-01-Panels"); Console.WriteLine(oFolder.ID); var edmFile5 = vaultSource.GetFileFromPath(@"E:\Vents-PDM\Проекты\Blauberg\02-01-Panels\02-01-2-6589.sldprt", out oFolder); Console.WriteLine(edmFile5.CurrentState); edmFile5.UndoLockFile(0, true); edmFile5.GetFileCopy(0, 0, oFolder.ID, (int)EdmGetFlag.EdmGet_RefsVerLatest); oFolder.DeleteFile(0, 262953, true); Console.WriteLine("Vents-PDM"); } catch (Exception exception) { Console.WriteLine(exception.Message); Console.ReadLine(); } }
//获取用户ID public static string GetLoginID() { IEdmVault5 vault5 = new EdmVault5(); if (!vault5.IsLoggedIn) { vault5.LoginAuto(VaultName, new Control().Handle.ToInt32()); } IEdmVault11 valut11 = (IEdmVault11)vault5; return(valut11.GetLoggedInWindowsUserID(VaultName).ToString()); }
/// <summary> /// 【1】判断PDM是否登录,并返回根目录 /// </summary> public static string LoginPDM() { EdmVault5 vault5 = new EdmVault5(); if (!vault5.IsLoggedIn) { vault5.LoginAuto(VaultName, new Control().Handle.ToInt32()); } if (!vault5.IsLoggedIn) { MessageBox.Show("请先登录PDM系统!", "提示信息"); } return(RootPath = vault5.RootFolderPath.ToString()); }
public static string GetSwEpdRootFolderPath(string vaulName) { try { EdmVault5 vault = new EdmVault5(); vault.LoginAuto(vaulName, 0); return(vault.RootFolderPath); } catch (Exception exception) { MessageBox.Show(exception.Message + "\n" + exception.StackTrace); return(null); } }
public static void SetVault(string vaultName) { if (!string.IsNullOrEmpty(vaultName)) { VaultName = vaultName; _edmVault5 = null; } if (_edmVault5 == null) { _edmVault5 = new EdmVault5(); if (!_edmVault5.IsLoggedIn) { _edmVault5.LoginAuto(VaultName, 0); } } }
//判断PDM是否登录,返回布尔值True/False public static bool IsLoginPDM() { //判断PDM是否登录 try { EdmVault5 vault5 = new EdmVault5(); if (!vault5.IsLoggedIn) { vault5.LoginAuto(VaultName, new Control().Handle.ToInt32()); } return(true); } catch (Exception ex) { throw new Exception("PDM未登录或已注销,请重新登录!" + "\r\n" + ex.Message); } }
/// <summary> /// 获取当前的视图集合 /// </summary> /// <param name="_dictionaryName">字典名称,例如:SWClient</param> /// <param name="_keyName">键名称,例如:SWAddinsClientVersion</param> /// <returns>视图集合</returns> public static string GetDictionary(string _dictionaryName, string _keyName) { IEdmVault5 vault5 = new EdmVault5(); try { vault5.LoginAuto(VaultName, new Control().Handle.ToInt32()); } catch (Exception e) { throw e; } IEdmDictionary5 dic = vault5.GetDictionary(_dictionaryName, false); string value; dic.StringGetAt(_keyName, out value); //修改SOLIDWORKS插件版本信息 //dic.StringSetAt(_keyName, "1.3.0.2"); return(value); }
private void PdmLogin(object Val1) { try { //Create a file vault interface and log into a vault IEdmVault5 vault = new EdmVault5(); vault.LoginAuto("CDI Controlled Documents", 32); SearchFiles(vault, Val1); } catch (System.Runtime.InteropServices.COMException ex) { MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoginToEPDM() { if (vault5 == null) { vault5 = new EdmVault5(); vault7 = (IEdmVault7)vault5; } if (!vault5.IsLoggedIn) { try { vault5.LoginAuto("Production Vault", this.Handle.ToInt32()); } catch { MessageBox.Show("The Production Vault is Currently Unavailable"); return; } } validUser = CheckUser(); }
void CheckPdmVault() { try { if (_edmVault5 == null) { _edmVault5 = new EdmVault5(); } _edmVault7 = _edmVault5; var ok = _edmVault5.IsLoggedIn; if (!ok) { _edmVault5.LoginAuto("Vents-PDM", 0); } } catch (Exception) { // ignored } }
public void ProcessTableAnn(BomTableAnnotation swBOMTableAnn, string ConfigName, SldAsm asmPrd) { int nNumRow = 0; string ItemNumber = null; string PartNumber = null; TableAnnotation swTableAnn = (TableAnnotation)swBOMTableAnn; Console.WriteLine(" Table Title " + swTableAnn.Title); IEdmVault5 vault = new EdmVault5(); vault.LoginAuto("科德研发部", 0); if (!vault.IsLoggedIn) { Console.WriteLine("登录PDM失败"); return; } nNumRow = swTableAnn.RowCount; swBOMTableAnn = (BomTableAnnotation)swTableAnn; for (int j = 0; j < swTableAnn.RowCount; j++) { // //for (int i = 0; i < swTableAnn.ColumnCount;i++ ) // Console.WriteLine(swTableAnn.get_Text(j, i)); //获取类别和特有信息 //if (j == swTableAnn.RowCount - 1)//最后一行为标题栏,跳过 // continue; string filePath = ""; string compName = ""; string compConfig = ""; int compCount = swBOMTableAnn.GetComponentsCount2(j, ConfigName, out ItemNumber, out PartNumber); for (int i = 0; i < compCount; i++) { Component2 comp2 = swBOMTableAnn.IGetComponents2(j, ConfigName, i); if (comp2 != null) { filePath = comp2.GetPathName(); compName = comp2.Name2; compConfig = comp2.ReferencedConfiguration; Console.WriteLine(" Component Name :" + comp2.Name2 + " Configuration Name : " + comp2.ReferencedConfiguration); Console.WriteLine(" Component Path :" + comp2.GetPathName()); } } if (filePath == "") { continue; } SldBsp bsp = GetSldPrdInfoFromFile(vault, filePath); if (bsp == null) { continue; } bsp.path = filePath; //SldBsp bsp = new SldBsp(); swTableAnn.get_Text(j, 0); //序号 bsp.number = swTableAnn.get_Text(j, 1); //代号 bsp.name = swTableAnn.get_Text(j, 2); //名称 string amout = swTableAnn.get_Text(j, 3); bsp.amout = amout == ""?0:int.Parse(amout); //数量 bsp.material = swTableAnn.get_Text(j, 4); //材料 string weight = swTableAnn.get_Text(j, 5); bsp.weight = weight == "" ? 0 : int.Parse(weight); //单重 bsp.totalWeight = bsp.weight * bsp.amout; // swTableAnn.get_Text(j, 6);//总重 bsp.remark = swTableAnn.get_Text(j, 7); //备注 string number = swTableAnn.get_Text(j, 8); //测试 if (bsp.number == "") { bsp.number = number; } if (bsp is SldPrt) { asmPrd.sldPrtList.Add((SldPrt)bsp); } else if (bsp is SldStd) { asmPrd.sldStdList.Add((SldStd)bsp); } else if (bsp is SldBuy) { asmPrd.sldBuyList.Add((SldBuy)bsp); } } return; }
public IEdmVault7 LogInVault() { EdmVault5 vault = new EdmVault5(); vault.LoginAuto("NORCO_PDM", 0); return vault; }