| | |
| | | |
| | | private int bomOrder = 0; |
| | | |
| | | public ConcurrentQueue<string> needSaveList { get; set; } = new ConcurrentQueue<string>(); |
| | | |
| | | /// <summary> |
| | | /// 多线程从打开的根文档中读取BOM信息 |
| | | /// </summary> |
| | |
| | | { |
| | | return; |
| | | } |
| | | CustomPropertyUtil.ClearAllCustomProperties(sldDoc); |
| | | |
| | | Component2 rootComponent = activeConfiguration.GetRootComponent3(false); |
| | | string path = rootComponent.GetPathName(); |
| | | |
| | | CustomPropertyUtil.ClearAllCustomProperties(sldDoc, out bool needSave); |
| | | if (needSave) |
| | | { |
| | | int err = 0, warn = 0; |
| | | if (sldDoc.Save3((int)swSaveAsOptions_e.swSaveAsOptions_AvoidRebuildOnSave, ref err, ref warn)) |
| | | { |
| | | needSaveList.Enqueue(path); |
| | | } |
| | | else |
| | | { |
| | | needSaveList.Enqueue($"{path}自动保存失败,异常代码:{err}"); |
| | | } |
| | | } |
| | | |
| | | BomInfo bomInfo = GetBomInfoFromDoc(rootComponent); |
| | | PdmBom bom = ConcatCacheBom(bomInfo, 0, null, rootComponent); |
| | |
| | | { |
| | | Component2 childComponent = child as Component2; |
| | | ModelDoc2 childDoc = childComponent.GetModelDoc2(); |
| | | // 清楚格式不对的属性 |
| | | CustomPropertyUtil.ClearAllCustomProperties(childDoc); |
| | | string childPath = childComponent.GetPathName(); |
| | | // 清除格式不对的属性 |
| | | CustomPropertyUtil.ClearAllCustomProperties(childDoc, out bool needSave); |
| | | if (needSave) |
| | | { |
| | | int err = 0, warn = 0; |
| | | if (childDoc.Save3((int)swSaveAsOptions_e.swSaveAsOptions_AvoidRebuildOnSave, ref err, ref warn)) |
| | | { |
| | | needSaveList.Enqueue(childPath); |
| | | } |
| | | else |
| | | { |
| | | needSaveList.Enqueue($"{childPath}自动保存失败,异常代码:{err}"); |
| | | } |
| | | } |
| | | |
| | | PdmBom bom = null; |
| | | if (BomInfoCache.ContainsKey(childPath)) |
| | | { |
| | |
| | | CacheList = new ConcurrentQueue<PdmBom>(); |
| | | TreeList = new ConcurrentQueue<PdmBom>(); |
| | | BomInfoCache = new ConcurrentDictionary<string, BomInfo>(); |
| | | needSaveList = new ConcurrentQueue<string>(); |
| | | GetBomsFromDocAsync(doc); |
| | | return TreeList.OrderBy(e => e.name).ToList(); ; |
| | | } |
| | |
| | | ModelDoc2 doc = component.GetModelDoc2(); |
| | | // 直接用文件名,以免 SolidWorks 因为有多个相同文件而把 Name2 加了 -N 的后缀名 |
| | | string childPath = component.GetPathName(); |
| | | string childName = Path.GetFileNameWithoutExtension(childPath); |
| | | string childName = System.IO.Path.GetFileNameWithoutExtension(childPath); |
| | | |
| | | if (ModelUtil.Is_Mn(childName)) |
| | | { |