Dim CATIA As INFITF.Application
CATIA = GetObject(, "CATIA.APPLICATION"
Dim ActiveSelection As INFITF.Selection
ActiveSelection = CATIA.ActiveDocument.Selection
Dim i As Integer
For i = 1 To ActiveSelection.Count2
ActiveSelection.Item(i).Value.Name = i.ToString()
Next i
C#代码如下:
INFITF.Application CATIA = (INFITF.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("CATIA.APPLICATION"
INFITF.Selection ActiveSelection = CATIA.ActiveDocument.Selection;
for (int i = 1; i <= ActiveSelection.Count2; i++)
{
ActiveSelection.Item(i).Value.Name=i.ToString();
}