We're thinking of using MathCAD Prime. One of our key requirements is to be able to programmatically print MathCAD Prime files to PDF (i.e. with no user interaction). I know this is possible with MathCAD 15 (you automate printing to PDF from the commandline with MathCAD 15 by adding the "-p" option after the executable and before the filename), but I cannot see how to do it with MathCAD Prime. I've been looking through the API documentation: https://support.ptc.com/help/mathcad/r7.0/en/index.html#page/PTC_Mathcad_Help%2Fmathcad_and_automati.... It says that you can print MathCAD Prime worksheets, but I cannot actually find this documented anywhere.
Please could you let me know how to do this, either from the API or from the commandline?
Thanks for your help!
Solved! Go to Solution.
I fear about related functionality up to Mathcad 15 (command mathcad.exe -p test.xmcd😞 this is not part of Mathcad Prime functionality
Workaround: API functionality to save as PDF is introduced with Mathcad Prime 6.0
Ptc.MathcadPrime.Automation.ApplicationCreator mathcad = new Ptc.MathcadPrime.Automation.ApplicationCreator();
IMathcadPrimeWorksheet3 mathcadPrimeWorksheet = mathcad.Open("d:\\test.mcdx") as IMathcadPrimeWorksheet3;
if (mathcadPrimeWorksheet != null)
{
mathcadPrimeWorksheet.SaveAs("d:\\test.pdf");
//Just change the extension of the file here to print to other formats such as RTF.
mathcadPrimeWorksheet.Close(SaveOption.spDiscardChanges);
}
I dont know the but perhaps this:
https://community.ptc.com/t5/PTC-Mathcad/Batch-Printing/td-p/209960 may have some answers.
https://www.fcoder.com/how-to/printing-video-tutorials
Print Conductor allows you to seamlessly print an unlimited number of CAD drawings including MathCAD, MathCAD Prime and Solid Edge drawings, multi-page DWFX drawings, and more. No CAD software required!
Hi,
Thanks for your response.
What I'm really asking, is there a way to automate printing MathCAD Prime? Is there a -p option or is there a scripting language, e.g. VBscript, which you can use to print MathCAD Prime?
I fear about related functionality up to Mathcad 15 (command mathcad.exe -p test.xmcd😞 this is not part of Mathcad Prime functionality
Workaround: API functionality to save as PDF is introduced with Mathcad Prime 6.0
Ptc.MathcadPrime.Automation.ApplicationCreator mathcad = new Ptc.MathcadPrime.Automation.ApplicationCreator();
IMathcadPrimeWorksheet3 mathcadPrimeWorksheet = mathcad.Open("d:\\test.mcdx") as IMathcadPrimeWorksheet3;
if (mathcadPrimeWorksheet != null)
{
mathcadPrimeWorksheet.SaveAs("d:\\test.pdf");
//Just change the extension of the file here to print to other formats such as RTF.
mathcadPrimeWorksheet.Close(SaveOption.spDiscardChanges);
}
Hi, this is great, thanks! I'm guessing the code example you provided is .NET?
Thanks for this. Out of curiosity, will it work for MathCAD Express as well?
Hi, sorry for the delay,
1.
as I know the code will run compiled as C# (C Sharp) language code.
And yes, this is also supported by Microsoft's .NET Framework (for example, create a new Console App .NET Framework project).
2.
I am not sure about Mathcad Prime Express and API support - I could not find any such statement.
I guess a valid reason for that is PTC normally states what is supported, rather than what is not supported.
Another valid reason could be: Mathcad Prime Express is not a different product - it is rather a limited run mode of the full Mathcad Prime product in case a valid license is (even temporary) not available.
And third, since the Express mode is a restriction to specific known features, called Premium features, I cannot imagine that it restricts any customized feature as well (which is nothing but another coding library, but built from customized code by the customer).
I hope this helps,
Michael
The API should work with Mathcad Express.
Fantastic, thanks!
Thanks! I will try it out!
I have a full sub doing this, but in VBA. I don't know if this sub allows providing full code.