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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Autogeneration of MathCAD Prime Files using the API or changing XML data

JE_11147360
3-Visitor

Autogeneration of MathCAD Prime Files using the API or changing XML data

Hi,

I am attempting to create a program that will autogenerate several MathCAD file templates based on variables that will be taken from an excel sheet that contains a list of parts. 

 

I am using MathCAD Prime 9.0

 

Some things I've looked into are using the API or changing the XML data directly. 

 

The API doesn't seem to support a way to add in new inputs and outputs to a blank worksheet.

 

Changing the XML data directly seems like it could be a good option. From other posts I've read it sounds like you can change the file extension to a zip, unzip the file, change some data in one of the files, then rezip and change the extension back. However when I have tried this the process of unzipping and rezipping changes how it is compressed which causes it to be unreadable by mathcad, even if I don't change any of the internal files.

 

Is there a way I can inputs and outputs to a blank worksheet with the API that I am missing? Is there a way to unzip and rezip the mcdx file that will maintain the readability of the file in MathCAD?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Renaming the .mcdx file to .zip, unzipping its contents to a subdirectory and then rezipping this directory again maintaining the directory/subdirectory structure and renaming the .zip file back to .mcdx should work OK. At least I never had any problem doing so.

Maybe you try a different archive program and take care to maintain the very same directory structure and really use zip format and not rar or anything else when you rezip.

View solution in original post

3 REPLIES 3

Renaming the .mcdx file to .zip, unzipping its contents to a subdirectory and then rezipping this directory again maintaining the directory/subdirectory structure and renaming the .zip file back to .mcdx should work OK. At least I never had any problem doing so.

Maybe you try a different archive program and take care to maintain the very same directory structure and really use zip format and not rar or anything else when you rezip.

Hi @JE_11147360,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag
 

JeffH1
14-Alexandrite
(To:JE_11147360)

@JE_11147360 

 

This is an interesting thing. 

 

In worksheet.xml, I see any math regions and can probably figure out the formatting to modify or construct new ones programmatically.

 

However, text regions, while present, give an Item-idref instead of actual text.  In the xaml folder, there ends up being a xamlpackage file for each and every text field.  These too are compressed and can be uncompressed (unzipped).  The resulting xaml sub-folder for each one contains a Document.xaml file which is editable and contains the actual text of the text field.

 

Some interesting possibilities going through my head right now.  This info might help someone else out.

Top Tags