DXF export - SaveCopyAs vs. WriteDataToFile

DXF export - SaveCopyAs vs. WriteDataToFile

tonis_kivisild
Contributor Contributor
315 Views
3 Replies
Message 1 of 4

DXF export - SaveCopyAs vs. WriteDataToFile

tonis_kivisild
Contributor
Contributor

There seems to be two methods to exporting DXFs.

oCompDef.DataIO.WriteDataToFile(sOut, sFileName)

and

DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

The first defines all settings in the script and the latter uses the .ini file. It seems the other exports (DWG, PDF, STEP...) dont have the "WriteDataToFile" method (or do they?). Are there any restrictions for either one? Is one more universal, or is one a legacy version to avoid? Is it easier to save congigurations with either?...

 

Anyways, I'm thinking about building an add-in for exporting various types and I want to know what would be the best approach in terms of Inventor API.

 

Thanks for you help!

0 Likes
316 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @tonis_kivisild.  It depends on 'what' you are exporting to DXF, and what you will be using that DXF for.  If exporting the 'FlatPattern' of a sheet metal part, then using the DataIO.WriteDataToFile method has almost always been the most popular method for that specific task, even though initially specifying all the options within a single String variable can be very complicated to do, when you have a lot of very specific needs.  If exporting a drawing to DXF, then the TranslatorAddIn.SaveCopyAs method is usually the most popular, and simplest to specify the options.

 

Add yes...there are some restrictions.  There is usually only one TranslatorAddIn for each native/non-native file type, and it can only be used for that one thing, and it usually always requires a Document object as input, not some other Type of object.  The DataIO.WriteDataToFile method is only available for a handful of object Types, and then can only export a few very specific file types, depending on what the object is.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

WCrihfield
Mentor
Mentor

If you really want to know as much as possible about the DataIO route, then you can look at its online help documentation webpage.  You will notice down where it says 'Accessed From', it shows which object Types will have a property for getting this DataIO Type object from.  Then you will notice that it does not have any 'properties', only a few methods (Subs or Functions).  When you have a reference to an existing instance of each of those object types, and have the DataIO object from its property, you can then use the 'Get' methods to figure out which 'input' and 'output' file types, and storage types that object Type supports.  I have conducted many of those tests in the past, out of curiosity.  Once you have tested all of them, you can keep notes about which ones will export which types of files, into which storage types in your custom iLogic snippets area, or in external text files, or something like that.  Sometimes there is a small amount of documentation about which file types they will be able to import/export, but not always.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 4

CGBenner
Community Manager
Community Manager

@tonis_kivisild Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes