Macro to export only flat pattern in DXF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All!
I've got a problem, I have a macro to export pdf, dwg and dxf and I cannot figure out how to change in it to export only flat in dxf. I've been trying to change the dxf.ini file even I tried to make another sheet only with flat pattern to export only that sheet but it's not working good.
Anybody has an idea how to do it?
I'm placing here the script for dxf below:
Private Sub PublishDXF(oDocument As Document)
' Get the DXF translator Add-In.
Dim DXFAddIn As TranslatorAddIn
Set DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "C:\Projekty\Do makr\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.MediumType = kFileNameMedium
Dim filename, fullFileName, Revision As String
Dim oDocRevNo As Property
Set oDocRevNo = oDocument.PropertySets.Item("Inventor Summary Information").Item("Revision Number")
If UF1.CBsuffix.Value = True Then
Revision = " rev" + CStr(oDocRevNo.Value)
Else: Revision = ""
End If
filename = Left(oDocument.DisplayName, Len(oDocument.DisplayName) - 4)
fullFileName = MasterPath & oDocFileType & filename & Revision & ".dxf" 'MasterPath=folder o nazwie złożenia, Path= D.export
oDataMedium.filename = fullFileName
'Publish document.
Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
UF2.tbResult.Text = UF2.tbResult.Text & filename & ".dxf" & vbLf
End Sub