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

export table in pdf automatically

  • Thread starter Thread starter Filo
  • Start date Start date
if you put everything in a folder:http://modthemachine.typepad.com/
very interesting, now I open the file with the vb code and study a little
or if you have an open set you can use the example that there is in the inventor's help bees and make a recurring scan of all documents, check if there is the associated table, open it, export it, etc. etc.

I have a ready, I have to fix it and if you have patience...
Bye!
This solution is not the best for my needs. . .

other solutions I found are:

- use "planning utility" and plan a print using a pdf printer clicca qui(I personally don't like it much)
- paid programs to automatically launch the vb script present in the various files (I don't put the link because it is a commercial site)
- This is beautiful program (www.autohotkey.com) very complete free and opensource that allows you to do many things but that also needs a little study

Hi.
 
beer, not gratitude, thank you:tongue:
if the tutorial :mixed: for the insertion of the macros is not clear enough arrange... Uh, let me know I'm trying to improve it.
Code:
public sub pubblicapdf()
    
    ' 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
    
    
    dim odrw as drawingdocument
    set odrw = odoc
    
    ' get the pdf translator add-in.
    dim pdfaddin as translatoraddin
    set pdfaddin = thisapplication.applicationaddins.itembyid("{0ac6fd96-2f4d-42ce-8be0-8aea580399e4}")


    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

    ' check whether the translator has 'savecopyas' options
    if pdfaddin.hassavecopyasoptions(odrw, 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
    dim fn as string
    fn = odrw.fullfilename
    fn = strings.left(fn, len(fn) - 4) & ".pdf"

    odatamedium.filename = fn

    'publish document.
    call pdfaddin.savecopyas(odrw, ocontext, ooptions, odatamedium)
end sub

public sub pubblicadwg()
    
    ' 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
    
    
    dim odrw as drawingdocument
    set odrw = odoc
    ' get the dwg translator add-in.
    dim dwgaddin as translatoraddin
    set dwgaddin = thisapplication.applicationaddins.itembyid("{c24e3ac2-122e-11d5-8e91-0010b541cd80}")


    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

    ' check whether the translator has 'savecopyas' options
    if dwgaddin.hassavecopyasoptions(odrw, ocontext, ooptions) then

        dim strinifile as string
        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
    dim fn as string
    fn = odrw.fullfilename
    fn = strings.left(fn, len(fn) - 4) & ".dwg"
    odatamedium.filename = fn


    'publish document.
    call dwgaddin.savecopyas(odrw, ocontext, ooptions, odatamedium)
end sub
Note: are adaptations of the examples found in inventor's help
View attachment 34912View attachment 34913
the script works great but saves me the pdf generated in the same file folder. How can I tell him to save him in a folder of my choice?
same thing for the public dwg that I would need a lot to export any drawing (dwg or idw) in dwg 2000 following an ini file of my choice and in a always custom folder.
 
the script works great but saves me the pdf generated in the same file folder. How can I tell him to save him in a folder of my choice?
I wrote it without testing it, try to see if it works.. .
read the code and change the line where you have to give the folder path, other things as it is creates the file on the desktop
Code:
public sub pubblicapdf()

' 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


dim odrw as drawingdocument
set odrw = odoc
' get the dxf translator add-in.
dim pdfaddin as translatoraddin
set pdfaddin = thisapplication.applicationaddins.itembyid("{0ac6fd96-2f4d-42ce-8be0-8aea580399e4}")


dim ocontext as translationcontext
set ocontext = thisapplication.transientobjects.createtranslation context
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

' check whether the translator has 'savecopyas' options
if pdfaddin.hassavecopyasoptions(odrw, 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

' sets directory for file save
dim pdfdirectory as string
'la riga sottostante salva il file sul desktop se vuoi cambiare cartella cancella la riga sottostante e incolla pdfdirectory = "percorso cartella"
pdfdirectory = environ("allusersprofile") & "\desktop\"

'set the destination file name
dim fn as string
dim fna as string
dim fnb as string

fna = odrw.fullfilename
fna = strings.right(fna, len(fna) - instrrev(fna, "\"))
fnb = strings.left(fna, len(fna) - 4) & ".pdf"
fn = pdfdirectory & fnb
odatamedium.filename = fn

'publish document.
call pdfaddin.savecopyas(odrw, ocontext, ooptions, odatamedium)
end sub
same thing for the public dwg that I would need a lot to export any drawing (dwg or idw) in dwg 2000 following an ini file of my choice and in a always custom folder.
seeing the changes I made I try to change the script for the dwg...
However if you want to learn something you spend an hour of your life and learn how to use ilogic that to do these things is fine and it is easy to use.

Hi.
thread
 
Hello everyone

I exhume this old post to ask you for information in case someone has succeeded.
I "created" the script and the button in question for the export in pdf (I put it in brackets because in the 2016 version in my possession, everything was already present and so I did nothing but position the button in the command bar).
do you know if you can automate this script? In the sense, may I be able through a planned task, select for example a folder containing all idw and export it without having to open the drawing?
 

Forum statistics

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

Members online

No members online now.
Back
Top