Export Point Locations from ProE/IGES

I just wanted to post a script (Perl and VBS versions) I recently wrote to extract point locations from an IGES file. The method used is based on a tip from a previous thread in this group. I hope they are useful to someone else.

Notes:

  1. Set ProE Option "intf_out_blanked_entities = yes" in your config.pro file to prevent points on blanked layers from being exported in IGES file.
  2. Point location data will be written to "points.txt" in the same directory as the IGES file. If "points.txt" already exists it will be overwritten.
  3. The IGES file name is a required commandline argument for the scripts.

********************************************************************** ' iges2pt.vbs ' Extracts location of points from IGES file and writes to text file. ' Requires input filename as argument: iges2pt.vbs inputfile.igs OPTION EXPLICIT ON ERROR RESUME NEXT Dim objWSO Dim objFSO Dim InputFileName Dim InputFile Dim OutputFile Dim strLine Dim objRegExp Dim arrParts Set objWSO = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") ' Define InputFile InputFileName = WScript.Arguments(0) ' Need Error Trap to prompt if filename not provided. InputFileName = objFSO.GetAbsolutePathName(InputFileName) Set InputFile = objFSO.OpenTextFile(InputFileName, 1, False) ' Define OutputFile Set OutputFile = objFSO.CreateTextFile("Points.txt", 2, True) ' Define RegExp for Type=116 (Points) Set objRegExp = New RegExp With objRegExp .Pattern = "^116\b" End With ' Process Data Do Until InputFile.AtEndOfStream strLine = InputFile.ReadLine ' If Type=116 If objRegExp.Test(strLine) then ' IGES format uses 'D' in scientific notation. Replace D with E. strLine = Replace(strLine, "D", "E") ' Split by commas. arrParts = Split(strLine, ",") ' Write x y z to output file. strLine = arrParts(1) & " " & arrParts(2) & " " & arrParts(3) OutputFile.Writeline strLine End If Loop 'Close files InputFile.Close OutputFile.Close

**********************************************************************

# iges2pt.pl # Extracts location of points from IGES file and writes to text file. # Requires input filename as argument: iges2pt.pl inputfile.igs use warnings; use strict; my $outfile; my $line; my @parts; $outfile="points.txt"; open (OUTF, ">$outfile") || die "Cannot open $outfile for write.\n"; # Process Data foreach $line () { # Find lines defining points (Type=116) if ($line =~ /^116/) { @parts = split (",",$line); # IGES format uses 'D' in scientific notation. Replace D with E. for (@parts) { s/D/E/ } # Write out point x,y,z location. print OUTF "@parts[1..3]\n"; } } close OUTF;

Reply to
Dave
Loading thread data ...

Dave, have you used this? What did you export to iges? How does this parse out the header, find the data? Just curious ~ I want to create the kind of file you used this on, so I can try it.

David Janes

Reply to
David Janes

I've used it many times. I saved my ProE model in IGES format and exported the "Points and Curves". The script searches for lines starting with 116, the IGES point data-type, then grabs the x, y, z location and writes it to a new file (space delimited). For some reason the IGES format uses 'D' for scientific notation, so the script replaces these with 'E'.

Dave

Reply to
Dave

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.