Skip to main content
1-Visitor
November 15, 2010
Solved

how to save graphs using VB code.?

  • November 15, 2010
  • 2 replies
  • 8439 views

Hi Please help.

Best answer by ViacheslavMezen

I think it can be done. Steps might be this:

1. Calculate the document.

2. Save it in xmcd format.

3. Parse it and find the plot tag with region-id.

4. Save document in html format.

5. Find png file using region-id.

That's all.

2 replies

1-Visitor
November 17, 2010

First of all, a better description of your problem might be required. Just simply saying "help please" and letting the thread title ask the question isn't the best way to go about things.

Why do you want to only save the graph?

Can't you copy/save the graph as an image?

Can't you print the graph to pdf?

Mike

1-Visitor
November 18, 2010

Hi Mike,

Thanks for the response and i apologize for not giving proper description of my query.

I ve developed an application in visual basic 6.0 (VB/MathCAD interface using OLE automation ). I pass the input parameters from VB screen to Mathcad sheet through OLE. (using "SetComplex" method) and retrive the output using "GetComplex" method.

My problem is how do i save the graph generated in mathcad using the VB code?? I ve been searching for the solution since so many days.

Regards,

Ram

1-Visitor
November 18, 2010

To be honest I don't know too much on this topic. I would have thought you can save the graph as an image and and retrieve it using the 'GetComplex method'.

I will have a hunt round and see what I can find.

Mike

1-Visitor
October 15, 2012

I think it can be done. Steps might be this:

1. Calculate the document.

2. Save it in xmcd format.

3. Parse it and find the plot tag with region-id.

4. Save document in html format.

5. Find png file using region-id.

That's all.

1-Visitor
October 16, 2012

Hi Viacheslav,

Thank you so much for the help.

I am doing it in the same way right now as explained in the above steps.

I think Mathcad has not provided any builtin VB functions / API to extract the graphs. This is the only way to do it.

I have few more questions for you. Can we extract the values from a matrix using VB Automation API?

I would like to know the code for both embeded as well as using VB OLE automation .

Regads,

Ram

1-Visitor
October 16, 2012

As for MC15 automation API, you can do it like this:

GetElement.png

See the Developer's Reference, Automation Interfaces, The Mathcad Automation API, MatrixValue class:

The GetElement method retrieves the value of a specified matrix element

With OLE you can simulate this:

GetElement2.png