Code to interpret CDF files?

Code to interpret CDF files?

Anonymous
Not applicable
1,068 Views
2 Replies
Message 1 of 3

Code to interpret CDF files?

Anonymous
Not applicable

Hello there,

 

Does anyone have some lisp code to interpret a CDF file and extract the fields (as separate text strings?).

I need to do this to insert blocks at coordinates and supply attributes where these parameters are in the CDF file.  My attempts to date have not been successful - for example I"m having trouble working out how to deal with data in this format quote

 

 "\"1\",\"LED_A\",\"120001\",\"0\",\"1.000\",\"3.200\",\"5.400\",\"0\",\"0\"" unquote -

 

the commas separate the fields.  This data has come from a CDF and processed by Microsoft's published VBA routine 

"Procedure to export a text file with both comma and quote delimiters in Excel"

 

 

Any help greatly appreciated.

 

Regards

George in New Zealand

 

0 Likes
Accepted solutions (1)
1,069 Views
2 Replies
Replies (2)
Message 2 of 3

Ranjit_Singh
Advisor
Advisor
Accepted solution

I assume you mean comma delimited file. Maybe start from below function

(defun somefunc  (lst / rxobj lst)
 (setq rxobj (vlax-get-or-create-object "vbscript.regexp"))
 (vlax-put rxobj 'pattern ",")
 (vlax-put rxobj 'global :vlax-true)
 (setq lst (vlax-invoke rxobj 'replace lst " "))
 (vlax-release-object rxobj)
 (read (strcat "(" lst ")")))

You can extract the members from the list, assign them to multiple variables etc. Make sure to set and release the regxobj only once in your overall function.

 

str_2_lst.gif

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hello Ranjit,

 

That looks very good - I don't understand how it works but it looks very promising. 

I've got to build it in to a routine that reads a CDF file with a few hundred lines and use the data to insert a block many times with different attributes.

 

Thanks once again

 

George

0 Likes