DXF Export Inventor 2017

DXF Export Inventor 2017

Anonymous
Not applicable
1,118 Views
3 Replies
Message 1 of 4

DXF Export Inventor 2017

Anonymous
Not applicable

Hello Community,

 

I wrote a rule wich export my drawing do a dxf.

The rule worked perfect, until we updated to Inventor 2017.

 

The rule switches off/on the drawing views, depending if they exist in the assembly-this works fine.

 

Can you tell me whats wrong?

I can see, in the comand line, that an export happens, but i can t find the file, i searched my hole harddrive for it.

 

??? may a version problem?

 

Thanks for help,

 

Code attatched

 

 

Simon

 

 

SyntaxEditor Code Snippet

ActiveSheet = ThisDrawing.Sheet("Laserlayout_SELM_Sample:2")

ActiveSheet.View("ANSICHT12").View.Suppressed = True


ActiveSheet.View("ANSICHT11").View.Suppressed = False
ActiveSheet.View("ANSICHT13").View.Suppressed = False

ActiveSheet.View("ANSICHT14").View.Suppressed = False
ActiveSheet.View("ANSICHT65").View.Suppressed = False
ActiveSheet.View("ANSICHT66").View.Suppressed = False

ActiveSheet.View("ANSICHT67").View.Suppressed = False



question = MessageBox.Show("Willsch a DXF f�r da Laser speichra? Momentan ischas: "& Parameter("Teileraum.iam.SETM")& " mm" & vbCr & "Wenn alls richtig isch drucksch jo sus na", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

          'set condition based on answer
            If question = vbYes Then
         
          'gather input from user, uses current parameter as input default
            ' 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
'Set the destination file name
oDataMedium.FileName =ActiveSheet.Name &"_"& Parameter("Teileraum.iam.SELM")&"mm"&".dxf"
'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)

'oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".dxf"

          Else If question = vbNo Then
         
          'set parameter back to its original value
            Length =  tempLength
            'confirm action
            MessageBox.Show("denn halt net")
          End If










Spoiler
 

 

0 Likes
Accepted solutions (1)
1,119 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I found the file in 

 

C:\Program Files\Autodesk\Inventor 2017\Bin

 

Why?

0 Likes
Message 3 of 4

wayne.brill
Collaborator
Collaborator
Accepted solution

Hi,

 

I tried an update to your code (just so it would run) using Inventor 2016 and I get the same behavior. The file is created in "C:\Program Files\Autodesk\Inventor 2016\Bin"

 

Where was the file getting created in the previous release?

What release was that?

 

I see you have this line commented out:

oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".dxf"

 

I tried this and I see a file getting created at that location. (Although it is in a zip file)

 

If the problem is that the file is not getting saved where you want it, then I believe the solution is to provide a complete path for oDataMedium.FileName.

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 4 of 4

Anonymous
Not applicable

Hi Wayne,

 

Thanks for reply!

 

I ve created the code in Inventor 2012, may we had not the latest release.Now we work on Inventor 2017.

In the previus version the file was added to the folder wich contains the parent file, ege the .dwg........

 

 

I fit the problem by adding:

 

oDataMedium.FileName = ThisDoc.PathAndFileName(False) & "my name for it ect..."&".dxf"

 

to the oDataMedium comand line in the code. Now its working fine again.

 

 

But generally, this sounds not logical for me, because i like to get the name of the sheet that is active,not the hole

 

document....ThisDoc.PathAndFileName...(sheetname?)

 

 

In top of the rule i call the sheet i want and then fire the rule, so i get the sheet name.

 

 

Thanks for Help!!! give you a Kudo and accept your solution!!!

 

Greetings from Austria

 

 

Simon

 

 

 

 

 

 

0 Likes