Message 1 of 1
idw to dwf single sheet
Not applicable
01-25-2016
09:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can't seem to plot a single sheet, named or range via Inventor API. I have tried all possible settings (). PDF turns out fine, but DWFx is consistently wrong.
nothing I put here works
options.Value("Publish_All_Sheets") = 0
options.Value("Custom_Begin_Sheet") = 2
options.Value("Custom_End_Sheet") = 2
options.Value("Publish_Mode") = 62722
options.Value("Sheet_Range") = 14083
Publish_mode = 62721,62722 or 62723, Sheet_Range= 14081, 14082 or 14083.
Tried to add
Public Sub GetTranslatorSaveAsOptions()
' Using GUID of the DWF Translator
Dim mApp As Inventor.Application
Set mApp = ThisApplication
Dim clsId As String
clsId = "{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}"
Dim clsIdDwfx As String
clsIdDwfx = "{0AC6FD97-2F4D-42CE-8BE0-8AEA580399E4}"
Dim oTranslator As TranslatorAddIn
Set oTranslator = mApp.ApplicationAddIns.ItemById(clsId)
Dim oTranslatorDwfx As TranslatorAddIn
Set oTranslatorDwfx = mApp.ApplicationAddIns.ItemById(clsIdDwfx)
Dim context As TranslationContext
Set context = mApp.TransientObjects.CreateTranslationContext
context.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim options As NameValueMap
Set options = mApp.TransientObjects.CreateNameValueMap
Dim SourceObject As Object
Set SourceObject = mApp.ActiveDocument
Dim oData As Inventor.DataMedium
Set oData = mApp.TransientObjects.CreateDataMedium
oData.FileName = "c:\temp\file2.pdf"
Dim oDatadwfx As Inventor.DataMedium
Set oDatadwfx = mApp.TransientObjects.CreateDataMedium
oDatadwfx.FileName = "c:\temp\file2.dwfx"
options.Value("Publish_All_Sheets") = 0
options.Value("Custom_Begin_Sheet") = 2
options.Value("Custom_End_Sheet") = 2
options.Value("Publish_Mode") = 62722
options.Value("Sheet_Range") = 14083
Call oTranslator.SaveCopyAs(SourceObject, context, options, oData)
Call oTranslatorDwfx.SaveCopyAs(SourceObject, context, options, oDatadwfx)
Dim index As Integer
If oTranslator.HasSaveCopyAsOptions _
(SourceObject, context, options) Then
On Error Resume Next
For index = 1 To options.Count
Debug.Print (options.Name(index) & " = " & options.Value(options.Name(index)))
Next
On Error GoTo 0
End If
End Sub
tried to add this, but no difference.
Dim oSheets As Inventor.NameValueMap
Set oSheets = ThisApplication.TransientObjects.CreateNameValueMap
Dim oSheet1Options As Inventor.NameValueMap
Set oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap
oSheet1Options.Add "Name", "dwfx:2"
oSheets.Value("Sheet1") = oSheet1Options
options.Value("Sheets") = oSheets