Change DWXF export settings

Change DWXF export settings

ziyad_nuwayhid
Participant Participant
355 Views
2 Replies
Message 1 of 3

Change DWXF export settings

ziyad_nuwayhid
Participant
Participant

Hello everyone,


I'm currently working on an AddIn to automate the file export from Inventor. Whenever we export to DWXF the file gets opened during export which our customers don't like.
The setting for this can be found here (red circle):

DWXF_Export2.png
But how can i do this with C# Code? The export happens with one line:

Document.SaveAs(fullFileName, true);

 But for Document i found no way to change the export settings (checked here: https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-252FD608-0CA7-4D4B-BFD8-F89C0AC6AFD0 )
Is there a way to disable the settings with C# code so our users don't have to do this step?

Thanks for any help!

0 Likes
Accepted solutions (1)
356 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @ziyad_nuwayhid.  I do not use that specific export file type, but this is a pretty familiar situation, so I think I can help some here.  Instead of using the simplistic SaveAs method, you will need to use the more complex TranslatorAddIn.SaveCopyAs method, which gives you the ability to specify 'options' for the export process.  When using this method, we can 'extract' the possible 'options' internal names and their current values, as a guide to help us with writing the code for setting the options.  Below is an example iLogic rule you can use to extract those options.

Sub Main
	Dim oDoc As Inventor.Document = ThisDoc.Document
	Dim oTranslator As Inventor.TranslatorAddIn
	For Each oAppAddin As Inventor.ApplicationAddIn In ThisApplication.ApplicationAddIns
		If oAppAddin.DisplayName = "Translator: DWFx" Then
			oTranslator = oAppAddin
			If Not oTranslator.Activated Then oTranslator.Activate()
		End If
	Next
	'make sure the iLogic Log Window is visible (will show up as a tab next to iLogic tab)
	ThisApplication.UserInterfaceManager.DockableWindows.Item("ilogic.logwindow").Visible = True
	LogTranslatorOptions(oDoc, oTranslator)
End Sub

Sub LogTranslatorOptions(oDocToExp As Inventor.Document, oTransAddIn As Inventor.TranslatorAddIn)
	Dim oContext As Inventor.TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
	oContext.Type = Inventor.IOMechanismEnum.kUnspecifiedIOMechanism
	Dim oOptions As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
	Dim oReport As New System.Text.StringBuilder
	If oTransAddIn.HasSaveCopyAsOptions(oDocToExp, oContext, oOptions) Then
		Dim oItem As Integer = 1
		For Each oPair In oOptions
			oReport.AppendLine("Option Name =   " & oOptions.Name(oItem))
			oReport.AppendLine("Option Value =   " & oOptions.Value(oOptions.Name(oItem)).ToString)
			oReport.AppendLine()
			oItem = oItem + 1
		Next
	End If
	Logger.Info(vbCrLf & oReport.ToString)
End Sub

The options and their current settings may change due to what type of document is currently active when it is ran.  For me, with a 'new' part open, using Inventor 2024, I get the following results in my iLogic Log window:

(I made that 'option' Bold, and red, to simplify.)  Hint, a zero or one are often used as Boolean values, instead of True/False.

 

Option Name = Publish_All_Sheets
Option Value = 0

Option Name = Publish_3D_Models
Option Value = 0

Option Name = Launch_Viewer
Option Value = 1

Option Name = Password
Option Value =

Option Name = Publish_Mode
Option Value = 62721

Option Name = Enable_Large_Assembly_Mode
Option Value = 0

Option Name = Enable_Measure
Option Value = 1

Option Name = Enable_Printing
Option Value = 1

Option Name = Enable_Markups
Option Value = 1

Option Name = Enable_Markup_Edits
Option Value = 1

Option Name = Output_Path
Option Value =

Option Name = Include_Sheet_Tables
Option Value = 1

Option Name = Sheet_Metal_Flat_Pattern
Option Value = 0

Option Name = Sheet_Metal_Style_Information
Option Value = 0

Option Name = Sheet_Metal_Part
Option Value = 1

Option Name = Weldment_Preparation
Option Value = 0

Option Name = Weldment_Symbol
Option Value = 0

Option Name = BOM_Structured
Option Value = 1

Option Name = BOM_Parts_Only
Option Value = 1

Option Name = Animations
Option Value = 0

Option Name = Instructions
Option Value = 0

Option Name = iAssembly_All_Members
Option Value = 0

Option Name = iAssembly_3D_Models
Option Value = 0

Option Name = iPart_All_Members
Option Value = 0

Option Name = iPart_3D_Models
Option Value = 0

Option Name = Publish_Component_Props
Option Value = 1

Option Name = Publish_Mass_Props
Option Value = 1

Option Name = Include_Empty_Properties
Option Value = 0

Option Name = Publish_Screenshot
Option Value = 0

Option Name = Screenshot_DPI
Option Value = 96

Option Name = Facet_Quality
Option Value = 69379

Option Name = Force_Facet_Recompute
Option Value = 0

Option Name = Facet_Recompute_Tolerance
Option Value = 0.001

Option Name = Override_Sheet_Color
Option Value = 0

Option Name = Sheet_Color
Option Value = 0

Option Name = Sheet_Range
Option Value = 14082

Option Name = Custom_Begin_Sheet
Option Value = 1

Option Name = Custom_End_Sheet
Option Value = 1

Option Name = All_Color_AS_Black
Option Value = 0

Option Name = Remove_Line_Weights
Option Value = 0

Option Name = Vector_Resolution
Option Value = 720

Option Name = TranscriptAPICall
Option Value = 0

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

ziyad_nuwayhid
Participant
Participant
Hello WCrihfield and thank you very much 🙂
This solved my issues, we are using TranslatorAddIn.SaveCopyAs() together with the options and everything works just the way we want it to.
Thanks again!
0 Likes