DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GenerateMesh command through DDE

 
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions
View previous topic :: View next topic  
Author Message
meany



Joined: 21 Jul 2003
Posts: 16
Location: Missouri

PostPosted: Thu Jun 01, 2006 12:14 pm    Post subject: GenerateMesh command through DDE Reply with quote

I'm using a GenerateMesh command through DDE with the DPlot_PlotBitmap call. If DPlot is minimized (as is the default when it wasn't previously running), it's giving me an error, but if I have DPlot maximized (as a window behind my app), it works fine. Am I missing something? I've tried hard to have DPlot hidden if they didn't have it open before my app runs, and to leave it as it was if they had it opened previously, whether minimized or maximized. If DPlot "must" be maximized for GenerateMesh to work, I'd like to keep track of it's previous state before doing the GenerateMesh. Can this be queried? I see commands to do the minimizing/maximizing, but is there one that reports that state?

I'm also getting white spaces in my 3D contour (shaded bands) plot after the GenerateMesh executes. I presume this is because values are outside of the previous min/max values I used in the ManualScale command. Is that the reason, and is there an easy percentage window or something that will cover the min/max growth?
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu Jun 01, 2006 2:46 pm    Post subject: Reply with quote

"it's giving me an error": Can you be a bit more specific?

I'll try this out later tonight; I suspect the problem is that a new document window is being created and there's something about DPlot being minimized that fouls that up. If that's correct (and I can't think of any other reason why an error would occur off the top of my head) then the same problem would exist with Histogram, FFT, all other commands that create a new document.

Quote:
I'm also getting white spaces in my 3D contour (shaded bands) plot after the GenerateMesh executes. I presume this is because values are outside of the previous min/max values I used in the ManualScale command. Is that the reason, ...


Most likely, yes. The white areas are outside the Z extents.

Quote:
... and is there an easy percentage window or something that will cover the min/max growth?


That would be easy enough to do, but you might want to think about this one a bit. If the Z extents of the interpolated surface are outside the extents of the original surface... is that really appropriate? In most cases for surfaces that I'd be working with this would be an indication that the interpolation took a few too many liberties with the data in smoothing things out. Probably because the "np" value was too large.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
meany



Joined: 21 Jul 2003
Posts: 16
Location: Missouri

PostPosted: Thu Jun 01, 2006 3:24 pm    Post subject: Reply with quote

Sorry about not being specific! My code is just trapping a returned HBITMAP of NULL, so I really didn't even know what kind of error. I have since recompiled and added a call with DPlot_SetErrorMethod(2). Now I see a pop-up window that says "DPLOTLIB, Timeout error, current timeout value=20000 msec". However, this box pops immediately, without a 20 second delay. Hope this helps. Is there a DDE command that lets me know the minimized/maximized status of the DPlot window?

On the Z extents, I pass in Z extents that my user selects and I use ContourCustomColors to get the exact ranges my user wants in the colors they want them (with a bit of massaging!). Granted, it's manufactured data, but I'd like anything higher than "high" to show up as "high" and anything lower than "low" to show up as "low". I just tried and I can fake this out. I calculated my Z range. then subtracted it from the min and added it to the max, and then passed these new values as the Z extents. My custom colors keeps the plot looking as expected. This works for my data (at least on this testcase), but I'm wondering if there's some nominal percentage of that range (or some other algorithm) that would work in a general case. I'm not sure what the GenerateMesh is doing to extend the extents.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu Jun 01, 2006 4:04 pm    Post subject: Reply with quote

Quote:
I have since recompiled and added a call with DPlot_SetErrorMethod(2). Now I see a pop-up window that says "DPLOTLIB, Timeout error, current timeout value=20000 msec".


Thanks. That's most likely related to the window being minimized, but I'll check it out later and, in any case, fix it as soon as possible.

Quote:
Is there a DDE command that lets me know the minimized/maximized status of the DPlot window?


No, but you can use normal Windows API calls to do it. The return value of DPlot_Start is the HWND handle of the main DPlot window. You can call IsIconic to see if it is minimized, IsZoomed to see if it is maximized, and/or IsWindowVisible to see if it is hidden or visible.

Quote:
I'm not sure what the GenerateMesh is doing to extend the extents.


If you're using the bivariate interpolation method then it is using np control points to interpolate the generated mesh. If your original data is sparse then a large np might end up creating nonsense peaks and valleys. Smooth peaks and valleys, but still nonsense. In plain English, there's no good way to make up for a lack of input data.

I don't know about applying a set percentage transform to the extents; what I should probably do is add an option to the GenerateMesh command to check the actual extents and (if ManualScale is in effect) reset the Z extents to nice round numbers that include the entire surface. I'll have to think about this one a bit.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
meany



Joined: 21 Jul 2003
Posts: 16
Location: Missouri

PostPosted: Thu Jun 01, 2006 5:09 pm    Post subject: Reply with quote

Thanks for the Windows API calls help. I'll try that.

The testcase I'm trying has a 15x9 grid and I'm using an np=4 on the GenerateMesh command. It looks like the extents grow by about 15% on this case. I'll be watching for your GenerateMesh "option", but I'll get around it in the meantime. Thanks again for your help and great product!
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Fri Jun 02, 2006 12:48 am    Post subject: Reply with quote

Charlotte,
I don't have a good solution for this one yet (which seems to be a divide by 0 problem), other than restoring DPlot whenever a command would cause a new document to be opened, which I'll probably do.

I'm curious: is the problem that you want your application to minimize DPlot, or is it that you're concerned that the user will minimize DPlot before taking some action in your application that results in the GenerateMesh command?

If the former, is there any reason for you not to use AppHide rather than AppMinimize? In a hidden state everything works as expected. (Of course you'll want to at some point use AppShow or close DPlot.)

If the latter, then the workaround I mentioned (restoring DPlot) will do the job, unless there's some reason with regard to your application why I shouldn't do this.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
meany



Joined: 21 Jul 2003
Posts: 16
Location: Missouri

PostPosted: Fri Jun 02, 2006 9:19 am    Post subject: Reply with quote

I used to use AppHide right after I started DPlot (without checking the previous use status), but that seemed arrogant of me if they had it running before my app! When I removed the AppHide, I ran into trouble if the user had the general option set to "Always start maximized" (threw me into a redraw endless loop), so I decided to use AppMinimize if DPlot wasn't already running. This way they'd see DPlot in the tray, but the screen flickering and redraw was avoided. That's when I encountered this problem.

I just tried using AppHide, only when DPlot wasn't running (where I was using AppHide described above), and that seems to work fine. Of course, my user doesn't see DPlot in the tray then. Your product doesn't get quite as visible credit as it should (!) but this will work perfectly for me. The possibility of the user bringing up DPlot and minimizing it in-between still remains, although it's rather unlikely. I tried this and it does trigger the error. If you want to restore it in cases like this, it won't ruffle my feathers if the window pops up if the user brought up DPlot in the middle and minimized it. That would be a case where they physically started it and wanted it showing up in some form. I just wanted to avoid hiding it when they wanted to see it. I originally stopped DPlot when I exited, which was extra arrogant! I'm finally getting cleaner about using DPlot after 3 years! It's been working great for me for all that time! Thanks again.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Fri Jun 02, 2006 10:34 am    Post subject: Reply with quote

Charlotte,
Thanks for all the info.

Quote:
I used to use AppHide right after I started DPlot (without checking the previous use status), but that seemed arrogant of me if they had it running before my app!


If you start DPlot with DPlot_Start(1,&was_active) then it will start up hidden if it was not already running, and unchanged if it was running. was_active will tell you whether DPlot was already running so that you can decide how much cleanup you should do or whether you should close it down when you're done.

Quote:
I ran into trouble if the user had the general option set to "Always start maximized"


That should have been fixed a while back. If you run into any problems with it please let me know.

Quote:
Your product doesn't get quite as visible credit as it should (!)...


Thanks for the concern, but my thinking is that if your users are in need of a graph program, they'll either 1) figure it out on their own by stumbling into dplotjr.exe or 2) ask you about it and you'll give them a glowing review Smile. And if they aren't in need of a graph program, well it really doesn't matter whether DPlot is hidden or not.

The minimize problem is fixed and will be included in the next update, hopefully coming soon.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
meany



Joined: 21 Jul 2003
Posts: 16
Location: Missouri

PostPosted: Mon Jun 05, 2006 2:17 pm    Post subject: Reply with quote

On the "Always start maximized" issue, now that I have the GenerateMesh problem worked around, it seems to be okay. If it's set to maximize, there's some flashing in the background, but everything ends up okay. When I had both issues going on is when the problem looped up. I'm running V1.0.5.5 and my user with the issue was using V1.0.5.3.

Thanks again for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group