spec save
This commit is contained in:
parent
231e79a135
commit
5fd4529687
|
@ -169,7 +169,7 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "api5_module = gencache.EnsureModule(\"{0422828C-F174-495E-AC5D-D31014DBBE87}\", 0, 1, 0)\napi5_api = api5_module.KompasObject(Dispatch(\"Kompas.Application.5\")._oleobj_.QueryInterface(api5_module.KompasObject.CLSID, pythoncom.IID_IDispatch))\nmodule = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:",
|
"peekOfCode": "api5_module = gencache.EnsureModule(\"{0422828C-F174-495E-AC5D-D31014DBBE87}\", 0, 1, 0)\napi5_api = api5_module.KompasObject(Dispatch(\"Kompas.Application.5\")._oleobj_.QueryInterface(api5_module.KompasObject.CLSID, pythoncom.IID_IDispatch))\nmodule = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
},
|
},
|
||||||
|
@ -178,7 +178,7 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "api5_api = api5_module.KompasObject(Dispatch(\"Kompas.Application.5\")._oleobj_.QueryInterface(api5_module.KompasObject.CLSID, pythoncom.IID_IDispatch))\nmodule = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)",
|
"peekOfCode": "api5_api = api5_module.KompasObject(Dispatch(\"Kompas.Application.5\")._oleobj_.QueryInterface(api5_module.KompasObject.CLSID, pythoncom.IID_IDispatch))\nmodule = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
},
|
},
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "module = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType",
|
"peekOfCode": "module = gencache.EnsureModule(\"{69AC2981-37C0-4379-84FD-5DD2F3C0A520}\", 0, 1, 0)\napi = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
},
|
},
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "api = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:",
|
"peekOfCode": "api = module.IKompasAPIObject(Dispatch(\"Kompas.Application.7\")._oleobj_.QueryInterface(module.IKompasAPIObject.CLSID, pythoncom.IID_IDispatch))\nk_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
},
|
},
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "k_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:\n doc.Active = True",
|
"peekOfCode": "k_constants = gencache.EnsureModule(\"{75C9F5D0-B5B8-4526-8681-9903C567D2ED}\", 0, 1, 0).constants\napplication = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
},
|
},
|
||||||
|
@ -214,7 +214,16 @@
|
||||||
"kind": 5,
|
"kind": 5,
|
||||||
"importPath": "project_support",
|
"importPath": "project_support",
|
||||||
"description": "project_support",
|
"description": "project_support",
|
||||||
"peekOfCode": "application = module.IApplication(api)\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:\n doc.Active = True\n doc_path = doc.Path",
|
"peekOfCode": "application = module.IApplication(api)\nsaving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:\n doc.Active = True",
|
||||||
|
"detail": "project_support",
|
||||||
|
"documentation": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "saving_path",
|
||||||
|
"kind": 5,
|
||||||
|
"importPath": "project_support",
|
||||||
|
"description": "project_support",
|
||||||
|
"peekOfCode": "saving_path = '../cdw/'\ntry:\n application.Visible = True\n for i in range(application.Documents.Count):\n try:\n doc = application.Documents.Open(i)\n doc_type = doc.DocumentType\n if doc_type in [k_constants.ksDocumentAssembly, k_constants.ksDocumentPart]:\n doc.Active = True\n doc_path = doc.Path",
|
||||||
"detail": "project_support",
|
"detail": "project_support",
|
||||||
"documentation": {}
|
"documentation": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ api = module.IKompasAPIObject(Dispatch("Kompas.Application.7")._oleobj_.QueryInt
|
||||||
k_constants = gencache.EnsureModule("{75C9F5D0-B5B8-4526-8681-9903C567D2ED}", 0, 1, 0).constants
|
k_constants = gencache.EnsureModule("{75C9F5D0-B5B8-4526-8681-9903C567D2ED}", 0, 1, 0).constants
|
||||||
|
|
||||||
application = module.IApplication(api)
|
application = module.IApplication(api)
|
||||||
|
saving_path = '../cdw/'
|
||||||
try:
|
try:
|
||||||
application.Visible = True
|
application.Visible = True
|
||||||
for i in range(application.Documents.Count):
|
for i in range(application.Documents.Count):
|
||||||
|
@ -75,11 +76,18 @@ try:
|
||||||
c_scale ,
|
c_scale ,
|
||||||
20, 20)
|
20, 20)
|
||||||
|
|
||||||
if not os.path.exists(f"{doc_path}../cdw/"):
|
if not os.path.exists(f"{doc_path}{saving_path}"):
|
||||||
os.makedirs(f"{doc_path}../cdw/")
|
os.makedirs(f"{doc_path}{saving_path}")
|
||||||
filename = '_'.join(filter(None, [component_ipart.Marking,c_name[:20]])).replace(' ', '-')
|
filename = '_'.join(filter(None, [component_ipart.Marking,c_name[:20]])).replace(' ', '-')
|
||||||
print(f"save to {doc_path}../cdw/{filename}.cdw")
|
print(f"save to {doc_path}{saving_path}{filename}.cdw")
|
||||||
c_doc.SaveAs(f"{doc_path}../cdw/{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")
|
||||||
|
|
||||||
|
|
||||||
# print(doc_name)
|
# print(doc_name)
|
||||||
|
|
Loading…
Reference in New Issue