想找个朋友写个UG装配体中子部件下的图纸批量导出1个PDF文件中的插件,细节可以讨论,有感兴趣的朋友发信息给我加微信私聊
可以付费
import NXOpen
def export_as_pdf(assembly_file, output_pdf):
theSession = NXOpen.Session.GetSession()
workPart = theSession.Parts.Work
displayPart = theSession.Parts.Display
# 打开装配体
theSession.Parts.Open(assembly_file)
# 获取装配体对象
assembly = workPart.Parts.BaseWork
drawingSheets = assembly.DraftingSheets
# 创建PDF导出选项
pdfExportOptions = workPart.PlotManager.CreatePDFExportOptions()
pdfExportOptions.Scale = 1.0
pdfExportOptions.OutputOnePdfFile = True
pdfExportOptions.AppendToExistingFile = False
pdfExportOptions.AddSheetName = False
# 导出PDF文件
drawingSheets.ExportToPDF(output_pdf, pdfExportOptions)
# 关闭装配体
theSession.Parts.Close(NXOpen.BasePart.CloseWholeTree.True, NXOpen.BasePart.CloseModified.UseResponses, None)
assembly_file = "path/to/assembly.prt"
output_pdf = "path/to/output.pdf"
export_as_pdf(assembly_file, output_pdf)