Author Topic: Convert coordinate files to x,y  (Read 6155 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2125
  • class keyThumper<T>:ILazy<T>
Re: Convert coordinate files to x,y
« Reply #30 on: September 02, 2017, 02:01:09 AM »
While that is generally good advice, and Michaels comments regarding data formatting ;
I can understand the desire to be able to handle various formatting structures.

Having one function to parse the data file irrespective of it's structure is definitely an advantage if we are dealing with data from various sources.

I hadn't imagined the format would be as mixed in ONE file as the example I posted but being able to process ANY of the formats would be handy.

Good generic solution Fools.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

fools

  • Newt
  • Posts: 72
  • China
Re: Convert coordinate files to x,y
« Reply #31 on: September 02, 2017, 05:05:22 AM »
While that is generally good advice, and Michaels comments regarding data formatting ;
I can understand the desire to be able to handle various formatting structures.

Having one function to parse the data file irrespective of it's structure is definitely an advantage if we are dealing with data from various sources.

I hadn't imagined the format would be as mixed in ONE file as the example I posted but being able to process ANY of the formats would be handy.

Good generic solution Fools.

Thanks.
I tested Lee, MP and my code by benchmark.lsp.
Before testing, I added some content to MP's code. Let three functions has same result.
MP's function is the fastest and mine is the slowest. So, MP's function is recommended, especially when the amount of data is large.
BTW, Lee use regular expression is very wise solution.
Good good study , day day up . Sorry about my Chinglish .

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Convert coordinate files to x,y
« Reply #32 on: September 04, 2017, 02:17:14 PM »
Thanks for the nod fools. That said, I wouldn't necessarily consider my normalize function as recommended. It was more of an acedemic response to a contrived challenge that doesn't tend to exist much in real life. That is, data is normally consistant (tho it may be ugly). Be it spawned from a spreadsheet, a database, a data collector ... whatever. As such -- and especially if you're concerned with performance -- tailored code will perform far better than my "try to do it all" function. Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst