Export idw drawings to autocad dwg files using ilogic rules

Export idw drawings to autocad dwg files using ilogic rules

ysbaodnj
Enthusiast Enthusiast
1,014 Views
4 Replies
Message 1 of 5

Export idw drawings to autocad dwg files using ilogic rules

ysbaodnj
Enthusiast
Enthusiast

Hi,

I want to export idw drawing to autocad dwg file.

on the idw drawing screen,  file -> export -> dwg 

Is there a way to export to a dwg file using ilogic rules?

 

The source below is simply a rule to output to pdf.

Dim xlsFile As String = "C:\Temp\test\data.xlsx"
oPrintMgr
= ThisApplication.ActiveDocument.PrintManager pdfname = "filename" filePath = "C:\Temp\test"
oPrintMgr.Printer = "Microsoft Print to PDF" oPrintMgr.ColorMode = kPrintGrayScale oPrintMgr.Orientation = kLandscapeOrientation oPrintMgr.Scalemode = kCustomScale oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale oPrintMgr.PaperSize = kPaperSizeA4 oPrintMgr.PrintToFile(filePath + "\" + pdfname + ".pdf") Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument oDrawDoc.Close

 

0 Likes
Accepted solutions (1)
1,015 Views
4 Replies
Replies (4)
Message 2 of 5

petr.meduna
Advocate
Advocate
Accepted solution

There is a sample program in Autodesk Inventor API Help that solves it (in Sample programs/Translators/Export). It just needs a little translation (delete set, subs name,...).

' Get the DWG translator Add-In.
Dim DWGAddIn As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")

'Set a reference to the active document (the document to be published).
Dim oDocument As Document = ThisApplication.ActiveDocument

Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism

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

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

' Check whether the translator has 'SaveCopyAs' options
If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
	'your configuration ini file
	'Dim strIniFile As String = "C:\tempDWGOut.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 = "c:\temp\test.dwg"

'Publish document.
Call DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
0 Likes
Message 3 of 5

ysbaodnj
Enthusiast
Enthusiast

thank you I solved it thanks 🙂

0 Likes
Message 4 of 5

kwilson_design
Collaborator
Collaborator

When I try to run the code above, I'm getting this:

 

Error on line 29 in rule

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes
Message 5 of 5

Maxim-CADman77
Advisor
Advisor

You need ini file read more

Please vote for Inventor-Idea Text Search within Option Names

0 Likes