forked from mspace912/iLogic-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDXF_PROFILE.ILOGICVB
More file actions
49 lines (44 loc) · 2.1 KB
/
DXF_PROFILE.ILOGICVB
File metadata and controls
49 lines (44 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
' 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
' Sets directory for file save
Dim DXFDirectory As String
'DXFDirectory = "\\ServerName\Shared\DXF Folder\"
DXFDirectory = ThisDoc.Path & "\DXF_Profiles"
' Sets save name as iProperties value
Dim SaveName As String
SaveName = iProperties.Value("Project", "Part Number")
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 = "Z:\Cad Setup\Inventor\Preferences\ADS\DXF Export\DXF_Export.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 = ThisDoc.PathAndFileName(False)
'oDataMedium.FileName = DXFDirectory & SaveName & ".dxf"
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
oDesc = iProperties.Value("Project", "Description")
oDataMedium.FileName = DXFDirectory & "\" & oFileName & " Rev" & oRevNum & " " & oDesc & ".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)