Inventor Customization

Reply
Contributor
ByranJansen
Posts: 21
Registered: ‎10-07-2011
Message 1 of 3 (981 Views)
Accepted Solution

Export sheet to DWG

981 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)

 

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.

 

 

exportSheet3Only.png

Employee
jeffrey.sun
Posts: 33
Registered: ‎08-07-2011
Message 2 of 3 (978 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.

 

 

exportSheet3Only.png


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



Jeffrey Sun
SW Engineer
Manufacturing Industry Group
Autodesk, Inc.

Contributor
ByranJansen
Posts: 21
Registered: ‎10-07-2011
Message 3 of 3 (965 Views)

Re: Export sheet to DWG

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

Thanks Jeffrey

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!