The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Compute area of contours/extract contour points
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

richardljohnsonjr

USA
3 Posts

Posted - 02/26/2010 :  2:59:55 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Origin Pro 8.1 SR1
Operating System: Windows Vista 32 bit

I have xyz data that I plot into a xyz contour plot and want to be able to compute the area of the xy projection for specific contour lines. As I haven't discovered any built in support for this I intend to write a function that extracts the contour lines and uses a polygon area algorithm on the points. The contour plot window itself provides a method for extracting the contour lines into a worksheet via a shortcut menu, but I would like to do this programatically. I can't find any examples of how to go about this in the documentation.

Penn

China
644 Posts

Posted - 03/02/2010 :  04:42:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

There is a method in DataPlot class for extracting contour data, DataPlot::ExtractContourData. Please refer to the following page.

http://ocwiki.originlab.com/index.php?title=OriginC:DataPlot-ExtractContourData

Penn
OriginLab Technical Services
Go to Top of Page

richardljohnsonjr

USA
3 Posts

Posted - 03/02/2010 :  09:30:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the response, FYI- I double checked, and this method is not listed in the help files that were bundled with the download I installed. I assume this is a relatively recent addition to the DataPlot class and must have gotten overlooked.
Go to Top of Page

Penn

China
644 Posts

Posted - 03/02/2010 :  10:03:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

This method is not listed in the CHM help files yet, that is why you cannot find it in the help document. Sorry for the inconvenience.

Now, it has been added to the newest CHM help files and will be bundled with the coming version.

Penn
OriginLab Technical Services

Edited by - Penn on 03/02/2010 10:04:21 PM
Go to Top of Page

Penn

China
644 Posts

Posted - 03/03/2010 :  01:28:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The function ocmath_d_polygon_area can be used to calculate polygon area.

I have made some changes in this example. Hope it helpful in your case.

Penn
OriginLab Technical Services

Edited by - Penn on 03/03/2010 01:28:47 AM
Go to Top of Page

richardljohnsonjr

USA
3 Posts

Posted - 03/05/2010 :  10:11:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The example was very helpful and i've nearly got it all working. The problem I'm now having is that I can't seem to generate the contour plot and extract the contour lines in a single function call. For example I have a function loadData() that loads in the contour data from my database and generates the contour plot. I have another function computeArea() that locates the contour plot and then extracts the contour lines and computes the areas. If I call theses functions separately from the command line everything works fine. If however I call computeArea() from inside loadData(), I get a return value of 0 from ExtractContourData. It is as if there is some asynchronous calls that generate the contour plot that I need to wait to complete before trying to extract the contour lines. If so how do I go about doing this?
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/05/2010 :  4:58:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes, you need to wait for WM_PAINT to come in to draw the plots, and if there is no idle, that message will not come through.

You can try adding a delay in your code, like

LT_execute("sec -p 0.2");


CP

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000