cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

write a text file

Relayman
1-Visitor

write a text file

Hi,

In MCAD 15 I have a sheet that has lots of math variables whose names start with the letter d. e.g. dVAR1, dVAR2.

Is it possible to write code in MCAD that would read through the entire sheet and write those variables and their value to a text file?

e.g. dVAR1 = 4.50

dVAR2 = 11.75

best regards,

russ

4 REPLIES 4

Yes.

In MCAD 15 I have a sheet that has lots of math variables whose names start with the letter d. e.g. dVAR1, dVAR2.

e.g. dVAR1 = 4.50

dVAR2 = 11.75

Do you want to keep them in exactly that format?

What do you intend to do with file after? Because this will dictate the method used.

Mike

Mike,

The plan is to write them to a text file and keep their exact variable name but trim off that leading d. This would be something that was "executed" manually after I'm satisfied with what i've done in the sheet. The end product being a text file with all those variables and their values and comments.

I would want it to look like the following so text is mixed in with numeric values.

e.g.

[BLOCK A]

QUAL=FAVORABLE

[1]

VAR1,"4.50"

VAR2,"11.79"

[2]

VAR3,"114.85"

VAR4,"UNFAVORABLE"

VAR5,"400"

thanks,

russ

Have a look at my example below. With a little bit of formatting that can be done.

Mike

Have a look at the attached worksheet, I was trying to use the WRITEPRN function but the text file was displaying the result as a matrix.

I have used a scripted component curiosity of Richards 'Extra Components' worksheet. Hit F9 over the icon to get the function to execute. Also change the path to your desired location.

Mike

Announcements

Top Tags