This commit is contained in:
user 2024-12-10 15:52:11 +03:00
parent a2f01cd15f
commit fb0cf56db6
4 changed files with 22 additions and 10 deletions

View File

@ -74,6 +74,14 @@
"detail": "math",
"documentation": {}
},
{
"label": "k_constants",
"importPath": "project_support",
"description": "project_support",
"isExtraImport": true,
"detail": "project_support",
"documentation": {}
},
{
"label": "api5_module",
"kind": 5,

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,8 @@
import pythoncom
from win32com.client import Dispatch, gencache
import os
import math
import math
from project_support import k_constants
# Получи API интерфейсов версии 5
api5_module = gencache.EnsureModule("{0422828C-F174-495E-AC5D-D31014DBBE87}", 0, 1, 0)
@ -38,7 +39,11 @@ try:
doc_components.append(element)
else:
all_elements(element)
all_elements(doc_3d.TopPart)
if doc_type == k_constants.ksDocumentAssembly:
all_elements(doc_3d.TopPart)
else:
doc_components.append(doc_3d.TopPart)
for component in doc_components:
component_ipart = module.IPart7(component)
@ -82,15 +87,14 @@ try:
print(f"save to {doc_path}{saving_path}{filename}.cdw")
c_doc.SaveAs(f"{doc_path}{saving_path}{filename}.cdw")
spec = application.Documents.Add(k_constants.ksDocumentSpecification)
spec_doc = module.ISpecificationDocument(spec)
spec_doc.AttachedDocuments.Add(doc.PathName, True)
filename = 'Список_деталей'
print(f"save to {doc_path}{saving_path}{filename}.spw")
spec.SaveAs(f"{doc_path}{saving_path}{filename}.spw")
if doc_type == k_constants.ksDocumentAssembly:
spec = application.Documents.Add(k_constants.ksDocumentSpecification)
spec_doc = module.ISpecificationDocument(spec)
spec_doc.AttachedDocuments.Add(doc.PathName, True)
filename = 'Список_деталей'
print(f"save to {doc_path}{saving_path}{filename}.spw")
spec.SaveAs(f"{doc_path}{saving_path}{filename}.spw")
# print(doc_name)
input('Нажмите Enter для дальнейшей работы')
except Exception as e:
print(f"error with {i}")