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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Write to a externalMCAD file from a scritp object?

JBlackhole
16-Pearl

Write to a externalMCAD file from a scritp object?

Hi

Does anyone know if there is a way of writing to a MCAD file from a MCAD file?
Further explanation: I have got a MCAD template with hidden calculations (the "intelligent" bit is not meant to be seen by the user) and a button to import data selected by the user (The user enters a reference number and the data is imported from a database). Once the data is imported successfully, the calculation is automatically carried out and the user gets a �OK� or �FAIL�. If it�s an �OK� then a text file containing the imported inputs and key outputs is automatically written.

Instead of writting this text file I would like to write the inputs to a MCAD document. Something like that:

Write this at the top of the MCAD file (repeat for all variables) (The numbers are for example and are imported form the database)

IN_Variable_A:=50
IN_Variable_B:=120

Calculation part: If one uses the MCAD document �as normal� then one writes �50� and �120� at the appropriate variables, the calculation bit is modified to read the new variables


Variable_A:= IN_Variable_A
Variable_B:= IN_Variable_B

Calc:= Variable_A* Variable_B

Hope this make sense

Thanks

Regards

JXB
11 REPLIES 11

Teh define vars sheet at http://collab.mathsoft.com/read?112283,11 has the basis for what you want. You just need to modify it so as to specify the work sheet that is the target rather than assuming the current worksheet.
__________________
� � � � Tom Gutman

Tom

I cannot access this thread! Would you mind posting it here?

Thanks

Regards

JXB

Odd. I can just click on the link and it brings up the thread in a new window. But here's the latest define vars anyway. There's a bit of stuff in there for testing and development, you are interested only in the push buttons and text box that do the definitions.
__________________
� � � � Tom Gutman

>the "intelligent" bit is not meant to be seen by the user <
__________________________

Do you mean the user does not deserve getting your pretended "intelligence". Traceability is most desirable for yourself, the client and public safety.

jmG

jmG,

The template is 100+ pages long and the user has no knowledge/understanding of what the calc do.
It was et up by a "expert" and work within well defined parameters. It's a black box as far the user is concerned

jxb

On 8/12/2009 11:43:13 AM, jxb wrote:
>jmG,
>
>The template is 100+ pages
>long and the user has no
>knowledge/understanding of
>what the calc do.
>It was et up by a "expert" and
>work within well defined
>parameters. It's a black box
>as far the user is concerned
>
>jxb
______________________________

I can read what you wrote that an expert is making a black box of unknown and that the user does not need to know the content of the black box. Maybe the user should review his contract with the "expert" especially if it touches the public domain. Assuming a "court dispute" and no traceability. Clearly, the expert will lose his case telling the judge does not deserve more than the user.
Maybe even a special case for this forum.
Are you an intermediate trying to help between the user and the expert ? Maybe there is a bit of expertise missing in the black box in reference to your thread ? Will the scripted component survive the next Widows generation. And systematically some collab refuse opening scripted component from the web.

Just comments, no need to elongate what can't be seen.

jmG



StuartBruff
23-Emerald III
(To:ptc-1368288)

On 8/13/2009 10:55:26 AM, jmG wrote:
== I can read what you wrote that an expert is making a black box of unknown and that the user does not need to know the content of the black box. Maybe the user should review his contract with the "expert" especially if it touches the public domain. Assuming a "court dispute" and no traceability. Clearly, the expert will lose his case telling the judge does not deserve more than the user.

There is, or rather should be, traceability via configuration control of the worksheet. Company A runs the data against a worksheet with identified build. Company A then provides the data to Company B. Dispute arises, A give the worksheet to the court for their experts to evaluate.

This is the usual case for most of the OEM material we integrate into our systems. We do not have the source code to much of the software embedded in equipment we purchase. Nor are particularly interested in it - we'd need to have people with the time and capability to validate the worksheet, which all costs money. To minimize risk, we look at the quality procedures including software development and configuration control. We also look at verification results and/or run our tests on a black-box basis as required.

Security and commercial constraints may also prevent fully open system system knowledge.

Let us say the Company A did give the customer the worksheet. Would you expect them to give Company B the source code to Window and Mathcad as well? A worksheet is just the script, the underlying application is what does the job - there is no point in having written the perfect FORTRAN program if the compiler's full of bugs or the libraries are junk.

Stuart

Up to a certain point I don't need to see how Mathcad or else computing machinery adds 2+3. I accept the 15 decimals Mathcad returns from the Pentium ln(1.23456789) ... and many more. But when it comes to a product resulting from development, monkey don't monkey don't do.

I was suggestive of visibility and traceability in Mathcad.

jmG
StuartBruff
23-Emerald III
(To:ptc-1368288)

On 8/13/2009 1:36:39 PM, jmG wrote:
== Up to a certain point I don't need to see how Mathcad or else computing machinery adds 2+3. I accept the 15 decimals Mathcad returns from the Pentium ln(1.23456789) ... and many more. But when it comes to a product resulting from development, monkey don't monkey don't do.

The result you get from a Pentium is only as good as the code you used to call it ... including the bit that gets your input, interprets it, puts it into your data structure, etc, etc.

== Up to a certain point I don't need to see how

It's just a matter of where that point lies. There is a lot of proprietary code out there that you simply would not be allowed to see. You can test it as a black box, but you can't look inside.

Stuart
StuartBruff
23-Emerald III
(To:JBlackhole)

On 8/12/2009 2:43:56 AM, jxb wrote:
Does anyone know if there is a way of writing to a MCAD file from a MCAD file?
Further explanation: I have got a MCAD template with hidden calculations (the "intelligent" bit is not meant to be seen by the user) and a button to import data selected by the user (The user enters a reference number and the data is imported from a database). Once the data is imported successfully, the calculation is automatically carried out and the user gets a �OK� or �FAIL�. If it�s an �OK� then a text file containing the imported inputs and key outputs is automatically written.

Instead of writting this text file I would like to write the inputs to a MCAD document. Something like that:

Write this at the top of the MCAD file (repeat for all variables) (The numbers are for example and are imported form the database)

IN_Variable_A:=50
IN_Variable_B:=120

Calculation part: If one uses the MCAD document �as normal� then one writes �50� and �120� at the appropriate variables, the calculation bit is modified to read the new variables


Variable_A:= IN_Variable_A
Variable_B:= IN_Variable_B


If you use a version that support xmcd, then, yes, you can define some 'template' strings that hold the beginning and end parts of the Mathcad file (setting up the styles, etc, and closing xml statements) then have a further set of strings that create the desired regions.

I've done something similar. I created a template xmcd file, read it in, scan up until the 'regions' tag, generate and concatenate the new regions (you'll have to calculate the position in the new worksheet, but that should be straightforward), then scan the rest of the template xml string and write the whole thing to a new xmcd file.

Stuart
GuyB
10-Marble
(To:JBlackhole)

On 8/12/2009 2:43:56 AM, jxb wrote:
>Hi
>
>Does anyone know if there is a
>way of writing to a MCAD file
>from a MCAD file?...
> (The user enters a
>reference number and the data
>is imported from a database).
>Once the data is imported
>successfully, the calculation
>is automatically carried out

It sounds like your sheet takes a set of data (from the database) and acts on it.

Why not just write the analysis part of your sheet as a set of functions, with the input parameter given by the reference number?

Or, if it doesn't make sense to access the database every time you wish to make an intermediate calculation, you could write a new set of functions that return the different data structures you use throughout the rest of the analysis.

For example, if you frequently refer to a column of dates define a function "Dates(Ref#)" which takes the database reference number Ref# and returns a vector of date values. Then, below the region where the user types in the desired database reference number "User_Ref#", type "vDates = Dates(User_Ref#)" and all your subsequent calculations can call on vDates.

The user inputs the database reference number, and your analysis functions would work on those data directly.

- Guy
Announcements

Top Tags