Message 1 of 1
Inserting autocad DWG OLE object in drawing makes autocad freeze.

Not applicable
02-05-2020
11:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I've got an iLogic routine that saves the current drawing in DWG and then inserts it as an OLE object.
Most of the time it makes Autocad freeze, so I have to kill the acad process in order to make it work.
Any idea of how to solve it? I paste the code here. Thanks in advance.
If ThisDoc.Path="" Then MessageBox.Show("Guarde primero el plano", "ERROR") Else oPath = ThisDoc.Path FABRICACION = New String() {"FABRICACION", "NO FABRICACION"} FABRICACIONELEGIDA= InputListBox("ELEGIR OPCION",FABRICACION, "", "CREADOR DWG", "") Select Case FABRICACIONELEGIDA Case = "FABRICACION" oDIRECTORIOFAB = ThisDoc.Path & "\" & "FABRICACION" & "\" If Not System.IO.Directory.Exists(oDIRECTORIOFAB) Then System.IO.Directory.CreateDirectory(oDIRECTORIOFAB) End If NOMBREFAB = oDIRECTORIOFAB & ThisDoc.FileName(False) & ".dwg" ThisDoc.Document.SaveAs(NOMBREFAB , True) oDoc = ThisApplication.ActiveDocument Dim kOLEDocumentLinkObject As ObjectTypeEnum kOLEDocumentLinkObject = 3331 Dim oRefOLE As ReferencedOLEFileDescriptors oRefOLE = oDoc.ReferencedOLEFileDescriptors oRefOLE.Add(NOMBREFAB, kOLEDocumentLinkObject) MessageBox.Show("DWG CREADO EN CARPETA FABRICACION", "COMPLETADO") Case = "NO FABRICACION" NOMBRE = ThisDoc.PathAndFileName(False) & ".dwg" ThisDoc.Document.SaveAs(NOMBRE, True) oDoc = ThisApplication.ActiveDocument Dim kOLEDocumentLinkObject As ObjectTypeEnum kOLEDocumentLinkObject = 3331 Dim oRefOLE As ReferencedOLEFileDescriptors oRefOLE = oDoc.ReferencedOLEFileDescriptors oRefOLE.Add(NOMBRE, kOLEDocumentLinkObject) MessageBox.Show("DWG CREADO EN LA MISMA RUTA", "COMPLETADO") End Select End If