DXF Export code stopped working on one machine but functiones fine on others.

DXF Export code stopped working on one machine but functiones fine on others.

JMatwiejczuk32LYL
Contributor Contributor
170 Views
1 Reply
Message 1 of 2

DXF Export code stopped working on one machine but functiones fine on others.

JMatwiejczuk32LYL
Contributor
Contributor

Super weird issue where the code just osnt working anymore on my machine but it works as intended on others. Makes me think that this is an windows issues of some sorts.

 

 

Dim Time As DateTime = DateTime.Now
Dim Format As String = "yyMMdd"
Dim oPropSet As PropertySet

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oRevNum As String = oDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value

Dim oPath As String = ThisDoc.Path
Dim oFileName As String = ThisDoc.FileName(False) 'without extension

 'Get the DXF translator Add-In.  
Dim DXFAddIn As TranslatorAddIn  
DXFAddIn = 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 DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then  
Dim strIniFile As String  
strIniFile = "C:\temp\dxfout.ini"  
' Create the name-value that specifies the ini file to use.  
oOptions.Value("Export_Acad_IniFile") = strIniFile  
End If  

'get Output target folder path
oFolder = oPath & "\" & oFileName & "\"'Check for the Outputs folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
End If

'Set the destination file name  
oDataMedium.FileName = oFolder & "\" & oFileName  &  " (" & Time.ToString(Format) & ").dxf" 'same folder, or uncomment:  
'oDataMedium.FileName = "C:\myDXFfolder\" & ThisDoc.FileName(False) & ".dxf" 'fixed folder  
'Publish document.  
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)  
'Launch the dxf file in whatever application Windows is set to open this document type with  
'i = MessageBox.Show("Preview the DXF file?", "Title",MessageBoxButtons.YesNo,MessageBoxIcon.Question)  
'If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName)

 

 gives me error 

 

Error on line 44 in rule: Ex - Dated DXF, in document: PTSL-769-L-A.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)
###########################
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Inventor.TranslatorAddIn.SaveCopyAs(Object SourceObject, TranslationContext Context, NameValueMap Options, DataMedium TargetData)
   at ThisRule.Main() in external rule: Ex - Dated DXF:line 44
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

 Tried resetting Inventor settings. Wiping the working folders and redownloading the files from vault. New drawing save export also gives the same error so I am a little lost for what is happenig.

 

0 Likes
Accepted solutions (1)
171 Views
1 Reply
Reply (1)
Message 2 of 2

JMatwiejczuk32LYL
Contributor
Contributor
Accepted solution

I went file, save copy as .dxf which worked and tried running the rule again which worked with no issues.

 

I did do a inventor reset yesterday when working through a seperate issue so it looks like this has maybe reset the dxf settings when doing save copy as.

0 Likes