Awesome!! Vielen Dank! Ich konnte es zwar nicht direkt verwenden, war aber in der Lage mit dem Codeschnipsel mit Hilfe von Google das Gesuchte zu finden.
danke/gruss Bigles
Für alle die das gleiche Problem haben wie ich hatte, hier wäre der Code (funktioniert mind. auf Inventor 2011):
Public Sub PublishDWF()
'Set a reference to the AddIns collection
Dim AddIns As ApplicationAddIns
Set AddIns = ThisApplication.ApplicationAddIns
'Get the DWF translator AddIn
Dim DWFAddIn As TranslatorAddIn
Dim i As Integer
For i = 1 To AddIns.Count
If AddIns(i).AddInType = kTranslationApplicationAddIn Then
If AddIns(i).ClassIdString = "{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}" Then
Set DWFAddIn = AddIns.Item(i)
Exit For
End If
End If
Next i
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = 1
' Other options...
'oOptions.Value("Publish_Component_Props") = 0
'oOptions.Value("Publish_Mass_Props") = 0
'oOptions.Value("Password") = 0
If Typeof oDocument Is DrawingDocument Then
' Drawing options
oOptions.Value("Publish_All_Sheets") = 0
' The specified sheets will be ignored if
' the option "Publish_All_Sheets" is True (1)
Dim oSheets As NameValueMap
Set oSheets = ThisApplication.TransientObjects.CreateNameValueMap
' Publish the first sheet AND its 3D model
Dim oSheet1Options As NameValueMap
Set oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap
oSheet1Options.Add "Name", "Sheet:1"
oSheet1Options.Add "3DModel", True
oSheets.Value("Sheet1") = oSheet1Options
' Publish the third sheet but NOT its 3D model
Dim oSheet3Options As NameValueMap
Set oSheet3Options = ThisApplication.TransientObjects.CreateNameValueMap
oSheet3Options.Add "Name", "Sheet:3"
oSheet3Options.Add "3DModel", False
oSheets.Value("Sheet2") = oSheet3Options
'Set the sheet options object in the oOptions NameValueMap
oOptions.Value("Sheets") = oSheets
End If
End If
'Set the destination file name
oDataMedium.FileName = "c:\temp\test.dwf"
'Publish document.
Call DWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP