Create Points on output features
Create Points on output features
(OP)
Hi, I am new on working with catia macros. I have a modified airfoil in 2D sketch and I want to design equidistant points on the airfoil splines and then to export the coordinates to an excel spreadsheet. The first step can be done easily in the 2D sketcherwith with the command "Equidistant Points". However, the points that are created cannot be exported directly as 3D points. So I have exported all these points as output features and I want to write a macro that adds a 3D point on each of them. The problem is that I don't know which is the exact command to do this. I would appreciate any kind of help.
CODE -->
Sub CATMain()
Dim i As Integer
Dim Sel As Selection
Set Sel = CATIA.ActiveDocument.Selection
Sel.Search "CATSketchSearch.2DOutput,all"
Sel.Search "Topology.Vertex,sel"
For i = 1 To elements.Count
Set Element = Sel.Item(i).Add("point") '<- Here I don't know how to write the command for adding a point on each vertex
Next
End Sub 




RE: Create Points on output features
indocti discant et ament meminisse periti
RE: Create Points on output features
I have tried to do this in this way, but it didn't work.
1)Firstly, I created a separate geometrical set, copied all the output features of the 2D sketch in this and finally I isolated them. Then I used a code, that I have found in this forum, for exporting points, but I was getting an error message: "The subject does not support this property or method: 'point.GetCoordinates'"
CODE -->
Dim objGEXCELapp As Object Dim objGEXCELwkBks As Object Dim objGEXCELwkBk As Object Dim objGEXCELwkShs As Object Dim objGEXCELSh As Object Dim fs, f, f1, fc, s Dim coords(2) Dim point As Variant Dim PartDocument1 Sub CATMain() CATIA.ActiveDocument.Selection.Search "CATGmoSearch.Point,all" StartEXCEL ExportPoint 'objGEXCELSh.Application.ActiveWorkbook.SaveAs (ExcelFolder & Left(CATIA.ActiveDocument.Name,Len(CATIA.ActiveDocument.Name)-8) & ".xls") 'objGEXCELSh.Application.ActiveWorkbook.Close End Sub '****************************************************************************** Sub StartEXCEL() '****************************************************************************** Err.Clear On Error Resume Next Set objGEXCELapp = GetObject(, "EXCEL.Application") If Err.Number <> 0 Then Err.Clear Set objGEXCELapp = CreateObject("EXCEL.Application") End If objGEXCELapp.Application.Visible = True Set objGEXCELwkBks = objGEXCELapp.Application.WorkBooks Set objGEXCELwkBk = objGEXCELwkBks.Add Set objGEXCELwkShs = objGEXCELwkBk.Worksheets(1) Set objGEXCELSh = objGEXCELwkBk.Sheets(1) objGEXCELSh.Cells(1, "A") = "Name" objGEXCELSh.Cells(1, "B") = "X" objGEXCELSh.Cells(1, "C") = "Y" objGEXCELSh.Cells(1, "D") = "Z" End Sub '****************************************************************************** Sub ExportPoint() '****************************************************************************** Dim x As Integer For i = 1 To CATIA.ActiveDocument.Selection.Count Set Selection = CATIA.ActiveDocument.Selection Set Element = Selection.Item(i) Set point = Element.Value 'Write PointData to Excel Sheet point.GetCoordinates (coords) objGEXCELSh.Cells(i + 1, "A") = point.Name objGEXCELSh.Cells(i + 1, "B") = coords(0) objGEXCELSh.Cells(i + 1, "C") = coords(1) objGEXCELSh.Cells(i + 1, "D") = coords(2) Next End Sub2) Then I made some changes on the above code to get the coordinates from the output features in the 2D sketch. When I run this, I get an error "The subject does not support this property or method: 'reference1.GetCoordinates'"
CODE -->
That is why I thought that it was not possible to take the coordinates directly and I decided to write a macro that creates 3D points on the output features. Is there another way to do this?
Thanks in advance.
RE: Create Points on output features
indocti discant et ament meminisse periti
RE: Create Points on output features