- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I was wondering if there is a way through iLogic, or API to convert each view to a seperate block while exporting a inventor IDW/DWG file to Autocad file.
Currently I'm using a iLogic method found in Autodesk help to export IDW/DWG to Autocad DWG, I have customized some code for my needs, and I was wondering if You can just write some code so the views would become blocks. I don't care about the scale, what You see is saved as blocks, one view one block, view and cross section to 2 sepatere blocks etc...
Naming of the blocks could depend on file name + sheet name + View number (not view name)
I'd prefer it to be a iLogic solution if possible at all, API is still sorcery to me.
Code I'm using for exporting to AutoCAD dwg is as follows: (code supports multiseet files)
SyntaxEditor Code Snippet
'------start of iLogic------- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") ' 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 ' Path for DWG export ini file Dim strIniFile As String strIniFile = "z:\ExportToAutoCadDWG\ExportToAutoCadDWG_nofile.ini" ' Create the name-value that specifies the ini file to use. oOptions.Value("Export_Acad_IniFile") = strIniFile End If Dim oFolder = oPath & "\DWG Acad" ' Change path in quotes to suit your needs 'Check for the file folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the DWG target file name If oRevNum = "" oDataMedium.FileName = oFolder & "\" & oFileName & ".dwg" Else 'Set the DWG target file name 'oDataMedium.FileName = oFolder & "\" & oFileName & " R" & oRevNum & ".dwg" oDataMedium.FileName = oFolder & "\" & oFileName & ".dwg" End If 'Publish document. DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) '------end of iLogic-------
Thank You for any effort 🙂
M.
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
Solved! Go to Solution.