cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Exporting Cordinate System Data

ptc-4464984
1-Newbie

Exporting Cordinate System Data

Hello,

 

I have a model with a large number of coordinate systems that I use for reference. Our software people need the x,y,z locations of each of these points in relation to a central origin. We use a cmm to measure each of these locations for accuracy calculations. I currently do this manually using the distance tool, but there has to be a better way. I was hoping to write a macro or something like this.

 

Any suggestions on a better way of doing this?

 

Thank you in advance,

Josh


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

7 REPLIES 7

Hi Josh...

Yes, I have a better way.

First, we can make a mapkey to simplify the measurements. We can pre-select the "central origin" coordinate systems then allow the mapkey to pause so you can select the coordinate system to measure. Pro/E (or Creo) will spit out the DX, DY, and DZ coordinates in the message log (which goes into the TRAIL FILE).

Anything that makes it into the message log is ripe for the picking. So the DX, DY, and DZ measurement will be in the trail file. Although you can't really open the trail file with a text editor while Pro/E is running, you can use a scripting program like perl to read from the file.

I created a simple perl script back in 1999 to grab the X,Y, and Z measurement data from a trail file. I've updated it and attached it to this email. We'll likely have to modify a few lines later... especially the $trail_dir variable which will have to hold the pathname to wherever you store your trail files.

The script will find the latest trail file then find the very last measurement you made. It will then display the DX, DY, and DZ coordinates. We can change this to store those coordinates in a text file. All we need to do then is tweak your measurement mapkey and loop.

The process will work like this...

  • Run Mapkey to take a measurement
  • You click a coordinate system to measure to (the "from" coordinate system is your pre-selected origin).
  • The perl script runs to grab the X, Y, and Z measurements and record them in a text file
  • The mapkey runs again

You can break out of the process at any time. Basically you should be able to go around the screen picking coordinate systems and logging the measurements. When you're done, all of the measurements will be in one file.

The only way you could make it MORE automatic would be to feed the script a list of all the coordinate systems you wished to measure and have it loop through them all automatically. This can be done. It depends on how much time you want to invest... and is it worth it for the payback you'll receive.

The script is a hack job. I used to be an ace in perl... now it's like trying to remember an what my old high school girlfriend's favorite food was. I'm 100% certain we can get this to work for you though. We'll probably have to take the discussion offline (email) but I'm sure we can give your measurement task a turbo boost.

Thanks!

-Brian

PS: By the way, perl is free and most IT guys understand it's a completely harmless and widely used scripting language. They probably use it themselves. It's pretty handy!

I think using a Hole Table would be a better way to do it. You can get the X and Y coordinates with respect to a selected Co-ordinate system. You can then export the table to a csv file which can then be opened in any spreadsheet application.

It is important to note the orientation of the co-ordinate system. The Z-Coordinate should be PERPENDICULAR to the SCREEN. The hole table would only export the X & Y co-ordinates.

Capture.JPG

Capture_1.JPG

Capture_2.JPG

Thank you both for your help. The hole table is quite useful and I can make that work for my situation. Being able to export the table as a .csv file is really handy. It will also make a nice document for record keeping purposes.

I am a little annoyed that the view has to have the coordinate system pointing normal to the screen. What purpose does that really serve. I should be able to use any cordinate system that I choose, regardless of how my view is oriented. Also, it will not let you pick coordinate systems as an option to list. Instead I have to place a point on each of my coordinate systems and use those. This is not a big deal beacause I will just update my user defined feature to do this for me.

Thank you again for the help.

Josh

Egad... so we only needed X & Y data? I thought we needed "Z", too... which is why I went the route of a script.

Ah well... glad you found a solution that solves the problem!

Take care..

-Brian

Actually if you use the hole table to list the datum points it will list x,y and z coordinates.

Josh

Ah, I was assuming only X &Y because that's all I've ever used them for... and that's what the above graphics showed (x, y, and diameter).

Thanks for the correction!

Oh While I do see Z listed in the hole table parameters, I was getting an error. Hence, I presumed it to be one of the vagaries of the software for listing the Z parameter in the configuration and not allowing it to list.

I used the holes directly and did not use datum points. That could be the reason.

Thanks for letting me know that Z can be listed.

Top Tags