Esselle
Guest
mi pare funzioni
Code:' obtain reference to drawing dim odoc as document set odoc = thisapplication.activedocument if odoc.documenttype <> kdrawingdocumentobject then msgbox ("deve essere aperta una tavola") exit sub end if ' save the file with dependants odoc.save2 dim fn as string dim dwgfn as string dim pdffn as string ' generate the file names fn = odoc.fullfilename dwgfn = strings.left(fn, len(fn) - 4) & ".dwg" pdffn = strings.left(fn, len(fn) - 4) & ".pdf" ' get the dwg translator add-in. dim dwgaddin as translatoraddin set dwgaddin = thisapplication.applicationaddins.itembyid("{c24e3ac2-122e-11d5-8e91-0010b541cd80}") ' get the dxf translator add-in. dim dxfaddin as translatoraddin set dxfaddin = thisapplication.applicationaddins.itembyid("{c24e3ac4-122e-11d5-8e91-0010b541cd80}") ' get the pdf translator add-in. dim pdfaddin as translatoraddin set pdfaddin = thisapplication.applicationaddins.itembyid("{0ac6fd96-2f4d-42ce-8be0-8aea580399e4}") dim strinifile as string ' common init ' create a context object dim ocontext as translationcontext set ocontext = thisapplication.transientobjects.createtranslationcontext ocontext.type = kfilebrowseiomechanism ' create a namevaluemap object dim ooptions as namevaluemap set ooptions = thisapplication.transientobjects.createnamevaluemap ' create a datamedium object dim odatamedium as datamedium set odatamedium = thisapplication.transientobjects.createdatamedium ' --------------------------------------------------------------------------- ' dwg ' ------------------------------- ' check whether the translator has 'savecopyas' options if dwgaddin.hassavecopyasoptions(odoc, ocontext, ooptions) then ' file with exportation options strinifile = "c:\tempdwgout.ini" ' create the name-value that specifies the ini file to use. ooptions.value("export_acad_inifile") = strinifile end if 'set the destination file name odatamedium.filename = dwgfn 'publish document. call dwgaddin.savecopyas(odoc, ocontext, ooptions, odatamedium) ' ------------------------------- ' fine dwg ' --------------------------------------------------------------------------- ' --------------------------------------------------------------------------- ' pdf ' ------------------------------- ' check whether the translator has 'savecopyas' options if pdfaddin.hassavecopyasoptions(odoc, ocontext, ooptions) then ' options for drawings... ooptions.value("all_color_as_black") = 0 'ooptions.value("remove_line_weights") = 0 'ooptions.value("vector_resolution") = 400 'ooptions.value("sheet_range") = kprintallsheets 'ooptions.value("custom_begin_sheet") = 2 'ooptions.value("custom_end_sheet") = 4 end if 'set the destination file name odatamedium.filename = pdffn 'publish document. call pdfaddin.savecopyas(odoc, ocontext, ooptions, odatamedium) ' ------------------------------- ' fine pdf ' --------------------------------------------------------------------------- end sub
grazie mille! domani la provo e ti dico! gentilissimo.