Altan_D
Automotive
- Nov 1, 2019
- 3
Hello All,
I have a VB.Net program uses Drafting, HybridShape and Part libraries which works fine from Catia R18 to R26. Some computers upgraded to R29 and it's now crashing in some drafting methods. It gives an exception as in the attachment snapshot. Problem happen first at myView.Activate(). If I disable this line, then it also crashes at myView.Tables.Add()
Code works fine when I try as CatScript or VBA macro in R29 but crashes with VB.NET. Is there anyone can help me about this problem?
I have a VB.Net program uses Drafting, HybridShape and Part libraries which works fine from Catia R18 to R26. Some computers upgraded to R29 and it's now crashing in some drafting methods. It gives an exception as in the attachment snapshot. Problem happen first at myView.Activate(). If I disable this line, then it also crashes at myView.Tables.Add()
Code works fine when I try as CatScript or VBA macro in R29 but crashes with VB.NET. Is there anyone can help me about this problem?
Code:
Private Sub btncatdrawing_Click(sender As Object, e As EventArgs) Handles btncatdrawing.Click
Dim CATIA As Application
Try
CATIA = Runtime.InteropServices.Marshal.GetActiveObject("CATIA.Application")
Catch ex As Runtime.InteropServices.COMException
MessageBox.Show("CATIA V5 is not opened, start program first!", "DrawingTool - Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
WindowState = FormWindowState.Normal
Exit Sub
End Try
Dim partDocument1 As PartDocument
partDocument1 = CATIA.ActiveDocument
Dim FPath As String
FPath = "C:\users\" & Environ("Username") & "\Desktop\Template.CATDrawing"
Dim documents1 As Documents
documents1 = CATIA.Documents
Dim myDoc As DrawingDocument
Try
myDoc = CATIA.Documents.Open(FPath)
Catch ex As Exception
WindowState = FormWindowState.Normal
MessageBox.Show("C:\users\" & Environ("Username") & "\Desktop\Template.CATDrawing is not found!", "DrawingTool - Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
myDoc = CATIA.ActiveDocument
Dim mySheet As DrawingSheet
mySheet = myDoc.Sheets.ActiveSheet
Dim myView As DrawingView
myView = mySheet.Views.Add("DrawingTool")
myView.Activate()
Dim MyTable As DrawingTable
MyTable = myView.Tables.Add(100, 100, 5, 9, 7.5, 21)
End Sub