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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

How do I export XYZ data from CreateMesh?

gatlas
10-Marble

How do I export XYZ data from CreateMesh?

How do I export XYZ data from CreateMesh? I am exporting data from a Mathcad Prime 3D surface plot to a graphics program which will allow me to color code the surface based upon the Z values.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:gatlas)

The data structure suggested by Terry can be easily created in Prime and then exported to Excel in one go:

Werner_E_0-1672158832114.png

And you may even create the plot in Excel but it would need some more additional work to have it using a better color scheme and more meaningful scales.

Werner_E_2-1672159743614.png

 

 

 

View solution in original post

7 REPLIES 7
Werner_E
25-Diamond I
(To:gatlas)

Which data structure is needed by the external graphics program?

CreateMesh creates a nested matrix. Its a 3 x 1 matrix and the elements are n x m matrices with the x, y and z values of the surface points. Furthermore this structure also defines automatically the quadrilateral "patches" the surface consists of.

It would be easy to write a small program to export a 3-column matrix with n * m elements consisting of all the points of the surface, but how would an external program know which four points create a side face of the surface?

So once you know the data structure needed for your external program, it may be possible to write a Mathcad program to create and export that structure.

I guess most programs won't understand the structure READPRN creates

Werner_E_0-1672113510547.png

Real Mathcad of course does:

Werner_E_0-1672112823310.png

 

Werner_E
25-Diamond I
(To:Werner_E)

Real Mathcad even makes a good job if only provided a simple linear point list without any information about side faces.

In Prime:

Werner_E_0-1672114338080.png

In Mathcad

Werner_E_0-1672118119035.png

 

 

But again - you'll have to know which data structure your external program needs.

 

Hi,

Export the three nested matrices in M as separate Excel files.

Capture.JPG

Most graphical packages can handle Excel files.

For example ORIGIN with a simple rearrangement in Excel gets this:

Capture2.JPG

Cheers

Terry

Werner_E
25-Diamond I
(To:gatlas)

The data structure suggested by Terry can be easily created in Prime and then exported to Excel in one go:

Werner_E_0-1672158832114.png

And you may even create the plot in Excel but it would need some more additional work to have it using a better color scheme and more meaningful scales.

Werner_E_2-1672159743614.png

 

 

 

gatlas
10-Marble
(To:Werner_E)

Werner,

 

Please explain the matrix operators which have vertical and horizontal parenthesis. Thanks!

 

Glen

 

 

Werner_E
25-Diamond I
(To:gatlas)


@gatlas wrote:

Werner,

 

Please explain the matrix operators which have vertical and horizontal parenthesis. Thanks!

 

Glen

 

 


What you are referring to are the matrix row- and column selectors.

https://support.ptc.com/help/mathcad/r6.0/en/index.html#page/PTC_Mathcad_Help%2Frow_and_column_operators.html%23

Werner_E_0-1672173259973.png

 

Here is in a bit more detail explained what I did:

Werner_E_2-1672173780251.png

 

So, if the program you use for plotting expects that kind of data table and if it can read Excel (which is very likely) this should help.

Prime 6 sheet attached

Werner_E
25-Diamond I
(To:Werner_E)

I added a function which directly creates that data structure from a given function R x R -> R without the need to call CreateMesh and alter its output data.

Syntax is similar to that of CreateMesh.

Werner_E_0-1672177461547.png

 

BTW, the reason for the crude X and Y values is because the last two (optional) arguments of CreateMesh are the number of data values, NOT the number of intervals.

So if x runs from 10 to 30 and you ask for  10 data values you are asking for just 9 intervals. So the first value is 10 and the second is 10+(30-10)/9=12.222.... So ist probably better to ask for 11 data values to get the series 10, 12, 14, ...30.

P6 sheet attached

 

Announcements

Top Tags