ilogic to save sheets to "AutoCAD 2000/LT 2000 DXF" with model geometry only

ilogic to save sheets to "AutoCAD 2000/LT 2000 DXF" with model geometry only

wobke11
Participant Participant
386 Views
2 Replies
Message 1 of 3

ilogic to save sheets to "AutoCAD 2000/LT 2000 DXF" with model geometry only

wobke11
Participant
Participant

I've been able to copy codes from other people to create the following code which saves all sheets to DXF with filename_sheetname

I'm unsure whether its possible but I want the save copy as to be the file format "AutoCAD 2000/LT 2000 DXF" with model geometry only

 

Sub Save_As_DXF
	' 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

		'Gets the Workspace Path
		WorkspacePath= ThisDoc.WorkspacePath()

		'Gets the Length of the WorkspacePath String
		WorkspacePathLength = Len(WorkspacePath)

		'Gets just the Path of the file
		PathOnly = ThisDoc.Path

		'Removes the Workspace Path from FullPath
		DirectoryPath = Strings.Right(PathOnly, PathOnly.Length-WorkspacePathLength)
	
	' Sets directory for file save
	Dim DXFDirectory As String
	DXFDirectory = "P:\" & DirectoryPath 
	' Sets save name as iProperties value
	Dim SaveName As String
	SaveName = DXFDirectory & "\" &ThisDoc.FileName(False)  & ".dxf"	'iProperties.Value("Project", "Part Number")    ThisDoc.FileName(False)

	If Len(Dir(DXFDirectory, vbDirectory)) = 0 Then
		MkDir (DXFDirectory)
	End If

	' Check whether the translator has 'SaveCopyAs' options
	If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
	Dim strIniFile As String
	strIniFile = "\\HMI-ENGINEERING\Inventor_Data\Miscellaneous\dxf.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 = SaveName 'DXFDirectory && ".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?", "DXF Preview",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
'	If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName)
	
End Sub

 

 

0 Likes
387 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

if im not mistaken you should be able to set it all in the ini file:

\\HMI-ENGINEERING\Inventor_Data\Miscellaneous\dxf.ini

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

wobke11
Participant
Participant

Ah yes you are correct, thank you.

 

I'm unable to change the ini file defined in the ilogic code though:

\\HMI-ENGINEERING\Inventor_Data\Miscellaneous\dxf.ini

 

I've tried editing the exportdwg in public documents and it is giving me a dxf with model geometry only, but the problem is that it would not work on all the other computer without changing that ini file on all of them then...

C:\Users\Public\Documents\Autodesk\Inventor 2018\Design Data\DWG-DXF\exportdxf.ini

 

0 Likes