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:
- 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.
- 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.
- 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;