Export Point Locations from ProE/IGES
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Export Point Locations from ProE/IGES

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Pro/Engineer
Author Message
Dave
Guest





Posted: Mon Nov 22, 2004 11:01 pm    Post subject: Export Point Locations from ProE/IGES Reply with quote

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;

Back to top
David Janes
Guest





Posted: Tue Nov 23, 2004 6:18 am    Post subject: Re: Export Point Locations from ProE/IGES Reply with quote

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

"Dave" <dgp@dodgeit.com> wrote in message
news:a3ab6562.0411221001.50f3c036@posting.google.com...
: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;
Back to top
Dave
Guest





Posted: Mon Nov 29, 2004 9:38 pm    Post subject: Re: Export Point Locations from ProE/IGES Reply with quote

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

"David Janes" <djanes@cox.net.invorrid> wrote in message news:<3ewod.126514$cJ3.92673@fed1read06>...
Quote:
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


Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Pro/Engineer All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB