Filo
Guest
my need was to have a button to click to generate a dxf file from an idw file. I also did not want the dxf to be saved in the same folder as the idw file but in another same folder for all dxf files.
all you could do with ilogic and it would be easier, however, to date, I have not yet managed to create an external button to the ilogic browser.
doing some copy paste from the network and adding some of my I managed to do everything. I tested the code on inventor 2013
to see how to copy the vb code, how to add and customize a read button this debateif your need is to save the dxf file automatically or save it in the same folder as the idw file or ask you every time in which folder you have to work on the last lines of code and on the network you can find everything
Hi.
thread
all you could do with ilogic and it would be easier, however, to date, I have not yet managed to create an external button to the ilogic browser.
doing some copy paste from the network and adding some of my I managed to do everything. I tested the code on inventor 2013
Code:
public sub pubblicadxf()
' 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 dxfaddin as translatoraddin
set dxfaddin = thisapplication.applicationaddins.itembyid("{c24e3ac4-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 dxfaddin.hassavecopyasoptions(odrw, ocontext, ooptions) then
dim strinifile as string
strinifile = "tuofile.ini"
' create the name-value that specifies the ini file to use.
ooptions.value("export_acad_inifile") = strinifile
end if
' sets directory for file save
dim dxfdirectory as string
dxfdirectory = "percorso cartella di destinazione"
'set the destination file name
dim fn as string
dim fna as string
fna = odrw.displayname
fna = strings.left(fna, len(fna) - 4) & ".dxf"
fn = dxfdirectory & fna
odatamedium.filename = fn
'publish document.
call dxfaddin.savecopyas(odrw, ocontext, ooptions, odatamedium)
end sub
Hi.
thread