Inserting autocad DWG OLE object in drawing makes autocad freeze.

Inserting autocad DWG OLE object in drawing makes autocad freeze.

Anonymous
Not applicable
248 Views
0 Replies
Message 1 of 1

Inserting autocad DWG OLE object in drawing makes autocad freeze.

Anonymous
Not applicable

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

 

 

0 Likes
249 Views
0 Replies
Replies (0)