• 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

Filo

Guest
I had already read something but the search with "pdf" does not work and I looked at the first 40 pages but without success.

I created a script that automatically when saving the idw table also creates pdf, so the tables created today will always have their updated pdf... And so far it's okay.
for the old tables I have seen that there are various methods, somehow I can create pdf from the idw but the big problem I have and I do not find solution is:"How do I update the pdf of the old tables when I supply some modification? "

I don't really know how to do this.

Thank you.

Hi.
 
deh, I did a similar script and connected it to a key: When I make a change, I remember pressing it. If it is a problem related to the only old tables is a very practical solution, I speak from experience. If you are afraid to forget to export, at the end of the script (macro vba imagine) add a name of thetuofile.close() so when you want to close your file press the button of your macro, save, export and close.
Bye!
 
the solution proposed by catafract I do not like very much for two reasons, the first and most important I am not able to create a button, the second is that I should hope that also the other people of the fall snap the button to exit... the risk is too high.

Googuing a bit I found a little program that did what I was looking for, or copy a rule in all existing files thus solving my problem. the program is very complete, full of functions and not very complicated to use.

all, and so I answer also to mauro, you can find it quiHi.

ps to complete the response to mauro
the various scripts I use are not written by my fist so I do not find correct posting them here, I could post the link where I found them but sincerely I do not remember
 
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 Come copiare le macro.txtView attachment PubblicaPDF-DWG.txt
 
Now I still have a question...

Why do you put the script in "application" and not in "document"? I have always put in document on the template, so everyone on the net can see it. "application" doesn't work only locally?

Thank you.
Hi.
 
first of all there is "script" and "script": the ilogic rule is linked to the document (although there are rules outside the document itself) and I do not know it well: however it does not have contraindications.

the vba macros, however, are harmful if present in documents that are then opened in large quantities (parts and assemblies) at the same time, as it tends to crash everything. However for the tables, usually open a few at a time, there is no problem.

if macros are in the application project they are always updated at all times and for each document, while with macros in documents you can easily have many versions of the same thing. sometimes inventor changes something: fear of horror at the thought of updating not only the templates but also the old documents that must be reused.
as for multiple posts under tools> application options>file you will find the vba project file by default: all machines can point to the same file (eye only in case of changes because as long as all inventors are in operation the file goes only read)
I prefer vba because... I started using it before and now I can use it well:smile:! the main defect is that from 2014 will no longer function the autosave macros, autoclose etc. etc. that ilogic manages well, but for me it's okay.
I hope I've been clear. . .
Bye!
p.s.
specifies whether you use ilogic or vba, so you respond more precise!
 
...we will horror the thought of updating not only the templates but also the old documents that must be reused. . .
now I read on the flight then I will read more carefully Monday. cmq the program that I posted above solves prorpio this problem

Hi.
 
first of all there is "script" and "script": the ilogic rule is linked to the document (although there are rules outside the document itself) and I do not know it well: however it does not have contraindications.

................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... that ilogic manages well, but for me it's okay.
I hope I've been clear. . .
Bye!
p.s.
specifies whether you use ilogic or vba, so you respond more precise!
Azz, :frown:
question almost ot:
but wanting to migrate to 2014 of the templates that have macros with self-saving what happens, they no longer work and they must be rewritten with ilogic?
 
Azz, :frown:
question almost ot:
but wanting to migrate to 2014 of the templates that have macros with self-saving what happens, they no longer work and they must be rewritten with ilogic?
More or less... more precisely, automatic startup does not work: macros that do not call strange to windows will continue to work (or at least declares autodesk), but you have to activate them manually. alternatives are a conversion to ilogic or create an add-in (the second much more challenging than the first).
this week I make the "translocus" to 2014, I will be more precise.. .
Bye!
 
I have never used it and I have no idea how to use it! in fact your news that on 2004 there might be problems with macros worries me a little! hopefully well...

I have always used macro vbas because most of the poor programming training is based on visualbasic
...
as for multiple posts under tools> application options>file you will find the vba project file by default: all machines can point to the same file (eye only in case of changes because as long as all inventors are in operation the file goes only read)
I had never noticed that. That's why I always preferred to put it in the template. When I have a little time, I'll try to insert the macros into the project.

Hi.
 
I don't know if with this question, let's go.

the buttons created connected to a macro have all the same icon, can you change it?

Hi.
Thank you.
 
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
works that is a wonder:finger:
Thank you!
 
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
as I wrote qui code has a small kiss

hi filippo
 
I'm trying to raise the case a little bit. . .

now all idw files have the script inside them to create the pdf, but open one to one all the drawings and save them to create the pdf is long and boring... Is there anything to do this automatically?

until I write it comes to mind that I had read something, now I try

Hi.
 
if you put everything in a folder:http://modthemachine.typepad.com/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!
 
a clarification:
the system described above is obviously a little rough: if the same part is in more than one subaxieme the program, as described, would export the table several times; Perhaps before exporting it would be useful to check that there is not already pdf with the name connected. . .
 

Forum statistics

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

Members online

No members online now.
Back
Top