Hi
Found a couple of threads about this, but no one with my problem.
I have the following code:
strFile = ThisDoc.FileName(False) & "-Rev " & iProperties.Value("Project", "Revision Number") ThisDoc.Document.SaveAs(strFile & (".dwg"), True) ThisDoc.Document.SaveAs(strFile & (".pdf"), True)
And it works like a charm for pdf, but it does not export to .dwg? Any ideas?
And also, is it possible to decide where in the name the "-Rev " &iPro....should appear?
Ex. if the filename should be : "12345 - Rev 02 - Section cut"
When you want to save to an autocad DWG you need to give iLogic more info. Normally when you do a save copy as dwg you configure to which dwg-version, what scale system and dimensionblocks and other..
First create an ini file by creating a dwg the way you want it manually and save the configuration to "C:\temp\acad.ini"
In iLogic you use this ini file. Here is the code, it's a bit more difficult than the standard save as pdf.
' Get the DWG translator Add-In.
Dim DWGAddIn As TranslatorAddIn
DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-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 = 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 DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "C:\temp\acad.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
Dim fileName As String
fileName = ThisDoc.FileName(False) & " -Rev " & iProperties.Value("Project", "Revision Number") & " Section cut "
oDataMedium.FileName = "c:\temp\" & fileName & ".dwg"
'Publish document.
Call DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
This code will save the dwg to your C:\temp, but you can change that to any location.
Hope this helps you.
Rob.