| View previous topic :: View next topic |
| Author |
Message |
Sy
Joined: 28 Mar 2006 Posts: 5
|
Posted: Tue Mar 28, 2006 12:08 pm Post subject: Stupid Question??? |
|
|
I have only just discovered this software and am very impressed so far. I do however want to automate it with Excel for some projects I am doing at work. I have downloaded Dplot and Dplotjr (both trial versions for now)
What I want to do is have a button in Excel which when the user clicks will launch the viewer and display a graph. This graph will always be of the same type (contour) with the same scales, and same settings. The graph will also always be constructed from the same selection range within Excel.
I presume this is easy enough but to be honest I havent a clue where to begin. I am reasonbly fluent with VB but have never used any DDE stuff or really used VBA within Excel much. If someone could point me in the direction of any examples I would be most appreciative. The VB projects within DPlot Jr were helpful but they didnt show me how to do that from within Excel. Im sure I can figure out the command line stuff (to configure the graph) once Im going but the actual task of loading Dplot and telling it the selection set Im using for data from within Excel is one step too far!
Unfortunately it is the first step so any help would be great!
Thanks in advance
Sy |
|
| Back to top |
|
 |
DPlotAdmin Site Admin

Joined: 24 Jun 2003 Posts: 2016 Location: Vicksburg, Mississippi
|
Posted: Tue Mar 28, 2006 4:04 pm Post subject: |
|
|
Sy,
Not even close to a stupid question
There's no need to concern yourself with DDE if you use DPLOTLIB.DLL, as is done with the Excel Add-In and with all of the demo programs you looked at. Probably the best place for you to start is with the Add-In. If you didn't install it, do so. If you DID install it but don't see a "DPlot" menu item in Excel, click Tools>Add-Ins and check the "DPlot Interface" box.
Now select Tools>Macro>Visual Basic Editor. In the Project pane you should see "DPlotLib (dplotlib.xla)". Click the + sign next to it. You'll be prompted for a password; it is "dplot". Under DPlotLib click the + sign next to "Modules", and double-click "DPlotData".
You'll need to copy everything between the "DPlot-specific stuff" comment and "Dim D as DPLOT" to your own VBA routine. If you want your routine to make smart number formatting decisions based on your cell formats you'll also want to copy the function DPlotNumberFormat. After that, the routine you'll want to start with as a base is XYZSurface. It contains a bit of gobbledygook to allow you to use multiple selections, everything else should be fairly straightforward.
If you have any questions about any of this or get stuck let me know. There are other folks that know much more about VBA than me, but together we should be able to work things out without too much trouble. _________________ David Hyde
support@dplot.com |
|
| Back to top |
|
 |
Sy
Joined: 28 Mar 2006 Posts: 5
|
Posted: Wed Mar 29, 2006 9:52 am Post subject: |
|
|
Thanks for your help,
I had to play with it for a bit but eventually got it sorted and it is now working like a charm.
I have managed to do everything I want apart from one last problem. It concerns the 3d_border method. The syntax if Im correct is
DPlot_3DBorder(docnum, x, y)
Where x is the number of points in your border and y is a border array
The example gives the array in the format border(2,9) as double
I cant for the life of me figure out how to do what I need though. Basically I have the following co-ordinates and I need to put them in a similar array.
308.5 75
708.5 75
708.5 320
1323.5 320
1323.5 -320
708.5 -320
708.5 -75
308.5 -75
I presume my final call will look something like
DPlot_3DBorder(docnum, 8, y)
where y is the array I need??
Anny help would be great
Cheers
Sy |
|
| Back to top |
|
 |
DPlotAdmin Site Admin

Joined: 24 Jun 2003 Posts: 2016 Location: Vicksburg, Mississippi
|
Posted: Wed Mar 29, 2006 10:40 am Post subject: |
|
|
Sorry, for one thing I didn't realize until your question that I had neglected to include the declaration for DPlot_3DBorder in the Add-In (as well as the VB examples). You should have something like:
Declare Function DPlot_3DBorder Lib "DPlotLib" (ByVal DocNum As Long, ByVal NumPoints As Long, ByRef Border As Double) As Long
For your example NumPoints should be 8, as you have.
Since storage order for multi-dimensioned arrays is different for VB vs. VB.NET you're probably better off using a single dimension, or the next version of Excel might break your code. Assuming Option Base 0, you'd have:
Dim Border(15) as Double
Border(0) = 308.5
Border(1) = 75
Border(2) = 708.5
Border(3) = 75
Border(4) = 708.5
Border(5) = 320
.
.
Border(14) = 308.5
Border(15) = -75
Let me know if you have any questions or if this doesn't work as expected. _________________ David Hyde
support@dplot.com |
|
| Back to top |
|
 |
Sy
Joined: 28 Mar 2006 Posts: 5
|
Posted: Wed Mar 29, 2006 10:47 am Post subject: |
|
|
Hi,
Thanks for the super quick response, that worked perfectly. One other thing, is it possible to put symbols (i.e just a dot or a square) at the x,y co-ordinates of data used to create the contour plot??
Thanks again
Sy |
|
| Back to top |
|
 |
DPlotAdmin Site Admin

Joined: 24 Jun 2003 Posts: 2016 Location: Vicksburg, Mississippi
|
Posted: Wed Mar 29, 2006 11:07 am Post subject: |
|
|
It is possible with the latest licensed version, currently available only via the Check for Updates command on the Help menu. That feature will be included in the next trial version as well. _________________ David Hyde
support@dplot.com |
|
| Back to top |
|
 |
|