ilogic DWG Saving Only Active Sheet

ilogic DWG Saving Only Active Sheet

Anonymous
Not applicable
1,241 Views
1 Reply
Message 1 of 2

ilogic DWG Saving Only Active Sheet

Anonymous
Not applicable

I am running Inventor 2014.

 

I have created some ilogic rules to be able to save to a dwg & dxf file when needed. When I run the ilogic rule to save as a dwg file it exports all the sheets to dwg & puts into a compressed zip file.

 

I am wanting it to only save to dwg the active sheet not all the sheets and also i do not want it to be put into a ZIP file.

 

I have also changed the settings manually when saving to dwg by unchecking the box that selects all sheets as below.

Capture.JPG

 

Below is my ilogic:

'------start of iLogic-------
oPath = "\\Cadfileserver\Users\Desktop\dlouviere\Desktop\PDF"
oFileName = ThisDoc.FileName(False) 'without extension
oDescription = iProperties.Value("Project", "Description")
oRevision = iProperties.Value("Project", "Revision Number")

' Get the DXF translator Add-In.
oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") 

'Set a reference to the active document (the document to be published). 
oDocument = ThisApplication.ActiveDocument 
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext 
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism 

' Create a NameValueMap object 
oOptions = ThisApplication.TransientObjects.CreateNameValueMap 

' Create a DataMedium object 
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 

' Create the name-value that specifies the ini file to use. 
oOptions.Value("Export_Acad_IniFile") = strIniFile 

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\")) & "PDF"

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
 End If
 
txt1 = oDescription
txt2 = Replace(txt1,"/","_")
txt3 = Replace(txt2,"""","''")
txt4 = Replace(txt3,":","_")
NewText = txt4


'Set the destination file name
oDataMedium.FileName = oFolder & "\" & oFileName & "_r" & oRevision & " (" & NewText & ").dwg"
'oDataMedium.FileName = oFolder & "\" & oFileName & " (" & NewText & ").dwg"


'Publish document. 
oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 

'------end of iLogic-------

 

 I am pretty sure I am messing something to be able to do what I want to do. If anyone can help me with this it would be greatly appericated.

 

Thanks,

Derek

0 Likes
1,242 Views
1 Reply
Reply (1)
Message 2 of 2

Yijiang.Cai
Autodesk
Autodesk

I have walked through the code lines below, and you need to privide the value for "strIniFile". Before you use the "strIniFile", please give the value for this parameter like "strIniFile = "C:\tempDWGOut.ini"

 

How to generate the *.ini file? Please make the expected settings in the Export Destination dialog, and use Save Configuration button to generate this file. Please see the attached *.ini file as example. and you could see one line in the file as "ALL SHEETS=No".

 

Hope it works fine for you!

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Email: River-Yijiang.Cai@autodesk.com