Please bear with my limited knowledge in CATIA VBA. I am having some difficulties in customize a CATIA V5 macro to browse for Excel coordinate points and plot it in CATIA, all with a click on the customized CATIA icon.
- I got an Excel file with many XYZ coordinates, let call it ExcelP1 (The excel file has no scripts/Macro in it), I would like to develop a macro in CATIA to read & plot points from ExcelP1.
Currently i have another "Excel file with macro" to browse the ExcelP1, and plot the points in CATIA. But i need to open and run the "Excel file with macro" first to initiate CATIA. The scripts are as below (i didn't develop this)
Public Filename As String Private Sub Browse_Click() 'Open File Mainform.Hide Filename = Application.GetOpenFilename("Excel Files (*.xls), *.xls") If Filename <> "False" Then Application.Visible = False filenamebox.Value = Filename Else Application.Visible = False Filename = filenamebox.Value End If Mainform.Show End Sub Private Sub ClearButton_Click() Mainform.Hide ActiveWorkbook.Close (False) Application.Visible = False End Sub Private Sub OKButton_Click() 'Set Up Message Labels Title = "Information Message" 'Check for Entered Values If filenamebox.Value <> "" Then Workbooks.Open Filename:=Filename Application.Visible = False 'Start CATIA and add an Open body to the document Start_CATIA Mainform.Hide 'Read Point Data from file and create point in CATIA i = 2 Do Until Worksheets("Sheet1").Range("a" & i).Value = "" x = Worksheets("Sheet1").Range("a" & i).Value y = Worksheets("Sheet1").Range("b" & i).Value z = Worksheets("Sheet1").Range("c" & i).Value Create_Point i = i + 1 Loop i = i - 2 MsgBox i & " Points Created in New Part", , Title Else MsgBox "Enter a Filename", , Title End If ActiveWorkbook.Close (False) Mainform.Show End Sub Private Sub UserForm_Initialize() If Worksheets("Filepath_Location").Range("a1").Value <> "" Then Filename = Worksheets("Filepath_Location").Range("a1").Value filenamebox.Value = Filename End If End Sub
What do I need to add/modify in order for the scripts to run in CATIA?