iLogic idw to dwg fatal error

iLogic idw to dwg fatal error

rsilvers
Explorer Explorer
271 Views
1 Reply
Message 1 of 2

iLogic idw to dwg fatal error

rsilvers
Explorer
Explorer

I've written this iLogic that will convert any open IDW to a DWG file.

Problem is when run this rule and have 15+ files open, it crashes half way thru.

Not sure why and I don't get any messages, just the Autodesk has crashed send in the report message.

Below is the code... anyone have any ideas?

 

Dim oDoc As Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments

If oDoc Is Nothing Then
	MsgBox("Missing Inventor Document")
	Exit Sub
End If

Try
	Dim ThisApp = ThisApplication
	Dim TransObj As TransientObjects = ThisApp.TransientObjects
	If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
		MessageBox.Show("This Rule must be run from within a Drawing Document.", "Incorrect Document Type")
		Exit Sub
	End If
	Catch
	MessageBox.Show("Error Getting Document Information" & vbCr & "Is the current Document Saved?", "Document Error")
End Try
	
oFileName = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) 'without extension
	
'MessageBox.Show(oFileName, "Title")

oDoc.SaveAs(System.IO.Path.ChangeExtension(oDoc.FullFileName, ".dwg") , True)
'MessageBox.Show(oFileName & ".dwg  Saved!! " & vbCrLf & vbCrLf & ThisDoc.Path , "Save As")
oDoc.Activate
Next
0 Likes
272 Views
1 Reply
Reply (1)
Message 2 of 2

ianteneth
Advocate
Advocate

Hi @rsilvers,

 

This rule works for me in Inventor 2020. I ran it on 33 empty (no views) IDWs and it made 33 empty DWGs. Maybe the issue is with exporting a particular drawing or views? Is it crashing on the same IDW everytime? Are you testing it on the same IDWs everytime?

 

On a side note I would surround the line where you actually export the IDW in a Try/Catch block or skip to the next IDW on error. Also, what are these lines for? They don't seem to be necessary.

Dim ThisApp = ThisApplication
Dim TransObj As TransientObjects = ThisApp.TransientObjects

 

0 Likes