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 

Stupid Question???

 
Post new topic   Reply to topic    DPlot Forum Index -> Excel
View previous topic :: View next topic  
Author Message
Sy



Joined: 28 Mar 2006
Posts: 5

PostPosted: Tue Mar 28, 2006 12:08 pm    Post subject: Stupid Question??? Reply with quote

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
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Tue Mar 28, 2006 4:04 pm    Post subject: Reply with quote

Sy,
Not even close to a stupid question Very Happy

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.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sy



Joined: 28 Mar 2006
Posts: 5

PostPosted: Wed Mar 29, 2006 9:52 am    Post subject: Reply with quote

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
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Wed Mar 29, 2006 10:40 am    Post subject: Reply with quote

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.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sy



Joined: 28 Mar 2006
Posts: 5

PostPosted: Wed Mar 29, 2006 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Wed Mar 29, 2006 11:07 am    Post subject: Reply with quote

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.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Leon



Joined: 22 Dec 2015
Posts: 2

PostPosted: Tue Dec 22, 2015 7:14 am    Post subject: DPlot_3DBorder not running from excel vba Reply with quote

Hi,
I've got excel 2010 with vba 7.0.

I've got the following data in excel
-1.618034 1.90211308 6.236067772
-1 0 1
-0.618034 1.1755705 1.76393199
-0.381965995 1.90211308 3.76393199
0 0.726543069 0.527864873
0 3.077683449 9.472135544
0.381965995 1.90211308 3.76393199
0.618034 1.1755705 1.76393199
1 0 1
1.618034 1.90211308 6.236067772

And the following module

'-----------------------------------------------------------------------------------
'
' DPlot-specific stuff
'
Global Const DPLOT_DDE_VERSION = 4 ' Version 4 structure allows up to 100 data sets per plot, adds a 4th title line,
' and allows up to 200 characters (from 80) for title lines and axis labels

Type DPLOT
version As Long ' version number of this structure
hwnd As Long ' handle of client application window
DataFormat As Long ' XY pairs, DX and Y, etc. See DATA_ constants
MaxCurves As Long ' DataFormat Description
' DATA_XYXY Max. number of curves, <= 20
' DATA_DXY ..
' DATA_XYYY ..
' DATA_3D Number of grid cells in X direction,
' = number of data columns-1
' DATA_3DR not used
' DATA_1D Max. number of groups, <20>1) (CAN be negative and/or > 1,
' but exact placement is then a bit hard to predict)
LegendY As Single ' top coord of legend, again expressed as a ratio
' of plot size
NP(0 To 99) As Long ' actual number of points in each curve/group for
' XY/1D plots; cannot exceed MaxPoints.
LineType(0 To 99) As Long ' line types (see codes below)
SymbolType(0 To 99) As Long ' symbol types (see codes below)
SizeofExtraInfo As Long ' Extra information following X,Y data. No need to
' fill in this member for DPLOTLIB calls
Legend As String * 8080 ' Legend(0->79) is the caption for the legend
' Legend(n*80->n*80+79) is the caption for the n'th curve
' Ideally this would be dimensioned as Legend(0 to 100) as String*80,
' but VBA wants to do weird unicode conversion on the array when
' we do that. Same problem exists for the Label array (next).
' Fortunately we can get around this mess with individual DPlot commands.
label As String * 4000 ' Strings displayed beside the last data point
' in a curve, 40 characters per curve
Title1 As String * 200
Title2 As String * 200
Title3 As String * 200
Title4 As String * 200
XAxis As String * 200 ' X Axis label.
YAxis As String * 200 ' Y Axis label.
End Type

Type DPLOT_PLOTMETRICS
size As Long ' size of this structure, should be filled in by the caller
hll As Long ' horizontal and
vll As Long ' vertical coordinates of the lower left corner of the plot, in pixels
hur As Long ' horizontal and
vur As Long ' vertical coordinates of the upper right corner of the plot, in pixels
xlo As Single ' value of x at the left plot extent
ylo As Single ' value of y at the bottom plot extent
xhi As Single ' value of x at the right plot extent
yhi As Single ' value of z at the top plot extent
End Type

#If VBA7 Then
' DDEML Functions
Declare PtrSafe Function DdeAccessData Lib "user32" (ByVal hData As LongPtr, pcbDataSize As Long) As Long
Declare PtrSafe Function DdeAddData Lib "user32" (ByVal hData As LongPtr, pSrc As Byte, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare PtrSafe Function DdeAddDataDPLOT Lib "user32" Alias "DdeAddData" (ByVal hData As LongPtr, d As DPLOT, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare PtrSafe Function DdeAddDataDbl Lib "user32" Alias "DdeAddData" (ByVal hData As LongPtr, X As Double, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare PtrSafe Function DdeAddDataInt Lib "user32" Alias "DdeAddData" (ByVal hData As LongPtr, X As Long, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare PtrSafe Function DdeAddDataStr Lib "user32" Alias "DdeAddData" (ByVal hData As LongPtr, ByVal str As String, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare PtrSafe Function DdeClientTransaction Lib "user32" (pData As Byte, ByVal cbData As Long, ByVal hConv As LongPtr, ByVal hszItem As LongPtr, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As LongPtr
Declare PtrSafe Function DdeClientTransactionHandle Lib "user32" Alias "DdeClientTransaction" (ByVal hData As LongPtr, ByVal cbData As Long, ByVal hConv As LongPtr, ByVal hszItem As LongPtr, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As Long
Declare PtrSafe Function DdeClientTransactionReq Lib "user32" Alias "DdeClientTransaction" (ByVal dummy As LongPtr, ByVal cbData As Long, ByVal hConv As LongPtr, ByVal hszItem As LongPtr, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As Long
Declare PtrSafe Function DdeClientTransactionStr Lib "user32" Alias "DdeClientTransaction" (ByVal text As String, ByVal cbData As Long, ByVal hConv As LongPtr, ByVal dummy1 As LongPtr, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy2 As Long) As Long
Declare PtrSafe Function DdeConnect Lib "user32" (ByVal idInst As Long, ByVal hszService As LongPtr, ByVal hszTopic As LongPtr, ByVal dummy As Long) As LongPtr
Declare PtrSafe Function DdeCreateDataHandleNoSrc Lib "user32" Alias "DdeCreateDataHandle" (ByVal idInst As Long, ByVal dummy As Long, ByVal cb As Long, ByVal cbOff As Long, ByVal hszItem As LongPtr, ByVal wFmt As Long, ByVal afCmd As Long) As Long
Declare PtrSafe Function DdeCreateStringHandle Lib "user32" Alias "DdeCreateStringHandleA" (ByVal idInst As Long, ByVal psz As String, ByVal iCodePage As Long) As Long
Declare PtrSafe Function DdeDisconnect Lib "user32" (ByVal hConv As LongPtr) As Long
Declare PtrSafe Function DdeFreeDataHandle Lib "user32" (ByVal hData As LongPtr) As Long
Declare PtrSafe Function DdeFreeStringHandle Lib "user32" (ByVal idInst As Long, ByVal hsz As LongPtr) As Long
Declare PtrSafe Function DdeGetLastError Lib "user32" (ByVal idInst As Long) As Long
Declare PtrSafe Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (pidInst As Long, ByVal pfnCallback As LongPtr, ByVal afCmd As Long, ByVal ulRes As Long) As Long
Declare PtrSafe Function DdeUnaccessData Lib "user32" (ByVal hData As LongPtr) As Long
Declare PtrSafe Function DdeUninitialize Lib "user32" (ByVal idInst As Long) As Long

' Registry functions
Declare PtrSafe Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As LongPtr) As Long
Declare PtrSafe Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As LongPtr, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _
LongPtr) As Long
Declare PtrSafe Function RegQueryValueExString Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As LongPtr, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As String, lpcbData As Long) As Long
Declare PtrSafe Function RegQueryValueExNULL Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As LongPtr, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As Long, lpcbData As Long) As Long

Declare PtrSafe Function BringWindowToTop Lib "user32" (ByVal hwnd As LongPtr) As Long
Declare PtrSafe Sub CopyMemoryToStr Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As String, ByVal Source As LongPtr, ByVal length As Long)
Declare PtrSafe Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Declare PtrSafe Function FindWindowClass Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal dummy As Long) As LongPtr
Declare PtrSafe Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long
Declare PtrSafe Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Declare PtrSafe Function GetLongPathName Lib "kernel32" Alias "GetLongPathNameA" (ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
Declare PtrSafe Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Declare PtrSafe Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Declare PtrSafe Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, ByVal Source As Long, ByVal length As Long)
Declare PtrSafe Sub PtrToStr Lib "kernel32" Alias "lstrcpyA" (ByVal RetVal As String, ByVal Ptr As LongPtr)
Declare PtrSafe Function RegisterClipboardFormat Lib "user32" Alias "RegisterClipboardFormatA" (ByVal lpString As String) As Long
Declare PtrSafe Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As Long, lParam As LongPtr) As Long
Declare PtrSafe Function SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOwner As LongPtr, ByVal nFolder As Integer, ppidl As Long) As Long
Declare PtrSafe Function SHGetPathFromIDList Lib "Shell32" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal szPath As String) As Long
Declare PtrSafe Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long
Declare PtrSafe Function WaitForInputIdle Lib "user32" (ByVal hProcess As LongPtr, ByVal dwMilliseconds As Long) As Long
Declare PtrSafe Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
#Else
' DDEML Functions
Declare Function DdeAccessData Lib "user32" (ByVal hData As Long, pcbDataSize As Long) As Long
Declare Function DdeAddData Lib "user32" (ByVal hData As Long, pSrc As Byte, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeAddDataDPLOT Lib "user32" Alias "DdeAddData" (ByVal hData As Long, d As DPLOT, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeAddDataDbl Lib "user32" Alias "DdeAddData" (ByVal hData As Long, X As Double, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeAddDataInt Lib "user32" Alias "DdeAddData" (ByVal hData As Long, X As Long, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeAddDataStr Lib "user32" Alias "DdeAddData" (ByVal hData As Long, ByVal str As String, ByVal cb As Long, ByVal cbOff As Long) As Long
Declare Function DdeClientTransaction Lib "user32" (pData As Byte, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As Long
Declare Function DdeClientTransactionHandle Lib "user32" Alias "DdeClientTransaction" (ByVal hData As Long, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As Long
Declare Function DdeClientTransactionReq Lib "user32" Alias "DdeClientTransaction" (ByVal dummy As Long, ByVal cbData As Long, ByVal hConv As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy As Long) As Long
Declare Function DdeClientTransactionStr Lib "user32" Alias "DdeClientTransaction" (ByVal text As String, ByVal cbData As Long, ByVal hConv As Long, ByVal dummy1 As Long, ByVal wFmt As Long, ByVal wType As Long, ByVal dwTimeout As Long, ByVal dummy2 As Long) As Long
Declare Function DdeConnect Lib "user32" (ByVal idInst As Long, ByVal hszService As Long, ByVal hszTopic As Long, ByVal dummy As Long) As Long
Declare Function DdeCreateDataHandleNoSrc Lib "user32" Alias "DdeCreateDataHandle" (ByVal idInst As Long, ByVal dummy As Long, ByVal cb As Long, ByVal cbOff As Long, ByVal hszItem As Long, ByVal wFmt As Long, ByVal afCmd As Long) As Long
Declare Function DdeCreateStringHandle Lib "user32" Alias "DdeCreateStringHandleA" (ByVal idInst As Long, ByVal psz As String, ByVal iCodePage As Long) As Long
Declare Function DdeDisconnect Lib "user32" (ByVal hConv As Long) As Long
Declare Function DdeFreeDataHandle Lib "user32" (ByVal hData As Long) As Long
Declare Function DdeFreeStringHandle Lib "user32" (ByVal idInst As Long, ByVal hsz As Long) As Long
Declare Function DdeGetLastError Lib "user32" (ByVal idInst As Long) As Long
Declare Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (pidInst As Long, ByVal pfnCallback As Long, ByVal afCmd As Long, ByVal ulRes As Long) As Integer
Declare Function DdeUnaccessData Lib "user32" (ByVal hData As Long) As Long
Declare Function DdeUninitialize Lib "user32" (ByVal idInst As Long) As Long


' Registry functions
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _
Long) As Long
Declare Function RegQueryValueExString Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As String, lpcbData As Long) As Long
Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _
String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _
As Long, lpcbData As Long) As Long

Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Declare Sub CopyMemoryToStr Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As String, ByVal Source As Long, ByVal length As Long)
Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Declare Function FindWindowClass Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal dummy As Long) As Long
Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long
Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
Declare Function GetLongPathName Lib "kernel32" Alias "GetLongPathNameA" (ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, ByVal Source As Long, ByVal length As Long)
Declare Function RegisterClipboardFormat Lib "user32" Alias "RegisterClipboardFormatA" (ByVal lpString As String) As Long
Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOwner As Long, ByVal nFolder As Integer, ppidl As Long) As Long
Declare Function SHGetPathFromIDList Lib "Shell32" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal szPath As String) As Long
Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long
Declare Function WaitForInputIdle Lib "user32" (ByVal hProcess As Long, ByVal dwMilliseconds As Long) As Long
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
#End If

Global Const TimeOut = 20000 ' TimeOut value in msec for most Dde transactions
Global Const MAX_ADD = 32768

' XY Scaling codes:
Global Const SCALE_LINEARX_LINEARY = 1
Global Const SCALE_LINEARX_LOGY = 2
Global Const SCALE_LOGX_LINEARY = 3
Global Const SCALE_LOGX_LOGY = 4
Global Const SCALE_TRIPARTITE = 5
Global Const SCALE_LINEARX_PROBABILITY = 6
Global Const SCALE_GRAINSIZE_DIST = 7
Global Const SCALE_POLAR = 8
Global Const SCALE_BARCHART = 9
Global Const SCALE_LOGX_PROBABILITY = 10
Global Const SCALE_PROBX_LINEARY = 11
Global Const SCALE_PROBX_LOGY = 12
Global Const SCALE_PROBX_PROBY = 13
Global Const SCALE_TRIANGLEPLOT = 14

' Unit-specific scaling codes ... combine with above values using OR operator

Global Const UNITS_DEFAULT = 0
Global Const UNITS_TRIPARTITE_INCHES = UNITS_DEFAULT ' X=frequency (Hz) Velocity (Y) in inches/sec
Global Const UNITS_TRIPARTITE_FEET = &H100 ' X=frequency, Y=feet/sec
Global Const UNITS_TRIPARTITE_MILLIMETERS = &H200 ' X=frequency, Y=mm/sec
Global Const UNITS_TRIPARTITE_CENTIMETERS = &H300 ' X=frequency, Y=cm/sec
Global Const UNITS_TRIPARTITE_METERS = &H400 ' X=frequency, Y=meters/sec
Global Const UNITS_TRIPARTITE_TINCHES = &H500 ' X=period (seconds), Velocity in inches/sec
Global Const UNITS_TRIPARTITE_TFEET = &H600 ' X=period, Y=feet/sec
Global Const UNITS_TRIPARTITE_TMM = &H700 ' X=period, Y=millimeters/sec
Global Const UNITS_TRIPARTITE_TCM = &H800 ' X=period, Y=centimeters/sec
Global Const UNITS_TRIPARTITE_TMETERS = &H900 ' X=period, Y=meters/sec
Global Const UNITS_GRAINSIZE_MILLIMETERS = UNITS_DEFAULT ' Grain sizes (X) in mm
Global Const UNITS_GRAINSIZE_INCHES = &H100 ' inches
Global Const UNITS_POLAR_RADIANS = UNITS_DEFAULT ' Rotation (X) in radians
Global Const UNITS_POLAR_DEGREES = &H100 ' degrees
Global Const UNITS_USERDEFINED = &H7F00

' Data organization

Global Const DATA_XYXY = 0 ' One or more sets of X,Y data
Global Const DATA_DXY = 1 ' One or more X,Y curves. Constant spacing in X and same number of points in all curves.
Global Const DATA_XYYY = 2 ' One or more X,Y curves. All curves have the same X values.
Global Const DATA_3D = 3 ' Z values on a rectangular grid
Global Const DATA_3DR = 4 ' Random X,Y,Z values
Global Const DATA_IMAGE = 5 ' Used only by DPlot - there's no way to SEND DPlot an image
Global Const DATA_1D = 6 ' One or more groups of Y values.
Global Const DATA_3DS = 7 ' X,Y,Z scatter plot, multiple data sets allowed.
Global Const DATA_4D = 8 ' 4D surface plot (x,y,z,magnitude)
Global Const DATA_4DS = 9 ' 4D scatter plot

' Line styles:
Global Const LINESTYLE_NONE = 0
Global Const LINESTYLE_SOLID = 1
Global Const LINESTYLE_LONGDASH = 2
Global Const LINESTYLE_DOTTED = 3
Global Const LINESTYLE_DASHDOT = 4
Global Const LINESTYLE_MEDDASH = 5
Global Const LINESTYLE_DASHDOTDOT = 6

' Symbol styles
Global Const SYMBOLSTYLE_NONE = 0
Global Const SYMBOLSTYLE_DOT = 1
Global Const SYMBOLSTYLE_CROSS = 2
Global Const SYMBOLSTYLE_ASTERISK = 3
Global Const SYMBOLSTYLE_X = 4
Global Const SYMBOLSTYLE_SQUARE = 5
Global Const SYMBOLSTYLE_DIAMOND = 6
Global Const SYMBOLSTYLE_TRIANGLE = 7
Global Const SYMBOLSTYLE_OCTAGON = 8
Global Const SYMBOLSTYLE_ITRIANGLE = 9
Global Const SYMBOLSTYLE_HEXAGON = 10
Global Const SYMBOLSTYLE_PENTAGON = 11
Global Const SYMBOLSTYLE_STAR = 12
Global Const SYMBOLSTYLE_FILL = &H100 ' May be combined with other styles

' DPlot Number formats
Global Const NF_DEFAULT = 0
Global Const NF_SCIENTIFIC = 1
Global Const NF_FRACTION = 2
Global Const NF_DOLLARSANDCENTS = 3
Global Const NF_DOLLARS = 4
Global Const NF_TIMEOFDAY = 5
Global Const NF_CALENDAR = 6
Global Const NF_PI = 7
Global Const NF_PI_FRACTION = 8
Global Const NF_MONTH = 9
Global Const NF_DAYOFWEEK = 10
Global Const NF_POWERSOF10 = 11
Global Const NF_NONE = 12
Global Const NF_CALENDAR2 = 13
Global Const NF_HEXADECIMAL = 14
Global Const NF_PERCENT = 15
Global Const NF_DEGS_MINS = 16
Global Const NF_DEGS_MINS_SECS = 17
Global Const NF_ENGINEER = 18
Global Const NF_HHMMSS = 19
Global Const NF_TIMEOFDAY2 = 20


Declare Function DPlot_3DBorder Lib "user32" (ByVal DocNum As Long, ByVal NumPoints As Long, ByRef Border As Double) As Long

Sub doborder()

Dim Border(0 To 2, 0 To 1) As Double
Dim doc, ret As Long

Sheets(1).Range("a1:c10").Select
Call XYZSurface
doc = DPlotGetActiveDocument()

ret = DPlot_3DBorder(doc, 3, Border)


End Sub
'-----------------------------------------------------------------------------------

And when I execute the sub function doborder Dplot shows the pentagone but not the star and returns the Compile error: ByRef argument type mismatch

If I change "user32" by "DPlotLib" Excel cannot find it

In dplotlib.xla there is no trace of DPlot_3DBorder

I have DPlot Version 2.3.5.4

Could you please help me?

Many thanks
Leon.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Tue Dec 22, 2015 9:09 am    Post subject: Reply with quote

The Add-in hasn't used dplotlib.dll for several years for security reasons. (Not real security reasons, but Excel balking at it.) Most of the functions of dplotlib.dll have been ported to VBA and are included in the Add-In VBA code. Unfortunately "most" does not include DPlot_3DBorder. I'll try to whip something up soon and I'll post about it here when done.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Leon



Joined: 22 Dec 2015
Posts: 2

PostPosted: Thu Dec 24, 2015 1:40 am    Post subject: DPlot_3DBorder not running from excel vba Reply with quote

Is it possible to call a Dplot macro that contains DPlot_3DBorder? How would it be?

Regards
Leon
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Thu Dec 24, 2015 3:59 pm    Post subject: Reply with quote

That's currently not possible, but I'm working on it.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Excel 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