Pawel Chil
Automotive
- Apr 19, 2018
- 10
Hello every one,
I want in Catia V5 CatPart to export coordinates of all points and corresponding bodie's names.
I have a macro where I can export only points or only names. I can't join it in this way that receive a list where I see which point coordinates belongs to which body(name).
Can anybody help me?
Thanks in advance!
Below a macro for only point's coordinates.
sub catmain()
set objexcel=CreateObject("Excel.Application")
objexcel.Visible=True
Set objWorkbook= objexcel.workbooks.Add()
set objsheet1=objWorkbook.sheets.item(1)
objsheet1.name="Points_Coordinates"
dim coords(2) as variant
CATIA.ActiveDocument.Selection.Search "( CATPrtSearch.Point),all"
for i=1 to catia.activedocument.selection.count
set selection=catia.activedocument.selection
set element=selection.item(i)
set point=element.value
point.getcoordinates(coords)
objsheet1.cells(i+1,1)=point.name
objsheet1.cells(i+1,2)=coords(0)
objsheet1.cells(i+1,3)=coords(1)
objsheet1.cells(i+1,4)=coords(2)
objsheet1.cells(i+1,5)=element.name
next
end sub
I want in Catia V5 CatPart to export coordinates of all points and corresponding bodie's names.
I have a macro where I can export only points or only names. I can't join it in this way that receive a list where I see which point coordinates belongs to which body(name).
Can anybody help me?
Thanks in advance!
Below a macro for only point's coordinates.
sub catmain()
set objexcel=CreateObject("Excel.Application")
objexcel.Visible=True
Set objWorkbook= objexcel.workbooks.Add()
set objsheet1=objWorkbook.sheets.item(1)
objsheet1.name="Points_Coordinates"
dim coords(2) as variant
CATIA.ActiveDocument.Selection.Search "( CATPrtSearch.Point),all"
for i=1 to catia.activedocument.selection.count
set selection=catia.activedocument.selection
set element=selection.item(i)
set point=element.value
point.getcoordinates(coords)
objsheet1.cells(i+1,1)=point.name
objsheet1.cells(i+1,2)=coords(0)
objsheet1.cells(i+1,3)=coords(1)
objsheet1.cells(i+1,4)=coords(2)
objsheet1.cells(i+1,5)=element.name
next
end sub