public static bool CheckDxfExistance(IEdmVault7 vault, int IdPDM, int CurrentVersion, string fileName) { var result = true; //Get configurations var fileEdm = (IEdmFile5)vault.GetObject(EdmObjectType.EdmObject_File, IdPDM); EdmStrLst5 cfgList = default(EdmStrLst5); cfgList = fileEdm.GetConfigurations(); string cfgName = null; IEdmPos5 pos = default(IEdmPos5); pos = cfgList.GetHeadPosition(); while (!pos.IsNull) { Exception exc; cfgName = cfgList.GetNext(pos); if (cfgName != "@") { var existDxf = Dxf.ExistDxf(IdPDM, CurrentVersion, cfgName, out exc); //Logger.Add("Проверка на DXF; \n IdPDM: " + IdPDM + "\n Name: " + fileName + "\n Version: " + CurrentVersion + "\n ConfigName: " + cfgName + "\n Exist: " + existDxf); if (!existDxf) { //return result = false; } } } return(result); }
static bool ExistLastDxf(int idPdm, int currentVersion, string configuration, out Exception exc) { exc = null; bool exist; try { exist = Dxf.ExistDxf(idPdm, currentVersion, configuration, out exc); } catch (Exception) { exist = false; } return(exist); }
private void ConvertToDxf(SldWorks swApp, Files.Info item, ModelDoc2 swModel, ref Exception exOut, object[] confArray, bool IsBendsFixed) { if (!item.ExistDXF) { // Проходимся по всем конфигурациям для Fix, DXF foreach (var confName in confArray) { // Проверка на Dxf if (!item.ExistDXF) { Exception exc; if (!Dxf.ExistDxf(item.IdPDM, item.CurrentVersion, confName.ToString(), out exc)) // using export part data { swModel.ShowConfiguration2(confName.ToString()); if (!IsBendsFixed) { var list = new List <Bends.SolidWorksFixPattern.PartBendInfo>(); Bends.Fix(swApp, out list, false); // using export part data } var listDxf = new List <Dxf.DxfFile>(); if (Dxf.Save(swApp, out exOut, item.IdPDM, item.CurrentVersion, out listDxf, false, false, confName.ToString())) // using export part data { if (exOut != null) { Logger.Add(exOut.Message + "; " + exOut.StackTrace); } var exOutList = new List <Dxf.ResultList>(); Dxf.AddToSql(listDxf, true, out exOutList); if (exOutList != null) { foreach (var itemEx in exOutList) { Logger.Add($"DXF AddToSql err: {itemEx.dxfFile} Exception {itemEx.exc}"); } } } } } } } }