Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract point position to excel 1

Status
Not open for further replies.

zikozaki01

Automotive
May 2, 2011
3
in the attachments a .Catpart file in which i need to extract points position into an excel or a .txt file if any one could do this for me or help me , i'd be grateful....
Thanks in advance
 
Replies continue below

Recommended for you

Hi,

Your points are done on a sketch, so easy way is to save CATPart as igs file.

The igs file can be open with WordPad or Scite or Notepad++ (it will keep the text formatting) or with any other software which can read files based on text inside - case of the igs files. Usually you can see the coordinates of the points in the rows which start with number 116 (which if I remember correctly means point in igs files).

In your particular case search for Sketch.1 and under this row you will find what you need, for example:

116,0.0,1004.704829,156.6925468,0,0,0; 1P 1
116,0.0,1002.391412,159.007152,0,0,0; 3P 2
116,0.0,1001.717075,162.2252189,0,0,0; 5P 3
116,0.0,1002.839395,165.292717,0,0,0; 7P 4
116,0.0,1005.358351,167.4462534,0,0,0; 9P 5
116,0.0,1008.178667,169.1814322,0,0,0; 11P 6

That means for first point is at x=0.0 y=1004.704829 z=156.6925468

Last 3 zero numbers on the same row is the position of the axis system…..

Of course you can do this also in Excel, still, be aware of numbers of the rows limitation in Excel - no more then 63500 if I remember correctly...




Regards
Fernando
 
Thank You fredo,, you made my day :)

but what does 1p, 3p , 5p means ,, why they are odd ??!!??

i can't help thanking you frdo :)
 
hi,
with this macro you can extract all point in CSV file
you can find in attach the extract of your part

all the best

Sub coord_points()

'*********
'SETTINGS
'*********
Dim filesys, testfile
Set partDocument1 = CATIA.ActiveDocument
Set filesys = CreateObject("Scripting.FileSystemObject")


'*******
'INPUTS
'*******

file_path = InputBox("Chemin du fichier de sortie:", "Chemin", "C:\")

'**************************
'CREATION OF OUTPUT FILE
'**************************
file_path2 = file_path & "data_file.csv"
Set data_file = filesys.CreateTextFile(file_path2, True)

'***************
'WRITE HEADER
'***************
data_file.WriteLine "Position des points"
data_file.WriteLine "Nom;X;Y;Z"

'************
'BEGIN LOOP
'************
Dim selection1
Set partDocument1 = CATIA.ActiveDocument
Set selection1 = partDocument1.Selection

selection1.Search "type=CATGmoSearch.Point,all"
nombre_point = selection1.Count

For i = 1 To nombre_point

If VBA.Left(selection1.Item(i).Type, 16) = "HybridShapePoint" Then


Set point_selected = selection1.Item(i).Value
ReDim myArray(2)
point_selected.GetCoordinates myArray
nom = point_selected.Name


Else
ReDim myArray(2)
myArray(0) = "N/A"
myArray(1) = "N/A"
myArray(2) = "N/A"
nom = "N/A"
End If

'******************
'ADD DATA TO FILE
'******************


data_file.WriteLine nom & ";" & myArray(0) & ";" & myArray(1) & ";" & myArray(2) & ";" & selection1.Item(i).Type



Next

data_file.Close

MsgBox ("Operation est teminée")

'****
'END
'****
End Sub
 
 http://files.engineering.com/getfile.aspx?folder=2fcd78ea-f388-4701-acd5-8ad0a62a03b6&file=data_file.csv
Any idea why returns an empty file?
Or not totaly empty, just no points data.
------------------
"Points Extraction from CATIA"

"Name , X , Y, Z"
--------------------------

The manual way that ferdo posted is not ideal but I have used it. It is just so much work to manually(yes using automated tools, still lot of work) edit the exel file to get the points. I need to extract several thousand points from several files.

I am using Catia V5R19 with LMS Virtual Lab 9-SL3 running on top of it. Doesnt help to run just Catia, same problem.
 
from the script:
This scipt scan a Geometrical Set named 'Points' in a Part
Then get XYZ of points (values in mm)
and create a report as a Text file located in d: drive


Make sur you have all points in 1 geometrical set and its name is Points.

Eric N.
indocti discant et ament meminisse periti
 
Hi,

I remembered an old thread and search function helped me to find it :)


And bellow is a newer version of Eric's catvba (from same thread), see if is working (there are still some conditions to work, your part is done in hybrid design ?


What was posted by camadian is working (I didn't have the opportunity to test it) ?

Regards
Fernando

 
Thank you Eric. The geometrical set was not named Points. But when I did name it I got the following result.

-------------------------------
"Points Extraction from CATIA"

"Name , X , Y, Z"

"Point.575",,,
"Point.576",,,
"Point.577",,,
"Point.578",,,
"Point.579",,,
"Point.580",,,
"Point.581",,,
"Point.582",,,
.
.
.
---------------------

Now it finds the points but doesnt get any values out of them. Could the problem be that the points are actually following a curve made out of several components with "Join". The points have only length parameter visible.

From the igs file you can get the coordinates with no problem. Just lot of work.
 
can you post you file?
I am still using R18

Eric N.
indocti discant et ament meminisse periti
 
Hey Eric

Here is the file. If you can get the points, that would be nice. I am still getting the same result as before.

I want to get just the points in "Points"-geometrical set

I have been busy with other stuff so didnt have time to post earlier.

-Johannes
 
 http://files.engineering.com/getfile.aspx?folder=7879a16a-4fdf-4376-a2d2-5bccb628b076&file=Points.CATPart
Status
Not open for further replies.

Part and Inventory Search

Sponsor