• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

create new macro folder

samurai76

Guest
hi to everyone, sorry but to avoid confusion I opened another discussion by linking me to the following:
https://www.cad3d.it/forum1/threads/esportazione-automatica-idw-to-pdf-dxf.42618/I am using the macros to export idw files in pdf and dxf and it works perfectly (ringrazio cataphrase) but now I'd need a laziness. I would like to create, in the directory where the idw is, a subfolder (e.g. ...\dxf-pdf... although not present) in which to save the output of the macro.
what can do the code below (I don't remember where and edited to doc) inserted as a rule in ilogic but I can't enter the macro above.
Code:
syntaxeditor code snippetopath = thisdoc.path
ofilename = thisdoc.filename(false) 'without extension
'orevnum = iproperties.value("project", "revision number")
'orevnum = iproperties.value("project", "checked by")
opdfaddin = thisapplication.applicationaddins.itembyid _
("{0ac6fd96-2f4d-42ce-8be0-8aea580399e4}")
odocument = thisapplication.activedocument
ocontext = thisapplication.transientobjects.createtranslationcontext
ocontext.type = iomechanismenum.kfilebrowseiomechanism
ooptions = thisapplication.transientobjects.createnamevaluemap
odatamedium = thisapplication.transientobjects.createdatamedium 
currentdate = string.format("{0: mm.dd.yyyy}",datetime.now)

if opdfaddin.hassavecopyasoptions(odocument, ocontext, ooptions) then
ooptions.value("all_color_as_black") = 0
ooptions.value("remove_line_weights") = 1
ooptions.value("vector_resolution") = 400
ooptions.value("sheet_range") = inventor.printrangeenum.kprintallsheets
'ooptions.value("custom_begin_sheet") = 2'ooptions.value("custom_end_sheet") = 4
end if 

'get pdf target folder path
ofolder = thisdoc.path & "\pdfs" 'instead of "k:\dwg\pdf\"

'check for the pdf folder and create it if it does not exist
if not system.io.directory.exists(ofolder) then
    system.io.directory.createdirectory(ofolder)
end if

 'set the pdf target file name
odatamedium.filename = ofolder & "\" & ofilename & _
"_rev" & currentdate & ".pdf" 

'publish document
opdfaddin.savecopyas(odocument, ocontext, ooptions, odatamedium)
thanks for availability
samuele
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top