Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export sheet to DWG

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
3090 Views, 2 Replies

Export sheet to DWG

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)

2 REPLIES 2
Message 2 of 3
jeffrey.sun
in reply to: Anonymous

 

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.

Tags (1)
Message 3 of 3
Anonymous
in reply to: jeffrey.sun

Thanks Jeffrey

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report