Sub CATMain()Dim inputtype(0),Status,myselectDim myarray(),myname(),mytype(),mycell(),feature()CATIA.Visible=TrueSet oSelection=CATIA.ActiveDocument.Selectioninputtype(0)=“ZeroDim”Status=oSelection.SelectElement3(inputtype,“selectpoints”,True,CATMultiSelTriggWhenSelPerf,False)If Status=“Cancel” ThenExit SubReDim myarray(2) For i=1 To oSelection.CountReDim Preserve myname(i–1)ReDim Preserve mytype(i–1)ReDim Preserve feature(i–1)ReDim Preserve mycell(2,i–1)Set myselect=oSelection.Item2(i).Valuemyname(i–1)=myselect.Namemytype(i–1)=TypeName(myselect)feature(i–1)=myselect.Thickness.Parent.Parent.Namemyselect.GetCoordinates myarray ‘如果不是创建“点”产生的点点,这里会出错For j=0 To 2mycell(j,i–1)=Str(myarray(j))Next jNext iDim excel As Object Set excel=CreateObject(“Excel.Application”)Set excelbook=excel.Workbooks.AddSet excelsheet=excelbook.Worksheets(1)excelsheet.Application.Visible=Trueexcelsheet.cells(2,2)=“Order”excelsheet.cells(2,3)=“Name”excelsheet.cells(2,4)=“X”excelsheet.cells(2,5)=“Y”excelsheet.cells(2,6)=“Z”excelsheet.cells(2,7)=“Type”excelsheet.cells(2,8)=“PartA”excelsheet.cells(2,9)=“PartB”excelsheet.cells(2,10)=“PartC”For k=1 To i–1excelsheet.cells(k+2,2)=kexcelsheet.cells(k+2,3)=myname(k–1)For j=0 To 2excelsheet.cells(k+2,j+4)=Round(mycell(j,k–1),3)Next jexcelsheet.cells(k+2,7)=mytype(k–1)excelsheet.cells(k+2,8).NumberFormatLocal=“@”excelsheet.cells(k+2,8)=feature(k–1)Next kexcelsheet.range(excelsheet.cells(3,8),excelsheet.cells(i+1,8)).TextToColumnsDestination:=excelsheet.cells(3,8),Other:=True,OtherChar:=“-“excelsheet.columns(“B:J”).EntireColumn.AutoFitEnd Sub