Inventor Customization

Posts: 21
Registered: ‎10-07-2011
Message 1 of 3 (910 Views)
Accepted Solution

Export sheet to DWG

910 Views, 2 Replies
02-21-2012 03:47 PM

I want to save an idw drawing as a dwg but only sheet 3 of a 3 sheet set I found this snippet on the forum but cant get it to print only sheet three any help would be appriciated code is below.


' Get the DWG translator Add-In.
'Dim DWGAddIn As TranslatorAddIn
'DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

'Set a reference to the active document (the document to be published).
'Dim oDocument As Document
'oDocument = ThisApplication.ActiveDocument
'Dim oContext As TranslationContext
'oContext = ThisApplication.TransientObjects.CreateTranslationContext
'oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

' Create a NameValueMap object Dim oOptions As NameValueMap
'oOptions = ThisApplication.TransientObjects.CreateNameValueMap

' Create a DataMedium object
'Dim oDataMedium As DataMedium
'oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

' Check whether the translator has 'SaveCopyAs' options
'If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
'Dim strIniFile As String
'strIniFile = "C:\temp\DWGout.ini"
' Create the name-value that specifies the ini file to use.
'oOptions.Value("Export_Acad_IniFile") = strIniFile
'oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 3
'oOptions.Value("Custom_End_Sheet") = 3
'End If

'Set the destination file name
'oDataMedium.FileName = FilePath & "\Thumbnails\" & " UNIT " & iProperties.Value("Project", "Engineer") & ".DWG"
'DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

Posts: 33
Registered: ‎08-07-2011
Message 2 of 3 (907 Views)

Re: Export sheet to DWG

02-21-2012 05:42 PM in reply to: ByranJansen


With the VBA code, inventor supports to export the ACTIVE sheet only. Making the minor change to your code can meet your requirement.


1. Generate an ini file. Uncheck the All Sheets option in the dialog below. Click the Save Configuration ... button to save it as C:\temp\DWGout.ini (This file name is referenced in your code).

2. Prior to running your VBA code, active the sheet3. (It can be done by the VBA code)

3. Run your VBA code to export the active sheet.




Please mark this response as "Accept as Solution" if it answers your question.

Jeffrey Sun
SW Engineer
Manufacturing Industry Group
Autodesk, Inc.

Posts: 21
Registered: ‎10-07-2011
Message 3 of 3 (894 Views)

Re: Export sheet to DWG

02-22-2012 07:43 AM in reply to: jeffrey.sun

Thanks Jeffrey

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.