Looking for File Parcer
-
you mean a tool able to parse text data into geometry?
-
Can you be more specific? Is this on Windows? Once this text is parsed, what do you want to do with it?
-
Any scripting language with Regular Expression (RE) support comes to mind, (Perl, Ruby, Python, VB) unless the format is so predictable that parsing based on column offsets and/or data attributes doesn't warrant RE use. I've done several tasks for myself and others using Ruby to perform such a task. The last one was for a telephone company in Oklahoma, parsing out records for a reverse-phone number lookup directory. (sorted on phone number, not last name).
Not sure what a .cdf is.
If you want to send me a complete sample, I can quote it for you.
-
For "quick and dirty" stuff, there's a number of old command line utilities ... free.
I've used "gawk" with considerable success extracting data from various proprietary/COBOL datasets of 100,000s of lines. Its a really simple regular expression script language, well documented (O'Reilly or The AWK book http://www.gnu.org/software/gawk/manual/gawk.html), available for Windows (http://gnuwin32.sourceforge.net/packages/gawk.htm) Mac (http://gawk.darwinports.com/) etc.
It reads a line of text, does the parsing, writes it out. Fast.
If you have formatted printout type data then I've also had success with Monarch (but its expensive) http://www.datawatch.com/
Good luck
-
Sure you could use grep, sed etc but wait, what if we had a scripting language in Sketchup that had good file reading capability, powerful regular expression matching, and a binding to the Sketchup geometry API etc.
I guess we can only hope.

Seriously, something like this works fine:
IO.foreach("my_inputfile.ext") { |aline| /^(\S*) ([^$]*)/.match(aline) verb = $1 rest = $2 case verb ....whatever you need to do here eg entities.add_face, entities.add_group etc }This is my mickey mouse .obj importer I use for Sketchup:
pos = [] tex = [] group = nil IO.foreach("/tmp/test.obj") { |aline| /^(\S*) ([^$]*)/.match(aline) verb = $1 rest = $2 case verb when "s" # ignore smoothing group when "v" # close current group if group pos = [] tex = [] group = nil end / (\S*) (\S*) (\S*)/.match(rest) pos.push Geom;;Point3d.new($1.to_f,$2.to_f,$3.to_f) when "f" if /(\S*)\/(\S*) (\S*)\/(\S*) (\S*)\/(\S*)/.match(rest) vertices = [pos[$1.to_i], pos[$3.to_i], pos[$5.to_i]] elsif /(\S*) (\S*) (\S*)/.match(rest) vertices = [pos[$1.to_i], pos[$2.to_i], pos[$3.to_i]] end group.entities.add_face vertices when "g" # open a new group /(\S*)/.match(rest) group = Sketchup.active_model.entities.add_group group.name = $1 puts "group(#{$1})" end }Adam
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement